fix other paging sizes

This commit is contained in:
Beu
2023-09-08 16:00:30 +02:00
parent 478e842230
commit 8b3e624d1c
6 changed files with 46 additions and 20 deletions

View File

@ -37,7 +37,6 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage
*/
const ACTION_OPEN_ADMIN_LIST = 'AdminList.OpenAdminList';
const ACTION_REVOKE_RIGHTS = 'AdminList.RevokeRights';
const MAX_PLAYERS_PER_PAGE = 15;
/*
* Private Properties
@ -129,9 +128,10 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage
$index = 1;
$posY -= 10;
$pageFrame = null;
$pageMaxCount = $this->getPlayersPerPage();
foreach ($admins as $admin) {
if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
if ($index % $pageMaxCount === 1) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
@ -236,6 +236,16 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage
}
}
/**
* Get number of players per page
*
* @return int
*/
public function getPlayersPerPage() {
$pageheight = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
return floor($pageheight * 0.82 / 4);
}
/**
* Reopen the widget on Map Begin, MapListChanged, etc.
*