| 52 | } |
| 53 | |
| 54 | void BaseScreen::begin() |
| 55 | { |
| 56 | BaseStage::begin(); |
| 57 | |
| 58 | baseView = form->findControlTyped<Graphic>("GRAPHIC_BASE_VIEW"); |
| 59 | selText = form->findControlTyped<Label>("TEXT_SELECTED_FACILITY"); |
| 60 | selGraphic = form->findControlTyped<Graphic>("GRAPHIC_SELECTED_FACILITY"); |
| 61 | for (int i = 0; i < 3; i++) |
| 62 | { |
| 63 | auto labelName = format("LABEL_%d", i + 1); |
| 64 | auto label = form->findControlTyped<Label>(labelName); |
| 65 | if (!label) |
| 66 | { |
| 67 | LogError("Failed to find UI control matching \"%s\"", labelName); |
| 68 | } |
| 69 | statsLabels.push_back(label); |
| 70 | |
| 71 | auto valueName = format("VALUE_%d", i + 1); |
| 72 | auto value = form->findControlTyped<Label>(valueName); |
| 73 | if (!value) |
| 74 | { |
| 75 | LogError("Failed to find UI control matching \"%s\"", valueName); |
| 76 | } |
| 77 | statsValues.push_back(value); |
| 78 | } |
| 79 | |
| 80 | auto facilities = form->findControlTyped<ListBox>("LISTBOX_FACILITIES"); |
| 81 | for (auto &i : state->facility_types) |
| 82 | { |
| 83 | auto &facility = i.second; |
| 84 | if (!facility->isVisible()) |
| 85 | continue; |
| 86 | |
| 87 | auto graphic = mksp<Graphic>(facility->sprite); |
| 88 | graphic->AutoSize = true; |
| 89 | graphic->setData(mksp<UString>(i.first)); |
| 90 | graphic->Name = "FACILITY_BUILD_TILE"; |
| 91 | facilities->addItem(graphic); |
| 92 | } |
| 93 | |
| 94 | form->findControlTyped<GraphicButton>("BUTTON_OK") |
| 95 | ->addCallback(FormEventType::ButtonClick, |
| 96 | [](Event *) { fw().stageQueueCommand({StageCmd::Command::POP}); }); |
| 97 | form->findControlTyped<GraphicButton>("BUTTON_BASE_BUYSELL") |
| 98 | ->addCallback( |
| 99 | FormEventType::ButtonClick, |
| 100 | [this](Event *) { |
| 101 | fw().stageQueueCommand({StageCmd::Command::PUSH, mksp<BuyAndSellScreen>(state)}); |
| 102 | }); |
| 103 | form->findControlTyped<GraphicButton>("BUTTON_BASE_HIREFIRESTAFF") |
| 104 | ->addCallback( |
| 105 | FormEventType::ButtonClick, |
| 106 | [this](Event *) { |
| 107 | fw().stageQueueCommand({StageCmd::Command::PUSH, mksp<RecruitScreen>(state)}); |
| 108 | }); |
| 109 | form->findControlTyped<GraphicButton>("BUTTON_BASE_TRANSFER") |
| 110 | ->addCallback( |
| 111 | FormEventType::ButtonClick, |
nothing calls this directly
no test coverage detected