10 static Widget CreateStatEntry(Widget container, ResourceName statsLayout,
string text =
"",
string localizedValue =
"",
string value1 =
"",
string value2 =
"",
string value3 =
"")
12 WorkspaceWidget workspace =
GetGame().GetWorkspace();
16 Widget StatEntry = Widget.Cast(workspace.CreateWidgets(statsLayout, container));
20 RichTextWidget statName, statValue;
22 statName = RichTextWidget.Cast(StatEntry.FindAnyWidget(
"StatName"));
23 statValue = RichTextWidget.Cast(StatEntry.FindAnyWidget(
"StatValue"));
24 if (!statName || !statValue)
27 statName.SetText(text);
28 statValue.SetTextFormat(localizedValue, value1, value2, value3);
35 static Widget CreateProgressionStatEntry(Widget container, ResourceName statsProgressionLayout,
string text =
"",
float progressionMinus = 0,
float progression = 0,
string localizedValue =
"",
string value1 =
"",
string value2 =
"",
string value3 =
"")
37 WorkspaceWidget workspace =
GetGame().GetWorkspace();
41 Widget StatProgressionEntry = Widget.Cast(workspace.CreateWidgets(statsProgressionLayout, container));
42 if (!StatProgressionEntry)
45 RichTextWidget statName, statProgressionMinus, statProgression, statValue;
47 statName = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatName"));
48 statProgressionMinus = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatProgressionMinus"));
49 statProgression = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatProgression"));
50 statValue = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatValue"));
51 if (!statName || !statProgressionMinus || !statProgression || !statValue)
54 statName.SetText(text);
56 if (progressionMinus != 0)
57 statProgressionMinus.SetText(
"-"+progressionMinus+
" | ");
59 statProgressionMinus.SetText(
"");
62 statProgression.SetText(
"+"+ progression);
64 statProgression.SetText(
"");
66 statValue.SetTextFormat(localizedValue, value1, value2, value3);
68 return StatProgressionEntry;
73 static Widget CreateHeaderStatEntry(Widget container, ResourceName headerStatsLayout,
string text =
"")
75 WorkspaceWidget workspace =
GetGame().GetWorkspace();
79 Widget HeaderEntry = Widget.Cast(workspace.CreateWidgets(headerStatsLayout, container));
83 RichTextWidget textWidget;
85 textWidget = RichTextWidget.Cast(HeaderEntry.FindAnyWidget(
"HeaderStatText"));
89 textWidget.SetText(text);
96 static void UpdateStatEntry(Widget StatEntry,
string name,
string localizedValue,
string value1 =
"",
string value2 =
"",
string value3 =
"")
101 RichTextWidget statName, statValue;
103 statName = RichTextWidget.Cast(StatEntry.FindAnyWidget(
"StatName"));
104 statValue = RichTextWidget.Cast(StatEntry.FindAnyWidget(
"StatValue"));
105 if (!statName || !statValue)
108 statName.SetText(name);
109 statValue.SetTextFormat(localizedValue, value1, value2, value3);
114 static void UpdateStatProgressionEntry(Widget StatProgressionEntry,
string name,
float progressionMinus,
float progression,
string localizedValue,
string value1 =
"",
string value2 =
"",
string value3 =
"")
116 if (!StatProgressionEntry)
119 RichTextWidget statName, statProgressionMinus, statProgression, statValue;
121 statName = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatName"));
122 statProgressionMinus = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatProgressionMinus"));
123 statProgression = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatProgression"));
124 statValue = RichTextWidget.Cast(StatProgressionEntry.FindAnyWidget(
"StatValue"));
125 if (!statName || !statProgressionMinus || !statProgression || !statValue)
128 statName.SetText(name);
130 if (progressionMinus != 0)
131 statProgressionMinus.SetText(
" | -"+progressionMinus);
133 statProgressionMinus.SetText(
"");
135 if (progression != 0)
136 statProgression.SetText(
"+"+ progression);
138 statProgression.SetText(
"");
140 statValue.SetTextFormat(localizedValue, value1, value2, value3);