Client LuaCsForBarotrauma
WrappedLString.cs
1 #nullable enable
2 namespace Barotrauma
3 {
5  {
6  private readonly LocalizedString nestedStr;
7  private readonly float lineLength;
8  private readonly GUIFont font;
9  private readonly float textScale;
10 
11  public WrappedLString(LocalizedString text, float lineLength, GUIFont font, float textScale = 1.0f)
12  {
13  this.nestedStr = text;
14  this.lineLength = lineLength;
15  this.font = font;
16  this.textScale = textScale;
17  }
18 
19  public override bool Loaded => nestedStr.Loaded;
20  public override void RetrieveValue()
21  {
22  cachedValue =
23  font.GetFontForStr(nestedStr.Value) is ScalableFont scalableFont
24  ? ToolBox.WrapText(nestedStr.Value, lineLength, scalableFont, textScale)
25  : nestedStr.Value;
27  }
28  }
29 }
string WrapText(string text, float width)
WrappedLString(LocalizedString text, float lineLength, GUIFont font, float textScale=1.0f)
override void RetrieveValue()