fixed playerlist paging
This commit is contained in:
parent
a8b50378d9
commit
02ad48951b
@ -140,10 +140,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
|
|
||||||
// get PlayerList
|
// get PlayerList
|
||||||
$players = $this->maniaControl->playerManager->getPlayers();
|
$players = $this->maniaControl->playerManager->getPlayers();
|
||||||
$pagesId = '';
|
|
||||||
if (count($players) > self::MAX_PLAYERS_PER_PAGE) {
|
|
||||||
$pagesId = 'PlayerListPages';
|
|
||||||
}
|
|
||||||
|
|
||||||
//create manialink
|
//create manialink
|
||||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
@ -152,7 +148,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$script->addFeature($paging);
|
$script->addFeature($paging);
|
||||||
|
|
||||||
// Main frame
|
// Main frame
|
||||||
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
|
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
@ -174,20 +170,19 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
}
|
}
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$y = $height / 2 - 10;
|
$y = $height / 2 - 10;
|
||||||
$pageFrames = array();
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($players as $listPlayer) {
|
foreach ($players as $listPlayer) {
|
||||||
/** @var Player $listPlayer * */
|
/** @var Player $listPlayer * */
|
||||||
if (!isset($pageFrame)) {
|
|
||||||
|
if ($i % self::MAX_PLAYERS_PER_PAGE === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
if (!empty($pageFrames)) {
|
|
||||||
$pageFrame->setVisible(false);
|
|
||||||
}
|
|
||||||
array_push($pageFrames, $pageFrame);
|
|
||||||
$y = $height / 2 - 10;
|
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
|
$y = $height / 2 - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $listPlayer->getProvince();
|
$path = $listPlayer->getProvince();
|
||||||
@ -413,9 +408,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
|
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
$i++;
|
$i++;
|
||||||
if ($i % self::MAX_PLAYERS_PER_PAGE == 0) {
|
|
||||||
unset($pageFrame);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show advanced window
|
// Show advanced window
|
||||||
|
Loading…
Reference in New Issue
Block a user