Unstable 0.17.0.0

This commit is contained in:
Markus Isberg
2022-02-26 02:43:01 +09:00
parent a83f375681
commit 3974067915
913 changed files with 32472 additions and 32364 deletions
@@ -0,0 +1,34 @@
#nullable enable
namespace Barotrauma
{
public class LimitLString : LocalizedString
{
private readonly LocalizedString nestedStr;
private readonly GUIFont font;
private readonly int maxWidth;
private ScalableFont? cachedFont = null;
private uint cachedFontSize = 0;
public LimitLString(LocalizedString text, GUIFont font, int maxWidth)
{
this.nestedStr = text;
this.font = font;
this.maxWidth = maxWidth;
}
public override bool Loaded => nestedStr.Loaded;
protected override bool MustRetrieveValue()
{
return base.MustRetrieveValue() || cachedFont != font.Value || cachedFont.Size != font.Size;
}
public override void RetrieveValue()
{
cachedValue = ToolBox.LimitString(nestedStr.Value, font.Value, maxWidth);
cachedFont = font.Value;
cachedFontSize = font.Size;
UpdateLanguage();
}
}
}
@@ -0,0 +1,26 @@
#nullable enable
namespace Barotrauma
{
public class WrappedLString : LocalizedString
{
private readonly LocalizedString nestedStr;
private readonly float lineLength;
private readonly GUIFont font;
private readonly float textScale;
public WrappedLString(LocalizedString text, float lineLength, GUIFont font, float textScale = 1.0f)
{
this.nestedStr = text;
this.lineLength = lineLength;
this.font = font;
this.textScale = textScale;
}
public override bool Loaded => nestedStr.Loaded;
public override void RetrieveValue()
{
cachedValue = ToolBox.WrapText(nestedStr.Value, lineLength, font.Value, textScale);
UpdateLanguage();
}
}
}