function showMatchSumUp(Match $match, $receiver, $time)
 {
     $storage = Storage::getInstance();
     $getPlayerInfosCallback = function ($login) use($storage) {
         $p = $storage->getPlayerObject($login);
         $pathArray = explode('|', $p->ladderStats['PlayerRankings'][0]['Path']);
         $path = implode('|', array_slice($pathArray, 0, 3));
         return (object) array('login' => $login, 'nickname' => $p ? $p->nickName : $login, 'zone' => $p ? array_pop($pathArray) : 'World', 'rank' => $p ? $p->ladderStats['PlayerRankings'][0]['Ranking'] : -1, 'zoneFlag' => sprintf('file://ZoneFlags/Login/%s/country', $login), 'ladderPoints' => $p->ladderStats['PlayerRankings'][0]['Score'], 'echelon' => \ManiaLivePlugins\MatchMakingLobby\Services\PlayerInfo::ComputeEchelon($p->ladderStats['PlayerRankings'][0]['Score']));
     };
     $sortPlayerCallback = function ($player1, $player2) {
         if ($player1->ladderPoints == $player2->ladderPoints) {
             return 0;
         }
         return $player1->ladderPoints < $player2->ladderPoints ? 1 : -1;
     };
     $players = array_map($getPlayerInfosCallback, $match->players);
     usort($players, $sortPlayerCallback);
     $window = \ManiaLivePlugins\MatchMakingLobby\Windows\StartSoloMatch::Create($receiver);
     $window->set($players, $time);
     $window->show();
 }
 protected function addPlayerToParty(\Maniaplanet\DedicatedServer\Structures\Player $player, $disable = false)
 {
     $path = explode('|', $player->path);
     if (array_key_exists(1, $path)) {
         $zone = $path[1];
         $this->playerList[$player->login] = array();
         $this->playerList[$player->login]['nickname'] = $player->nickName ?: $player->login;
         $this->playerList[$player->login]['zone'] = $zone;
         $this->playerList[$player->login]['avatarUrl'] = 'file://Avatars/' . $player->login . '/Default';
         $this->playerList[$player->login]['rank'] = $player->ladderStats['PlayerRankings'][0]['Ranking'];
         $this->playerList[$player->login]['echelon'] = PlayerInfo::ComputeEchelon($player->ladderStats['PlayerRankings'][0]['Score']);
         $this->playerList[$player->login]['countryFlagUrl'] = sprintf('file://ZoneFlags/Login/%s/country', $player->login);
         $this->playerList[$player->login]['disable'] = $disable;
     }
 }
Example #3
0
 function onDraw()
 {
     switch ($this->state) {
         case static::STATE_READY:
             $subStyle = '0F0D';
             break;
         case static::STATE_IN_MATCH:
             $subStyle = 'FF0D';
             break;
         case static::STATE_BLOCKED:
             $subStyle = '000D';
             break;
         case static::STATE_NOT_READY:
             $subStyle = 'F00D';
             break;
         default:
             $subStyle = '';
     }
     $this->icon->setSize(1, $this->sizeY);
     $this->icon->setPosition(0, -$this->sizeY / 2);
     $this->label->setPosition(8, -$this->sizeY / 2);
     $this->echelonFrame->setPosition($this->sizeX - 1, 0.5);
     $this->countryFlag->setPosition(2, -$this->sizeY / 2);
     $this->bg->setSize($this->sizeX, $this->sizeY);
     $this->hiddenLabel->setText($this->login);
     $echelon = PlayerInfo::ComputeEchelon($this->ladderPoints);
     $this->icon->setBgcolor($subStyle);
     $this->countryFlag->setImage($this->zoneFlagURL, true);
     $this->echelonLabel->setText($echelon);
     $this->echelonQuad->setImage(sprintf('file://Media/Manialinks/Common/Echelons/echelon%d.dds', $echelon), true);
 }