Unstable 1.2.4.0
This commit is contained in:
@@ -19,13 +19,12 @@ namespace Barotrauma
|
||||
LanguageIdentifier language = languageName.ToLanguageIdentifier();
|
||||
if (!TextManager.TextPacks.ContainsKey(language))
|
||||
{
|
||||
TextManager.TextPacks.TryAdd(language, ImmutableHashSet<TextPack>.Empty);
|
||||
TextManager.TextPacks.TryAdd(language, ImmutableList<TextPack>.Empty);
|
||||
}
|
||||
|
||||
var newPack = new TextPack(this, mainElement, language);
|
||||
var newHashSet = TextManager.TextPacks[language].Add(newPack);
|
||||
var newList = TextManager.TextPacks[language].Add(newPack);
|
||||
TextManager.TextPacks.TryRemove(language, out _);
|
||||
TextManager.TextPacks.TryAdd(language, newHashSet);
|
||||
TextManager.TextPacks.TryAdd(language, newList);
|
||||
TextManager.IncrementLanguageVersion();
|
||||
}
|
||||
|
||||
@@ -33,9 +32,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (var kvp in TextManager.TextPacks.ToArray())
|
||||
{
|
||||
var newHashSet = kvp.Value.Where(p => p.ContentFile != this).ToImmutableHashSet();
|
||||
var newList = kvp.Value.Where(p => p.ContentFile != this).ToImmutableList();
|
||||
TextManager.TextPacks.TryRemove(kvp.Key, out _);
|
||||
if (newHashSet.Count != 0) { TextManager.TextPacks.TryAdd(kvp.Key, newHashSet); }
|
||||
if (newList.Count != 0) { TextManager.TextPacks.TryAdd(kvp.Key, newList); }
|
||||
}
|
||||
TextManager.IncrementLanguageVersion();
|
||||
if (!TextManager.TextPacks.ContainsKey(GameSettings.CurrentConfig.Language))
|
||||
@@ -49,7 +48,11 @@ namespace Barotrauma
|
||||
|
||||
public override void Sort()
|
||||
{
|
||||
//Overrides for text packs don't exist! Should we change this?
|
||||
foreach (var language in TextManager.TextPacks.Keys.ToList())
|
||||
{
|
||||
TextManager.TextPacks[language] =
|
||||
TextManager.TextPacks[language].Sort((t1, t2) => (t1.ContentFile.ContentPackage?.Index ?? int.MaxValue) - (t2.ContentFile.ContentPackage?.Index ?? int.MaxValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user