v0.13.0.11

This commit is contained in:
Joonas Rikkonen
2021-04-22 17:33:08 +03:00
parent 0697d7fc64
commit 8bb31f2893
391 changed files with 17271 additions and 5949 deletions
@@ -4,6 +4,7 @@ using Barotrauma.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Barotrauma.Extensions;
namespace Barotrauma
{
@@ -202,6 +203,8 @@ namespace Barotrauma
return false;
}
private static readonly List<string> availableTexts = new List<string>();
public static string Get(string textTag, bool returnNull = false, string fallBackTag = null, bool useEnglishAsFallBack = true)
{
lock (mutex)
@@ -228,11 +231,19 @@ namespace Barotrauma
return textTag;
}
#endif
availableTexts.Clear();
foreach (TextPack textPack in textPacks[Language])
{
string text = textPack.Get(textTag);
if (text != null) { return text; }
var texts = textPack.GetAll(textTag);
if (texts != null)
{
availableTexts.AddRange(texts);
}
}
if (availableTexts.Any())
{
return availableTexts.GetRandom().Replace(@"\n", "\n");
}
if (!string.IsNullOrEmpty(fallBackTag))