Changeset 7876 for code/trunk
- Timestamp:
- Feb 13, 2011, 5:49:41 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/gui/scripts/HostMenu.lua
r7689 r7876 104 104 local level = P.levelList[index+1] 105 105 if level ~= nil then 106 orxonox.LevelManager:getInstance():setDefaultLevel(level:getXMLFilename()) 107 orxonox.execute(P.multiplayerMode) 106 orxonox.execute(P.multiplayerMode .. " " .. level:getXMLFilename()) 108 107 hideAllMenuSheets() 109 108 end -
code/trunk/data/gui/scripts/MultiplayerMenu.lua
r7801 r7876 75 75 76 76 function P.MultiplayerJoinButton_clicked(e) 77 local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem() 77 local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem() 78 local destination = nil 78 79 if choice then 79 local client = orxonox.Client:getInstance()80 80 local index = tolua.cast(choice, "CEGUI::ListboxItem"):getID() 81 client:setDestination( P.serverList[index][2], 55556 )81 destination = P.serverList[index][2] 82 82 else 83 83 return 84 84 end 85 orxonox.execute("startClient ")85 orxonox.execute("startClient " .. destination) 86 86 hideAllMenuSheets() 87 87 end -
code/trunk/data/gui/scripts/SingleplayerMenu.lua
r7689 r7876 74 74 local level = P.levelList[index+1] 75 75 if level ~= nil then 76 orxonox.LevelManager:getInstance():setDefaultLevel(level:getXMLFilename()) 77 orxonox.execute("startGame") 76 orxonox.execute("startGame " .. level:getXMLFilename()) 78 77 hideAllMenuSheets() 79 78 end -
code/trunk/src/libraries/core/GUIManager.cc
r7874 r7876 62 62 #include "Core.h" 63 63 #include "CoreIncludes.h" 64 #include "Game.h" 64 65 #include "GraphicsManager.h" 65 66 #include "LuaState.h" … … 522 523 this->mouseLeft(); 523 524 } 525 524 526 } -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r7870 r7876 51 51 DeclareGameState(GSLevel, "level", false, false); 52 52 53 static const std::string __CC_startMainMenu_name = "startMainMenu"; 54 static const std::string __CC_changeGame_name = "changeGame"; 55 56 SetConsoleCommand(__CC_startMainMenu_name, &GSLevel::startMainMenu).deactivate(); 57 SetConsoleCommand(__CC_changeGame_name, &GSLevel::changeGame).defaultValues(BLANKSTRING).deactivate(); 58 53 59 GSLevel::GSLevel(const GameStateInfo& info) 54 60 : GameState(info) … … 94 100 // connect the HumanPlayer to the game 95 101 PlayerManager::getInstance().clientConnected(0); 96 } 102 103 ModifyConsoleCommand(__CC_startMainMenu_name).activate(); 104 } 105 106 if (GameMode::isStandalone()) 107 ModifyConsoleCommand(__CC_changeGame_name).activate(); 97 108 } 98 109 … … 121 132 InputManager::getInstance().destroyState("guiKeysOnly"); 122 133 InputManager::getInstance().destroyState("guiMouseOnly"); 123 } 134 135 ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate(); 136 } 137 138 if (GameMode::isStandalone()) 139 ModifyConsoleCommand(__CC_changeGame_name).deactivate(); 124 140 } 125 141 … … 166 182 COUT(3) << " Try harder!" << std::endl; 167 183 } 184 185 /** 186 @brief 187 Starts the MainMenu. 188 */ 189 /*static*/ void GSLevel::startMainMenu(void) 190 { 191 // HACK 192 Game::getInstance().popState(); 193 Game::getInstance().popState(); 194 } 195 196 /** 197 @brief 198 Terminates the current game and starts a new game. 199 @param level 200 The filename of the level to be started. 201 */ 202 /*static*/ void GSLevel::changeGame(const std::string& level) 203 { 204 if(level != BLANKSTRING) 205 LevelManager::getInstance().setDefaultLevel(level); 206 207 // HACK 208 Game::getInstance().popState(); 209 Game::getInstance().popState(); 210 Game::getInstance().requestStates("standalone, level"); 211 } 168 212 } -
code/trunk/src/orxonox/gamestates/GSLevel.h
r6417 r7876 49 49 void update(const Clock& time); 50 50 51 static void startMainMenu(void); //!< Starts the MainMenu 52 static void changeGame(const std::string& level); //!< Terminates the current game and starts a new game. 53 51 54 protected: 52 55 void loadLevel(); -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r7854 r7876 31 31 #include <OgreSceneManager.h> 32 32 33 #include "core/input/KeyBinderManager.h"34 #include "core/Game.h"35 33 #include "core/ConfigValueIncludes.h" 36 34 #include "core/CoreIncludes.h" 35 #include "core/Game.h" 37 36 #include "core/GraphicsManager.h" 38 37 #include "core/GUIManager.h" 39 38 #include "core/command/ConsoleCommand.h" 39 #include "core/input/KeyBinderManager.h" 40 #include "network/Client.h" 41 #include "util/StringUtils.h" 42 #include "LevelManager.h" 40 43 #include "Scene.h" 41 44 #include "sound/AmbientSound.h" … … 52 55 static const std::string __CC_startClient_name = "startClient"; 53 56 static const std::string __CC_startDedicated_name = "startDedicated"; 54 static const std::string __CC_startMainMenu_name = "startMainMenu";55 57 static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath"; 56 58 57 SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).deactivate(); 58 SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).deactivate(); 59 SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).deactivate(); 60 SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).deactivate(); 61 SetConsoleCommand(__CC_startMainMenu_name, &GSMainMenu::startMainMenu ).deactivate(); 59 SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).defaultValues(BLANKSTRING).deactivate(); 60 SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).defaultValues(BLANKSTRING).deactivate(); 61 SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).defaultValues(BLANKSTRING).deactivate(); 62 SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).defaultValues(BLANKSTRING).deactivate(); 62 63 SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath).hide(); 63 64 … … 106 107 ModifyConsoleCommand(__CC_startClient_name ).activate(); 107 108 ModifyConsoleCommand(__CC_startDedicated_name ).activate(); 108 ModifyConsoleCommand(__CC_startMainMenu_name ).activate();109 109 ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(this); 110 110 … … 138 138 ModifyConsoleCommand(__CC_startClient_name ).deactivate(); 139 139 ModifyConsoleCommand(__CC_startDedicated_name ).deactivate(); 140 ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate();141 140 ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(0); 142 141 } … … 171 170 } 172 171 173 void GSMainMenu::startStandalone() 174 { 175 // HACK - HACK 172 /** 173 @brief 174 Start a level in standalone mode. 175 @param level 176 The filename of the level to be started. If empty, the default level is started. 177 */ 178 void GSMainMenu::startStandalone(const std::string& level) 179 { 180 if(level != BLANKSTRING) 181 LevelManager::getInstance().setDefaultLevel(level); 182 183 // HACK 176 184 Game::getInstance().popState(); 177 185 Game::getInstance().requestStates("standalone, level"); 178 186 } 179 187 180 void GSMainMenu::startServer() 181 { 182 // HACK - HACK 188 /** 189 @brief 190 Start a level in server mode. 191 @param level 192 The filename of the level to be started. If empty, the default level is started. 193 */ 194 void GSMainMenu::startServer(const std::string& level) 195 { 196 if(level != BLANKSTRING) 197 LevelManager::getInstance().setDefaultLevel(level); 198 199 // HACK 183 200 Game::getInstance().popState(); 184 201 Game::getInstance().requestStates("server, level"); 185 202 } 186 203 187 void GSMainMenu::startClient() 188 { 189 // HACK - HACK 204 /** 205 @brief 206 Connect to a game as client. 207 @param destination 208 The destination to connect to. If empty, the client connects to the default destination. 209 */ 210 void GSMainMenu::startClient(const std::string& destination) 211 { 212 if(destination != BLANKSTRING) 213 Client::getInstance()->setDestination(destination, NETWORK_PORT); 214 215 // HACK 190 216 Game::getInstance().popState(); 191 217 Game::getInstance().requestStates("client, level"); 192 218 } 193 219 194 void GSMainMenu::startDedicated() 195 { 196 // HACK - HACK 220 /** 221 @brief 222 Start a level in dedicated mode. 223 @param level 224 The filename of the level to be started. If empty, the default level is started. 225 */ 226 void GSMainMenu::startDedicated(const std::string& level) 227 { 228 if(level != BLANKSTRING) 229 LevelManager::getInstance().setDefaultLevel(level); 230 231 // HACK 197 232 Game::getInstance().popState(); 198 233 Game::getInstance().popState(); 199 234 Game::getInstance().requestStates("server, level"); 200 235 } 201 void GSMainMenu::startMainMenu() 202 { 203 // HACK - HACK 204 Game::getInstance().popState(); 205 Game::getInstance().popState(); 206 Game::getInstance().requestStates("mainmenu"); 207 } 236 208 237 } -
code/trunk/src/orxonox/gamestates/GSMainMenu.h
r6746 r7876 53 53 void setMainMenuSoundPath(const std::string& path); 54 54 55 static void startStandalone(); 56 static void startServer(); 57 static void startClient(); 58 static void startDedicated(); 59 static void startMainMenu(); 55 static void startStandalone(const std::string& level = BLANKSTRING); //!< Start a level in standalone mode. 56 static void startServer(const std::string& level = BLANKSTRING); //!< Start a level in server mode. 57 static void startClient(const std::string& destination = BLANKSTRING); //!< Connect to a game as client. 58 static void startDedicated(const std::string& level = BLANKSTRING); //!< Start a level in dedicated mode. 60 59 static void startIOConsole(); 61 60
Note: See TracChangeset
for help on using the changeset viewer.