fix other paging sizes
This commit is contained in:
parent
478e842230
commit
8b3e624d1c
@ -37,7 +37,6 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage
|
|||||||
*/
|
*/
|
||||||
const ACTION_OPEN_ADMIN_LIST = 'AdminList.OpenAdminList';
|
const ACTION_OPEN_ADMIN_LIST = 'AdminList.OpenAdminList';
|
||||||
const ACTION_REVOKE_RIGHTS = 'AdminList.RevokeRights';
|
const ACTION_REVOKE_RIGHTS = 'AdminList.RevokeRights';
|
||||||
const MAX_PLAYERS_PER_PAGE = 15;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private Properties
|
* Private Properties
|
||||||
@ -129,9 +128,10 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage
|
|||||||
$index = 1;
|
$index = 1;
|
||||||
$posY -= 10;
|
$posY -= 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
$pageMaxCount = $this->getPlayersPerPage();
|
||||||
|
|
||||||
foreach ($admins as $admin) {
|
foreach ($admins as $admin) {
|
||||||
if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
|
if ($index % $pageMaxCount === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->addChild($pageFrame);
|
$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.
|
* Reopen the widget on Map Begin, MapListChanged, etc.
|
||||||
*
|
*
|
||||||
|
@ -238,9 +238,10 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
$index = 1;
|
$index = 1;
|
||||||
$posY -= 10;
|
$posY -= 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
$pageMaxCount = floor($height * 0.80 / 4);
|
||||||
|
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
if ($index % 15 === 1) {
|
if ($index % $pageMaxCount === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->addChild($pageFrame);
|
$frame->addChild($pageFrame);
|
||||||
$posY = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
|
@ -336,6 +336,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
|
|||||||
$pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
$settingHeight = 5.;
|
$settingHeight = 5.;
|
||||||
$labelTextSize = 2;
|
$labelTextSize = 2;
|
||||||
|
$pageMaxCount = floor(($height * 0.85) / $settingHeight);
|
||||||
|
|
||||||
// Pagers
|
// Pagers
|
||||||
$pagerPrev = new Quad_Icons64x64_1();
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
@ -399,7 +400,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($index % 13 === 0) {
|
if ($index % $pageMaxCount === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->addChild($pageFrame);
|
$frame->addChild($pageFrame);
|
||||||
$posY = 0.41 * $height;
|
$posY = 0.41 * $height;
|
||||||
@ -418,6 +419,9 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
|
|||||||
$nameLabel->setText($settingName);
|
$nameLabel->setText($settingName);
|
||||||
$nameLabel->setTextSize($labelTextSize);
|
$nameLabel->setTextSize($labelTextSize);
|
||||||
$nameLabel->setX(-0.46 * $width);
|
$nameLabel->setX(-0.46 * $width);
|
||||||
|
if ($scriptParam->desc === self::DESCRIPTION_HIDDEN) {
|
||||||
|
$nameLabel->setTextColor("AAAAAA");
|
||||||
|
}
|
||||||
|
|
||||||
if (!$isScriptMode) {
|
if (!$isScriptMode) {
|
||||||
if (is_bool($settingValue[0])) {
|
if (is_bool($settingValue[0])) {
|
||||||
|
@ -243,7 +243,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
self::ACTION_PREFIX_SETTINGLINKS . $settingClass
|
self::ACTION_PREFIX_SETTINGLINKS . $settingClass
|
||||||
);
|
);
|
||||||
$frame->addChild($mapNameButton);
|
$frame->addChild($mapNameButton);
|
||||||
$mapNameButton->setPosition(-$width / 2 + 60, -35);
|
$mapNameButton->setPosition(-$width / 2 + 60, $height * -0.45);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $frame;
|
return $frame;
|
||||||
|
@ -107,7 +107,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
// Config
|
// Config
|
||||||
$pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
$entryHeight = 5.;
|
$entryHeight = 5.;
|
||||||
$pageMaxCount = floor(($height * 0.85) / $entryHeight);
|
$pageMaxCount = floor(($height * 0.70) / $entryHeight);
|
||||||
|
|
||||||
// Pagers
|
// Pagers
|
||||||
$pagerPrev = new Quad_Icons64x64_1();
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
@ -198,8 +198,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
|
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$pageFrame->addChild($descriptionLabel);
|
$pageFrame->addChild($descriptionLabel);
|
||||||
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
|
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::BOTTOM);
|
||||||
$descriptionLabel->setPosition($width * -0.45, $height * -0.22);
|
$descriptionLabel->setPosition($width * -0.45, $height * -0.45);
|
||||||
$descriptionLabel->setSize($width * 0.7, $entryHeight);
|
$descriptionLabel->setSize($width * 0.7, $entryHeight);
|
||||||
$descriptionLabel->setTextSize(2);
|
$descriptionLabel->setTextSize(2);
|
||||||
$descriptionLabel->setTranslate(true);
|
$descriptionLabel->setTranslate(true);
|
||||||
@ -236,7 +236,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$quadUpdate = new Quad_Icons128x128_1();
|
$quadUpdate = new Quad_Icons128x128_1();
|
||||||
$pluginFrame->addChild($quadUpdate);
|
$pluginFrame->addChild($quadUpdate);
|
||||||
$quadUpdate->setSubStyle($quadUpdate::SUBSTYLE_ProfileVehicle);
|
$quadUpdate->setSubStyle($quadUpdate::SUBSTYLE_ProfileVehicle);
|
||||||
$quadUpdate->setX(56);
|
$quadUpdate->setX($width / 2 - 3);
|
||||||
$quadUpdate->setZ(2);
|
$quadUpdate->setZ(2);
|
||||||
$quadUpdate->setSize(5, 5);
|
$quadUpdate->setSize(5, 5);
|
||||||
$quadUpdate->setAction(self::ACTION_PREFIX_UPDATEPLUGIN . $pluginClass);
|
$quadUpdate->setAction(self::ACTION_PREFIX_UPDATEPLUGIN . $pluginClass);
|
||||||
@ -249,7 +249,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$updatePluginsButton = new Label_Button();
|
$updatePluginsButton = new Label_Button();
|
||||||
$frame->addChild($updatePluginsButton);
|
$frame->addChild($updatePluginsButton);
|
||||||
$updatePluginsButton->setHorizontalAlign($updatePluginsButton::RIGHT);
|
$updatePluginsButton->setHorizontalAlign($updatePluginsButton::RIGHT);
|
||||||
$updatePluginsButton->setPosition($width * 0.5, -29, 2);
|
$updatePluginsButton->setPosition($width * 0.5, $height * -0.37, 2);
|
||||||
$updatePluginsButton->setWidth(10);
|
$updatePluginsButton->setWidth(10);
|
||||||
$updatePluginsButton->setStyle($updatePluginsButton::STYLE_CardButtonSmallS);
|
$updatePluginsButton->setStyle($updatePluginsButton::STYLE_CardButtonSmallS);
|
||||||
$updatePluginsButton->setText(count($pluginUpdates) . ' update(s)');
|
$updatePluginsButton->setText(count($pluginUpdates) . ' update(s)');
|
||||||
@ -278,7 +278,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$posY = 0;
|
$posY = 0;
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$settingHeight = 5.;
|
$settingHeight = 5.;
|
||||||
$pageSettingsMaxCount = floor(($height * 0.78) / $settingHeight);
|
$pageSettingsMaxCount = floor(($height * 0.70) / $settingHeight);
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
//Headline Label
|
//Headline Label
|
||||||
@ -322,7 +322,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$descriptionLabel = new Label_Text();
|
$descriptionLabel = new Label_Text();
|
||||||
$pageFrame->addChild($descriptionLabel);
|
$pageFrame->addChild($descriptionLabel);
|
||||||
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
|
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
|
||||||
$descriptionLabel->setPosition(-0.45 * $width, -0.35 * $height);
|
$descriptionLabel->setPosition(-0.45 * $width, $height * -0.38);
|
||||||
$descriptionLabel->setSize(0.9 * $width, $settingHeight);
|
$descriptionLabel->setSize(0.9 * $width, $settingHeight);
|
||||||
$descriptionLabel->setTextSize(2);
|
$descriptionLabel->setTextSize(2);
|
||||||
$descriptionLabel->setTranslate(true);
|
$descriptionLabel->setTranslate(true);
|
||||||
@ -390,7 +390,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
self::ACTION_PREFIX_MANAGE_SETTING_LINK . $settingClass
|
self::ACTION_PREFIX_MANAGE_SETTING_LINK . $settingClass
|
||||||
);
|
);
|
||||||
$frame->addChild($mapNameButton);
|
$frame->addChild($mapNameButton);
|
||||||
$mapNameButton->setPosition(-$width / 2 + 60, -35);
|
$mapNameButton->setPosition(-$width / 2 + 60, $height * -0.45);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $frame;
|
return $frame;
|
||||||
@ -457,7 +457,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$descriptionLabel = new Label_Text();
|
$descriptionLabel = new Label_Text();
|
||||||
$pageFrame->addChild($descriptionLabel);
|
$pageFrame->addChild($descriptionLabel);
|
||||||
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
|
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
|
||||||
$descriptionLabel->setPosition(-0.45 * $width, -0.35 * $height);
|
$descriptionLabel->setPosition(-0.45 * $width, $height * -0.40);
|
||||||
$descriptionLabel->setSize(0.9 * $width, $settingHeight);
|
$descriptionLabel->setSize(0.9 * $width, $settingHeight);
|
||||||
$descriptionLabel->setTextSize(2);
|
$descriptionLabel->setTextSize(2);
|
||||||
$descriptionLabel->setTranslate(true);
|
$descriptionLabel->setTranslate(true);
|
||||||
|
@ -38,7 +38,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
const ACTION_OPEN_STATSLIST = 'SimpleStatsList.OpenStatsList';
|
const ACTION_OPEN_STATSLIST = 'SimpleStatsList.OpenStatsList';
|
||||||
const ACTION_SORT_STATS = 'SimpleStatsList.SortStats';
|
const ACTION_SORT_STATS = 'SimpleStatsList.SortStats';
|
||||||
const ACTION_PAGING_CHUNKS = 'SimpleStatsList.PagingChunk';
|
const ACTION_PAGING_CHUNKS = 'SimpleStatsList.PagingChunk';
|
||||||
const MAX_PLAYERS_PER_PAGE = 15;
|
|
||||||
const MAX_PAGES_PER_CHUNK = 10;
|
const MAX_PAGES_PER_CHUNK = 10;
|
||||||
const CACHE_CURRENT_PAGE = 'SimpleStatsList.CurrentPage';
|
const CACHE_CURRENT_PAGE = 'SimpleStatsList.CurrentPage';
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
|
|
||||||
$chunkIndex = $this->getChunkIndexFromPageNumber($pageIndex, $totalPlayersCount);
|
$chunkIndex = $this->getChunkIndexFromPageNumber($pageIndex, $totalPlayersCount);
|
||||||
$playerBeginIndex = $this->getChunkStatsBeginIndex($chunkIndex);
|
$playerBeginIndex = $this->getChunkStatsBeginIndex($chunkIndex);
|
||||||
$pagesCount = ceil($totalPlayersCount / self::MAX_PLAYERS_PER_PAGE);
|
$pagesCount = ceil($totalPlayersCount / $this->getPlayersPerPage());
|
||||||
|
|
||||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
$width = $this->statsWidth + 60;
|
$width = $this->statsWidth + 60;
|
||||||
@ -231,16 +230,17 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
$posY -= 10;
|
$posY -= 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
$playerIndex = 1 + $playerBeginIndex;
|
$playerIndex = 1 + $playerBeginIndex;
|
||||||
|
$pageMaxCount = $this->getPlayersPerPage();
|
||||||
|
|
||||||
if (!isset($statRankings[$order])) {
|
if (!isset($statRankings[$order])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Slice Array to chunk length
|
//Slice Array to chunk length
|
||||||
$statRankings[$order] = array_slice($statRankings[$order], $playerBeginIndex, self::MAX_PAGES_PER_CHUNK * self::MAX_PLAYERS_PER_PAGE, true);
|
$statRankings[$order] = array_slice($statRankings[$order], $playerBeginIndex, self::MAX_PAGES_PER_CHUNK * $pageMaxCount, true);
|
||||||
$pageNumber = 1 + $chunkIndex * self::MAX_PAGES_PER_CHUNK;
|
$pageNumber = 1 + $chunkIndex * self::MAX_PAGES_PER_CHUNK;
|
||||||
foreach ($statRankings[$order] as $playerId => $value) {
|
foreach ($statRankings[$order] as $playerId => $value) {
|
||||||
if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
|
if ($index % $pageMaxCount === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->addChild($pageFrame);
|
$frame->addChild($pageFrame);
|
||||||
$pageFrame->setZ(1);
|
$pageFrame->setZ(1);
|
||||||
@ -337,7 +337,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function getChunkIndexFromPageNumber($pageIndex, $totalPlayersCount) {
|
private function getChunkIndexFromPageNumber($pageIndex, $totalPlayersCount) {
|
||||||
$pagesCount = ceil($totalPlayersCount / self::MAX_PLAYERS_PER_PAGE);
|
$pagesCount = ceil($totalPlayersCount / $this->getPlayersPerPage());
|
||||||
if ($pageIndex > $pagesCount - 1) {
|
if ($pageIndex > $pagesCount - 1) {
|
||||||
$pageIndex = $pagesCount - 1;
|
$pageIndex = $pagesCount - 1;
|
||||||
}
|
}
|
||||||
@ -351,9 +351,20 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function getChunkStatsBeginIndex($chunkIndex) {
|
private function getChunkStatsBeginIndex($chunkIndex) {
|
||||||
return $chunkIndex * self::MAX_PAGES_PER_CHUNK * self::MAX_PLAYERS_PER_PAGE;
|
return $chunkIndex * self::MAX_PAGES_PER_CHUNK * $this->getPlayersPerPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get number of players per page
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getPlayersPerPage() {
|
||||||
|
$pageheight = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
|
||||||
|
return floor($pageheight * 0.82 / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on ManialinkPageAnswer
|
* Called on ManialinkPageAnswer
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user