|
13 | 13 | #include "UIHelper.h" |
14 | 14 | #include "xrUIXmlParser.h" |
15 | 15 | #include "UIXmlInit.h" |
| 16 | +#include "string_table.h" |
16 | 17 |
|
17 | 18 | UILoadingScreen::UILoadingScreen() |
18 | | - : loadingProgress(nullptr), loadingProgressPercent(nullptr), loadingLogo(nullptr), loadingStage(nullptr), loadingHeader(nullptr), loadingTipNumber(nullptr), loadingTip(nullptr) |
| 19 | + : loadingProgress(nullptr), loadingProgressPercent(nullptr), loadingLogo(nullptr), loadingStage(nullptr), loadingHeader(nullptr), loadingTipNumber(nullptr), loadingTip(nullptr), maxTip(100) |
19 | 20 | { |
20 | 21 | UILoadingScreen::Initialize(); |
21 | 22 | } |
@@ -44,9 +45,13 @@ void UILoadingScreen::Initialize() |
44 | 45 | loadingLogo = UIHelper::CreateStatic(uiXml, "loading_logo", this, false); |
45 | 46 | loadingProgressPercent = UIHelper::CreateStatic(uiXml, "loading_progress_percent", this, false); |
46 | 47 | loadingStage = UIHelper::CreateStatic(uiXml, "loading_stage", this, false); |
| 48 | + |
47 | 49 | loadingHeader = UIHelper::CreateStatic(uiXml, "loading_header", this, false); |
| 50 | + |
48 | 51 | loadingTipNumber = UIHelper::CreateStatic(uiXml, "loading_tip_number", this, false); |
49 | 52 | loadingTip = UIHelper::CreateStatic(uiXml, "loading_tip", this, false); |
| 53 | + |
| 54 | + maxTip = uiXml.ReadAttribInt("loading_tip", 0, "number_of_tips", maxTip); |
50 | 55 | } |
51 | 56 |
|
52 | 57 | void UILoadingScreen::Update(const int stagesCompleted, const int stagesTotal) |
@@ -120,13 +125,29 @@ void UILoadingScreen::SetStageTitle(const char* title) |
120 | 125 | loadingStage->SetText(title); |
121 | 126 | } |
122 | 127 |
|
123 | | -void UILoadingScreen::SetStageTip(const char* header, const char* tipNumber, const char* tip) |
| 128 | +void UILoadingScreen::SetStageTip() |
124 | 129 | { |
125 | 130 | std::scoped_lock<decltype(loadingLock)> lock(loadingLock); |
126 | 131 |
|
127 | | - loadingHeader->SetText(header); |
128 | | - loadingTipNumber->SetText(tipNumber); |
129 | | - loadingTip->SetText(tip); |
| 132 | + u8 tip_num = Random.randI(1, maxTip); |
| 133 | + |
| 134 | + string512 buff; |
| 135 | + |
| 136 | + if (loadingHeader) |
| 137 | + { |
| 138 | + loadingHeader->SetText(CStringTable().translate("ls_header").c_str()); |
| 139 | + } |
| 140 | + if (loadingTipNumber) |
| 141 | + { |
| 142 | + xr_sprintf(buff, "%s%d:", CStringTable().translate("ls_tip_number").c_str(), tip_num); |
| 143 | + shared_str tipNumber = buff; |
| 144 | + loadingTipNumber->SetText(tipNumber.c_str()); |
| 145 | + } |
| 146 | + if (loadingTip) |
| 147 | + { |
| 148 | + xr_sprintf(buff, "ls_tip_%d", tip_num); |
| 149 | + loadingTip->SetText(CStringTable().translate(buff).c_str()); |
| 150 | + } |
130 | 151 | } |
131 | 152 |
|
132 | 153 | void UILoadingScreen::Show(bool status) { CUIWindow::Show(status); } |
|
0 commit comments