| 68 | : message(message), cooldown(cooldown), springState(spring) {} |
| 69 | |
| 70 | MainInterface::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 |
nothing calls this directly
no test coverage detected