protected function updateItemList() { $this->pager->clearItems(); // $this->pager->clearComponents(); if ($this->orderList) { uasort($this->playerList, function ($p1, $p2) { if ($p1['state'] == $p2['state']) { if ($p1['ladderPoints'] == $p2['ladderPoints']) { return 0; } return $p1['ladderPoints'] > $p2['ladderPoints'] ? -1 : 1; } return $p1['state'] > $p2['state'] ? -1 : 1; }); } $count = 0; reset($this->playerList); while (current($this->playerList) && $count++ < 52) { $player = current($this->playerList); $component = new Player($player['nickname']); $component->state = $player['state']; $component->ladderPoints = $player['ladderPoints']; $component->zoneFlagURL = $flagURL = sprintf('file://ZoneFlags/Login/%s/country', $player['login']); $component->login = $player['login']; $component->setAction($player['action']); $component->setId($count); if ($player['isAlly'] && $player['isBilateral']) { $component->setBackgroundColor('07C8', '09F8'); } elseif ($player['isAlly'] && !$player['isBilateral']) { $component->setBackgroundColor('9998', 'EEE8'); } elseif ($player['action']) { $component->setBackgroundColor('3338', 'CCC8'); } else { $component->setBackgroundColor(); } $this->pager->addItem($component); next($this->playerList); } }
function onDraw() { parent::onDraw(); $this->echelonFrame->setPosition($this->sizeX - 2, 0.5); }