Пример #1
0
 function onPlayerReady($login)
 {
     $mtime = microtime(true);
     if (!$this->matchMakingService->isInMatch($login, $this->storage->serverLogin, $this->scriptName, $this->titleIdString)) {
         try {
             $tokenInfos = $this->connection->getDemoTokenInfosForPlayer($login);
         } catch (\Exception $e) {
             //Player is disconnected ?
             return;
         }
         if ($tokenInfos->TokenCost > 0) {
             $this->gui->removeWaitingScreen($login);
             $this->resetShortKey($login);
             if ($tokenInfos->CanPayToken) {
                 $this->onAnswerYesToDialog($login);
             } else {
                 $this->gui->showDemoPlayDialog($login, array($this, 'onClickOnSplashBackground'), array($this, 'onCloseSplash'));
             }
         } elseif ($tokenInfos->TokenCost == 0) {
             $this->setPlayerReady($login);
         }
     } else {
         \ManiaLive\Utilities\Logger::debug(sprintf('Player try to be ready while in match: %s', $login));
     }
     $time = microtime(true) - $mtime;
     if ($time > 0.05) {
         \ManiaLive\Utilities\Logger::debug(sprintf('onPlayerReady:%f', $time));
     }
 }