Changeset 8331 in orxonox.OLD for branches/network
- Timestamp:
- Jun 12, 2006, 10:49:23 PM (19 years ago)
- Location:
- branches/network/src/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/util/game_rules.h
r7488 r8331 20 20 21 21 22 class GameRules : public BaseObject22 class GameRules : virtual public BaseObject 23 23 { 24 24 -
branches/network/src/util/multiplayer_team_deathmatch.cc
r8147 r8331 65 65 this->currentGameState = GAMESTATE_PRE_GAME; 66 66 this->gameStateTimer = 10.0f; 67 this->bShowTeamChange = false; 67 68 68 69 this->box = NULL; … … 77 78 if( root != NULL) 78 79 this->loadParams(root); 80 81 subscribeEvent( ES_GAME, SDLK_o ); 79 82 } 80 83 … … 86 89 if( this->deathScreen) 87 90 delete this->deathScreen; 91 92 unsubscribeEvent( ES_GAME, SDLK_o ); 88 93 } 89 94 … … 150 155 return; 151 156 152 if ( currentGameState == GAMESTATE_PRE_GAME )157 if ( currentGameState == GAMESTATE_PRE_GAME || currentGameState == GAMESTATE_GAME ) 153 158 { 154 159 if ( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) 155 && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM156 160 && box == NULL 161 && (PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM 162 || bShowTeamChange ) 163 157 164 ) 158 165 { … … 180 187 buttonTeam1->connect(SIGNAL(buttonTeam1, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonTeam1)); 181 188 189 if ( bShowTeamChange ) 190 { 191 OrxGui::GLGuiPushButton * buttonCancel = new OrxGui::GLGuiPushButton("Cancel"); 192 box->pack( buttonCancel ); 193 buttonCancel->connect(SIGNAL(buttonCancel, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonCancel)); 194 } 195 182 196 OrxGui::GLGuiPushButton * buttonExit = new OrxGui::GLGuiPushButton("Exit"); 183 197 box->pack( buttonExit ); … … 191 205 && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) 192 206 && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM 207 && !bShowTeamChange 193 208 ) 194 209 { … … 479 494 { 480 495 State::getCurrentStoryEntity()->stop(); 496 this->bShowTeamChange = false; 481 497 } 482 498 … … 484 500 { 485 501 NetworkGameManager::getInstance()->prefereTeam( TEAM_RANDOM ); 502 this->bShowTeamChange = false; 486 503 } 487 504 … … 489 506 { 490 507 NetworkGameManager::getInstance()->prefereTeam( 0 ); 508 this->bShowTeamChange = false; 491 509 } 492 510 … … 494 512 { 495 513 NetworkGameManager::getInstance()->prefereTeam( 1 ); 514 this->bShowTeamChange = false; 496 515 } 497 516 … … 499 518 { 500 519 NetworkGameManager::getInstance()->prefereTeam( TEAM_SPECTATOR ); 520 this->bShowTeamChange = false; 501 521 } 502 522 … … 507 527 } 508 528 509 510 511 512 513 529 /** 530 * function that processes events from the handler 531 * @param event: the event 532 * @todo replace SDLK_o with something from KeyMapper 533 */ 534 void MultiplayerTeamDeathmatch::process( const Event & event ) 535 { 536 if ( event.type == SDLK_o ) 537 { 538 if ( event.bPressed ) 539 this->bShowTeamChange = true; 540 } 541 } 542 543 void MultiplayerTeamDeathmatch::onButtonCancel( ) 544 { 545 this->bShowTeamChange = false; 546 } 547 548 549 550 551 552 -
branches/network/src/util/multiplayer_team_deathmatch.h
r8147 r8331 27 27 28 28 29 class MultiplayerTeamDeathmatch : public NetworkGameRules 29 class MultiplayerTeamDeathmatch : public NetworkGameRules, public EventListener 30 30 { 31 31 … … 55 55 56 56 int getRandomTeam(); 57 58 virtual void process(const Event &event); 57 59 58 60 protected: … … 74 76 float gameStateTimer; //!< if less than 0 -> change game state 75 77 78 bool bShowTeamChange; //!< if true -> show team change dialog 79 76 80 OrxGui::GLGuiBox* box; 77 81 … … 87 91 void onButtonTeam0(); 88 92 void onButtonTeam1(); 93 void onButtonCancel(); 89 94 void onButtonExit(); 90 95 };
Note: See TracChangeset
for help on using the changeset viewer.