예제 #1
0
 function onPlayerConnect($login, $isSpectator)
 {
     \ManiaLive\Utilities\Logger::debug(sprintf('Player connected: %s', $login));
     $player = Services\PlayerInfo::Get($login);
     $player->setAway(false);
     $playerObject = $this->storage->getPlayerObject($login);
     if ($playerObject) {
         $player->ladderPoints = $playerObject->ladderStats['PlayerRankings'][0]['Score'];
         $player->allies = $this->allyService->get($login);
     }
     $match = $this->matchMakingService->getPlayerCurrentMatch($login, $this->storage->serverLogin, $this->scriptName, $this->titleIdString);
     if ($match) {
         \ManiaLive\Utilities\Logger::debug(sprintf('send %s to is match %d', $login, $match->id));
         $player->isInMatch = true;
         $this->sendToServer($login, $match->matchServerLogin);
         $this->gui->updateWaitingScreenLabel($this->gui->getMatchInProgressText(), $login);
         return;
     } else {
         $player->isInMatch = false;
     }
     if (!$playerObject) {
         return;
     }
     $this->gui->createPlayerList($login);
     $this->gui->showWaitingScreen($login);
     $this->updatePlayerList = true;
     $this->updateKarma($login);
     $this->checkAllies($player);
     $this->allyService->setPlayerPresent($login);
     try {
         $this->connection->removeGuest($login);
     } catch (\Maniaplanet\DedicatedServer\Xmlrpc\Exception $e) {
     }
 }