MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / ScoreScreen

Method ScoreScreen

game/ui/city/scorescreen.cpp:19–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace OpenApoc
18{
19ScoreScreen::ScoreScreen(sp<GameState> state, bool showWeeklyUpkeep)
20 : Stage(), menuform(ui().getForm("city/score")), state(state), isWeeklyUpkeep(showWeeklyUpkeep)
21{
22 menuform->findControlTyped<Label>("TEXT_FUNDS")->setText(state->getPlayerBalance());
23 menuform->findControlTyped<Label>("TEXT_DATE")->setText(state->gameTime.getLongDateString());
24 menuform->findControlTyped<Label>("TEXT_WEEK")->setText(state->gameTime.getWeekString());
25
26 formScore = menuform->findControlTyped<Form>("SCORE_VIEW");
27 formFinance = menuform->findControlTyped<Form>("FINANCE_VIEW");
28 title = menuform->findControlTyped<Label>("TITLE");
29
30 auto buttonScore = menuform->findControlTyped<RadioButton>("BUTTON_SCORE");
31 buttonScore->addCallback(FormEventType::CheckBoxSelected, [this](Event *) { setScoreMode(); });
32
33 auto buttonFinance = menuform->findControlTyped<RadioButton>("BUTTON_FINANCE");
34 buttonFinance->addCallback(FormEventType::CheckBoxSelected,
35 [this](Event *) { setFinanceMode(); });
36
37 auto buttonOK = menuform->findControlTyped<GraphicButton>("BUTTON_OK");
38 buttonOK->addCallback(FormEventType::ButtonClick,
39 [](Event *) { fw().stageQueueCommand({StageCmd::Command::POP}); });
40
41 if (isWeeklyUpkeep)
42 {
43 buttonFinance->setChecked(true);
44 }
45 else
46 {
47 buttonScore->setChecked(true);
48 }
49}
50
51ScoreScreen::~ScoreScreen() = default;
52

Callers

nothing calls this directly

Calls 8

getPlayerBalanceMethod · 0.80
getLongDateStringMethod · 0.80
getWeekStringMethod · 0.80
addCallbackMethod · 0.80
stageQueueCommandMethod · 0.80
getFormMethod · 0.45
setTextMethod · 0.45
setCheckedMethod · 0.45

Tested by

no test coverage detected