| 91 | } |
| 92 | |
| 93 | void MenuModeConfigureSeats::activate() |
| 94 | { |
| 95 | // Loads the corresponding Gui sheet. |
| 96 | getModeManager().getGui().loadGuiSheet(Gui::guiSheet::configureSeats); |
| 97 | |
| 98 | giveFocus(); |
| 99 | |
| 100 | // Play the main menu music |
| 101 | MusicPlayer::getSingleton().play(ConfigManager::getSingleton().getMainMenuMusic()); |
| 102 | |
| 103 | // We use the client game map to allow everybody to see how the server is configuring seats |
| 104 | GameMap* gameMap = ODFrameListener::getSingleton().getClientGameMap(); |
| 105 | gameMap->setGamePaused(true); |
| 106 | |
| 107 | CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton(); |
| 108 | CEGUI::Window* tmpWin = getModeManager().getGui().getGuiSheet(Gui::guiSheet::configureSeats)->getChild("ListPlayers"); |
| 109 | CEGUI::Window* msgWin = getModeManager().getGui().getGuiSheet(Gui::guiSheet::configureSeats)->getChild("LoadingText"); |
| 110 | msgWin->setText("Loading..."); |
| 111 | msgWin->setVisible(false); |
| 112 | |
| 113 | tmpWin->setText(reinterpret_cast<const CEGUI::utf8*>(std::string("Configure map : " + gameMap->getLevelName()).c_str())); |
| 114 | |
| 115 | // Reset the chat |
| 116 | CEGUI::Window* chatWin = tmpWin->getChild("GameChatText"); |
| 117 | chatWin->setText(""); |
| 118 | CEGUI::Window* chatEdit = tmpWin->getChild("GameChatEditBox"); |
| 119 | chatEdit->setText(""); |
| 120 | |
| 121 | const std::vector<std::string>& factions = ConfigManager::getSingleton().getFactions(); |
| 122 | const CEGUI::Image* selImg = &CEGUI::ImageManager::getSingleton().get("OpenDungeonsSkin/SelectionBrush"); |
| 123 | const std::vector<Seat*>& seats = gameMap->getSeats(); |
| 124 | |
| 125 | int offset = 0; |
| 126 | bool enabled = false; |
| 127 | |
| 128 | for(Seat* seat : seats) |
| 129 | { |
| 130 | // We do not add the rogue creatures seat |
| 131 | if(seat->isRogueSeat()) |
| 132 | continue; |
| 133 | |
| 134 | mSeatIds.push_back(seat->getId()); |
| 135 | std::string name; |
| 136 | CEGUI::Combobox* combo; |
| 137 | |
| 138 | name = TEXT_SEAT_ID_PREFIX + Helper::toString(seat->getId()); |
| 139 | CEGUI::DefaultWindow* textSeatId = static_cast<CEGUI::DefaultWindow*>(winMgr.createWindow("OD/StaticText", name)); |
| 140 | tmpWin->addChild(textSeatId); |
| 141 | Ogre::ColourValue seatColor = seat->getColorValue(); |
| 142 | seatColor.a = 1.0f; // Restore the color opacity |
| 143 | textSeatId->setArea(CEGUI::UDim(0.3,10), CEGUI::UDim(0,65 + offset), CEGUI::UDim(0,60), CEGUI::UDim(0,30)); |
| 144 | textSeatId->setText("[colour='" + Helper::getCEGUIColorFromOgreColourValue(seatColor) + "']Seat " + Helper::toString(seat->getId())); |
| 145 | textSeatId->setProperty("FrameEnabled", "False"); |
| 146 | textSeatId->setProperty("BackgroundEnabled", "False"); |
| 147 | |
| 148 | name = COMBOBOX_PLAYER_FACTION_PREFIX + Helper::toString(seat->getId()); |
| 149 | combo = static_cast<CEGUI::Combobox*>(winMgr.createWindow("OD/Combobox", name)); |
| 150 | tmpWin->addChild(combo); |
nothing calls this directly
no test coverage detected