MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / OnShow

Method OnShow

Sources/Jazz2/UI/Menu/PauseSection.cpp:16–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 }
15
16 void PauseSection::OnShow(IMenuContainer* root)
17 {
18 MenuSection::OnShow(root);
19
20#if defined(WITH_MULTIPLAYER)
21 bool isLocalSession = true, isSpectating = false;
22 if (auto inGameMenu = runtime_cast<InGameMenu>(_root)) {
23 isLocalSession = inGameMenu->IsLocalSession();
24 isSpectating = inGameMenu->IsSpectating();
25 }
26#endif
27
28 _items.clear();
29
30 // TRANSLATORS: Menu item in main menu
31 _items.emplace_back(Item::Resume, _("Resume"));
32
33#if defined(WITH_MULTIPLAYER)
34 if (!isLocalSession) {
35 // TRANSLATORS: Menu item in main menu
36 _items.emplace_back(Item::Spectate, isSpectating ? _("Join Game") : _("Spectate"));
37 }
38#endif
39
40 // TRANSLATORS: Menu item in main menu
41 _items.emplace_back(Item::Options, _("Options"));
42
43#if defined(WITH_MULTIPLAYER)
44 // TRANSLATORS: Menu item in main menu
45 _items.emplace_back(Item::Exit, isLocalSession ? _("Save & Exit") : _("Disconnect & Exit"));
46#else
47 // TRANSLATORS: Menu item in main menu
48 _items.emplace_back(Item::Exit, _("Save & Exit"));
49#endif
50
51 _animation = 0.0f;
52 }
53
54 void PauseSection::OnUpdate(float timeMult)
55 {

Callers

nothing calls this directly

Calls 5

_Function · 0.85
emplace_backMethod · 0.80
IsLocalSessionMethod · 0.45
IsSpectatingMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected