MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / activate

Method activate

source/modes/MenuModeConfigureSeats.cpp:93–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void 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);

Callers

nothing calls this directly

Calls 12

loadGuiSheetMethod · 0.80
getClientGameMapMethod · 0.80
setGamePausedMethod · 0.80
getGuiSheetMethod · 0.80
setTextMethod · 0.80
setVisibleMethod · 0.80
isRogueSeatMethod · 0.80
toStringFunction · 0.50
playMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected