Пример #1
0
 protected function runMatchMaker()
 {
     //Check if a server is available
     if ($this->matchMakingService->countAvailableServer($this->storage->serverLogin, $this->scriptName, $this->titleIdString) > 0) {
         $players = $this->getMatchablePlayers();
         shuffle($players);
         $matches = $this->matchMaker->run($players);
         foreach ($matches as $match) {
             /** @var Match $match */
             $server = $this->matchMakingService->getAvailableServer($this->storage->serverLogin, $this->scriptName, $this->titleIdString);
             if ($server) {
                 //Match ready, let's prepare it !
                 $this->prepareMatch($server, $match);
             } else {
                 //FIXME: we shouldn't be in this case.. remove ?
                 foreach ($match->players as $login) {
                     $this->gui->createLabel($this->gui->getNoServerAvailableText(), $login);
                 }
             }
         }
         unset($matches, $match);
     } else {
         $this->setReadyLabel();
     }
 }