Пример #1
0
 function onModeScriptCallback($param1, $param2)
 {
     switch ($param1) {
         case 'Master':
             $login = $param2[0];
             $player = $this->storage->getPlayerObject($login);
             if ($player !== null) {
                 $service = new Services\MatchMakingService();
                 $service->addMaster($login, $player->nickName, $player->ladderStats['PlayerRankings'][0]['Score'], $this->lobby->login, $this->scriptName, $this->titleIdString);
             }
             break;
         case 'MatchmakingGetOrder':
             if ($this->match) {
                 $allyService = Services\AllyService::getInstance($this->lobby->login, $this->scriptName, $this->titleIdString);
                 $alliesList = array();
                 foreach ($this->match->players as $login) {
                     $alliesList = array_merge($alliesList, $allyService->get($login));
                 }
                 $alliesList = array_unique($alliesList);
                 $this->connection->triggerModeScriptEvent('MatchmakingSetTempAllies', implode(',', $alliesList));
             }
             break;
         case 'LibXmlRpc_Scores':
             if ($this->matchId) {
                 $this->scores['match'][0] = $param2[0];
                 $this->scores['match'][1] = $param2[1];
                 $this->scores['map'][0] = $param2[2];
                 $this->scores['map'][1] = $param2[3];
                 $this->matchMakingService->updateMatchScores($this->matchId, $this->scores['match'][0], $this->scores['match'][1], $this->scores['map'][0], $this->scores['map'][1]);
             }
             break;
         case 'LibXmlRpc_EndRound':
             $this->connection->triggerModeScriptEvent('LibXmlRpc_GetScores', '');
             break;
         case 'LibXmlRpc_EndTurn':
             $this->connection->triggerModeScriptEvent('LibXmlRpc_GetScores', '');
             break;
         case 'LibXmlRpc_EndMap':
             $this->connection->triggerModeScriptEvent('LibXmlRpc_GetScores', '');
             break;
         case 'LibXmlRpc_EndMatch':
             $this->connection->triggerModeScriptEvent('LibXmlRpc_GetScores', '');
             break;
     }
 }