OBT/1.2.0(Spring Update)

Sync with Upstream
This commit is contained in:
NotAlwaysTrue
2026-04-25 13:25:41 +08:00
committed by GitHub
parent 5207b381b7
commit 59bc21973a
421 changed files with 24090 additions and 11391 deletions
@@ -9,19 +9,21 @@ namespace Barotrauma
public enum Mode { Start = 0x1, End = 0x2, Both=0x3 }
private readonly LocalizedString nestedStr;
private readonly Mode mode;
private readonly char[]? trimCharacters;
public TrimLString(LocalizedString nestedStr, Mode mode)
public TrimLString(LocalizedString nestedStr, Mode mode, char[]? trimCharacters = null)
{
this.nestedStr = nestedStr;
this.mode = mode;
this.trimCharacters = trimCharacters;
}
public override bool Loaded => nestedStr.Loaded;
public override void RetrieveValue()
{
cachedValue = nestedStr.Value;
if (mode.HasFlag(Mode.Start)) { cachedValue = cachedValue.TrimStart(); }
if (mode.HasFlag(Mode.End)) { cachedValue = cachedValue.TrimEnd(); }
if (mode.HasFlag(Mode.Start)) { cachedValue = cachedValue.TrimStart(trimCharacters); }
if (mode.HasFlag(Mode.End)) { cachedValue = cachedValue.TrimEnd(trimCharacters); }
UpdateLanguage();
}
}