| 87 | } |
| 88 | |
| 89 | GameEditorModeBase::GameEditorModeBase(ModeManager* modeManager, ModeManager::ModeType modeType, CEGUI::Window* rootWindow) : |
| 90 | AbstractApplicationMode(modeManager, modeType), |
| 91 | mCurrentInputMode(InputModeNormal), |
| 92 | mRootWindow(rootWindow), |
| 93 | mGameMap(ODFrameListener::getSingletonPtr()->getClientGameMap()), |
| 94 | mChatMessageDisplayTime(0), |
| 95 | mChatMessageBoxDisplay(ChatMessageBoxDisplay::hide), |
| 96 | mMiniMap(MiniMap::createMiniMap(rootWindow->getChild(Gui::MINIMAP))), |
| 97 | mMainCullingManager(new CullingManager(mGameMap, CullingType::SHOW_MAIN_WINDOW)), |
| 98 | mKeepReplayAtDisconnect(false), |
| 99 | mConsole(Utils::make_unique<GameEditorModeConsole>(modeManager)), |
| 100 | mCameraTilesIntersections(std::vector<Ogre::Vector3>(4, Ogre::Vector3::ZERO)) |
| 101 | { |
| 102 | addEventConnection( |
| 103 | rootWindow->getChild(Gui::MINIMAP)->subscribeEvent( |
| 104 | CEGUI::Window::EventMouseClick, |
| 105 | CEGUI::Event::Subscriber(&GameEditorModeBase::onMinimapClick, this) |
| 106 | )); |
| 107 | |
| 108 | //Rooms |
| 109 | addEventConnection( |
| 110 | rootWindow->getChild(Gui::BUTTON_DESTROY_ROOM)->subscribeEvent( |
| 111 | CEGUI::Window::EventMouseClick, |
| 112 | CEGUI::Event::Subscriber(ActionSelector{SelectedAction::destroyRoom, mPlayerSelection}) |
| 113 | ) |
| 114 | ); |
| 115 | |
| 116 | // Traps |
| 117 | addEventConnection( |
| 118 | rootWindow->getChild(Gui::BUTTON_DESTROY_TRAP)->subscribeEvent( |
| 119 | CEGUI::Window::EventMouseClick, |
| 120 | CEGUI::Event::Subscriber(ActionSelector{SelectedAction::destroyTrap, mPlayerSelection}) |
| 121 | ) |
| 122 | ); |
| 123 | |
| 124 | // Connect gui buttons (Rooms, traps, spells) |
| 125 | SkillManager::connectGuiButtons(this, mRootWindow, mPlayerSelection); |
| 126 | |
| 127 | // Creature buttons |
| 128 | connectGuiAction(Gui::BUTTON_CREATURE_WORKER, AbstractApplicationMode::GuiAction::ButtonPressedCreatureWorker); |
| 129 | connectGuiAction(Gui::BUTTON_CREATURE_FIGHTER, AbstractApplicationMode::GuiAction::ButtonPressedCreatureFighter); |
| 130 | |
| 131 | // Clear up any events and chat messages |
| 132 | CEGUI::Window* gameChatText = mRootWindow->getChild("GameChatWindow/GameChatText"); |
| 133 | gameChatText->setText(""); |
| 134 | gameChatText->hide(); |
| 135 | mRootWindow->getChild("GameEventText")->setText(""); |
| 136 | |
| 137 | Ogre::Camera* cam = ODFrameListener::getSingleton().getCameraManager()->getActiveCamera(); |
| 138 | mMainCullingManager->computeIntersectionPoints(cam, mCameraTilesIntersections); |
| 139 | mMainCullingManager->startTileCulling(cam, mCameraTilesIntersections); |
| 140 | } |
| 141 | |
| 142 | GameEditorModeBase::~GameEditorModeBase() |
| 143 | { |
nothing calls this directly
no test coverage detected