MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / MainInterface

Method MainInterface

source/frontend/StarMainInterface.cpp:70–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 : message(message), cooldown(cooldown), springState(spring) {}
69
70MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter, CinematicPtr cinematicOverlay)
71 : m_guiContext(GuiContext::singletonPtr())
72 , m_config(MainInterfaceConfig::loadFromAssets())
73 , m_client(std::move(client))
74 , m_worldPainter(std::move(painter))
75 , m_cinematicOverlay(std::move(cinematicOverlay))
76 , m_containerInteractor(make_shared<ContainerInteractor>())
77{
78 GuiReader itemSlotReader;
79 m_cursorItem = convert<ItemSlotWidget>(itemSlotReader.makeSingle("cursorItemSlot", m_config->cursorItemSlot));
80
81 m_planetNameTimer = GameTimer(m_config->planetNameTime);
82
83 m_debugSpatialClearTimer = GameTimer(m_config->debugSpatialClearTime);
84 m_debugMapClearTimer = GameTimer(m_config->debugMapClearTime);
85
86 m_stickyTargetingTimer = GameTimer(m_config->monsterHealthBarTime);
87
88 m_inventoryWindow = make_shared<InventoryPane>(this, m_client->mainPlayer(), m_containerInteractor);
89 m_paneManager.registerPane(MainInterfacePanes::Inventory, PaneLayer::Window, m_inventoryWindow, [this](PanePtr const&) {
90 if (auto player = m_client->mainPlayer())
91 player->clearSwap();
92 if (m_containerPane) {
93 m_containerPane->dismiss();
94 m_containerPane = {};
95 m_containerInteractor->closeContainer();
96 }
97 for (EntityId id : m_interactionScriptPanes.keys()) {
98 if (m_paneManager.isDisplayed(m_interactionScriptPanes[id]) && as<ScriptPane>(m_interactionScriptPanes[id])->openWithInventory())
99 m_interactionScriptPanes[id]->dismiss();
100 }
101 });
102
103 m_overflowMessage = make_shared<GuiMessage>("", 0);
104
105 m_plainCraftingWindow = make_shared<CraftingPane>(m_client->worldClient(), m_client->mainPlayer(), JsonObject{{"filter", JsonArray{"plain"}}}, m_client->mainPlayer()->entityId());
106 m_paneManager.registerPane(MainInterfacePanes::CraftingPlain, PaneLayer::Window, m_plainCraftingWindow);
107
108 m_paneManager.registerPane(MainInterfacePanes::EscapeDialog, PaneLayer::ModalWindow, createEscapeDialog());
109
110 auto songbookInterface = make_shared<SongbookInterface>(m_client->mainPlayer());
111 m_paneManager.registerPane(MainInterfacePanes::Songbook, PaneLayer::Window, songbookInterface);
112
113 m_questLogInterface = make_shared<QuestLogInterface>(m_client->questManager(), m_client->mainPlayer(), m_cinematicOverlay, m_client);
114 m_paneManager.registerPane(MainInterfacePanes::QuestLog, PaneLayer::Window, m_questLogInterface);
115
116 auto aiInterface = make_shared<AiInterface>(m_client, m_cinematicOverlay, &m_paneManager);
117 m_paneManager.registerPane(MainInterfacePanes::Ai, PaneLayer::Window, aiInterface);
118
119 m_codexInterface = make_shared<CodexInterface>(m_client->mainPlayer());
120 m_paneManager.registerPane(MainInterfacePanes::Codex, PaneLayer::Window, m_codexInterface);
121
122 m_optionsMenu = make_shared<OptionsMenu>(&m_paneManager,m_client);
123 m_paneManager.registerPane(MainInterfacePanes::Options, PaneLayer::ModalWindow, m_optionsMenu);
124
125 m_popupInterface = make_shared<PopupInterface>();
126 m_paneManager.registerPane(MainInterfacePanes::Popup, PaneLayer::Window, m_popupInterface);
127

Callers

nothing calls this directly

Calls 15

GameTimerClass · 0.85
singletonClass · 0.85
makeSingleMethod · 0.80
mainPlayerMethod · 0.80
registerPaneMethod · 0.80
closeContainerMethod · 0.80
openWithInventoryMethod · 0.80
worldClientMethod · 0.80
entityIdMethod · 0.80
jsonMethod · 0.80
assetsMethod · 0.80
setWireConnectorMethod · 0.80

Tested by

no test coverage detected