コード例 #1
0
 protected function updateItemList()
 {
     //$this->pager->clearItems();
     $this->frame->destroyComponents();
     if ($this->orderList) {
         uasort(static::$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(static::$playerList);
     while (current(static::$playerList) && $count++ < 18) {
         $player = current(static::$playerList);
         if ($this->smallCards) {
             $component = new PlayerSmall($player['nickname']);
         } else {
             $component = new Player($player['nickname']);
         }
         $component->state = $player['state'];
         $component->ladderPoints = $player['ladderPoints'];
         $component->zoneFlagURL = $flagURL = sprintf('file://ZoneFlags/Login/%s/country', $player['login']);
         //$this->pager->addItem($component);
         $this->frame->addComponent($component);
         next(static::$playerList);
     }
 }