diff --git a/core/Admin/AdminLists.php b/core/Admin/AdminLists.php index 818cc759..dd6ec9cb 100644 --- a/core/Admin/AdminLists.php +++ b/core/Admin/AdminLists.php @@ -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. * diff --git a/core/Commands/HelpManager.php b/core/Commands/HelpManager.php index a69d91b9..601d80aa 100644 --- a/core/Commands/HelpManager.php +++ b/core/Commands/HelpManager.php @@ -238,9 +238,10 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns $index = 1; $posY -= 10; $pageFrame = null; + $pageMaxCount = floor($height * 0.80 / 4); foreach ($commands as $command) { - if ($index % 15 === 1) { + if ($index % $pageMaxCount === 1) { $pageFrame = new Frame(); $frame->addChild($pageFrame); $posY = $height / 2 - 10; diff --git a/core/Configurator/GameModeSettings.php b/core/Configurator/GameModeSettings.php index 9ee791ef..b394cf77 100644 --- a/core/Configurator/GameModeSettings.php +++ b/core/Configurator/GameModeSettings.php @@ -336,6 +336,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat $pagerSize = 9.; $settingHeight = 5.; $labelTextSize = 2; + $pageMaxCount = floor(($height * 0.85) / $settingHeight); // Pagers $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(); $frame->addChild($pageFrame); $posY = 0.41 * $height; @@ -418,6 +419,9 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat $nameLabel->setText($settingName); $nameLabel->setTextSize($labelTextSize); $nameLabel->setX(-0.46 * $width); + if ($scriptParam->desc === self::DESCRIPTION_HIDDEN) { + $nameLabel->setTextColor("AAAAAA"); + } if (!$isScriptMode) { if (is_bool($settingValue[0])) { diff --git a/core/Configurator/ManiaControlSettings.php b/core/Configurator/ManiaControlSettings.php index e1fa6dcb..d7bd4fa0 100644 --- a/core/Configurator/ManiaControlSettings.php +++ b/core/Configurator/ManiaControlSettings.php @@ -243,7 +243,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { self::ACTION_PREFIX_SETTINGLINKS . $settingClass ); $frame->addChild($mapNameButton); - $mapNameButton->setPosition(-$width / 2 + 60, -35); + $mapNameButton->setPosition(-$width / 2 + 60, $height * -0.45); } return $frame; diff --git a/core/Plugins/PluginMenu.php b/core/Plugins/PluginMenu.php index c8ddab99..ed19ebe2 100644 --- a/core/Plugins/PluginMenu.php +++ b/core/Plugins/PluginMenu.php @@ -107,7 +107,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns // Config $pagerSize = 9.; $entryHeight = 5.; - $pageMaxCount = floor(($height * 0.85) / $entryHeight); + $pageMaxCount = floor(($height * 0.70) / $entryHeight); // Pagers $pagerPrev = new Quad_Icons64x64_1(); @@ -198,8 +198,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns $descriptionLabel = new Label(); $pageFrame->addChild($descriptionLabel); - $descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP); - $descriptionLabel->setPosition($width * -0.45, $height * -0.22); + $descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::BOTTOM); + $descriptionLabel->setPosition($width * -0.45, $height * -0.45); $descriptionLabel->setSize($width * 0.7, $entryHeight); $descriptionLabel->setTextSize(2); $descriptionLabel->setTranslate(true); @@ -236,7 +236,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns $quadUpdate = new Quad_Icons128x128_1(); $pluginFrame->addChild($quadUpdate); $quadUpdate->setSubStyle($quadUpdate::SUBSTYLE_ProfileVehicle); - $quadUpdate->setX(56); + $quadUpdate->setX($width / 2 - 3); $quadUpdate->setZ(2); $quadUpdate->setSize(5, 5); $quadUpdate->setAction(self::ACTION_PREFIX_UPDATEPLUGIN . $pluginClass); @@ -249,7 +249,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns $updatePluginsButton = new Label_Button(); $frame->addChild($updatePluginsButton); $updatePluginsButton->setHorizontalAlign($updatePluginsButton::RIGHT); - $updatePluginsButton->setPosition($width * 0.5, -29, 2); + $updatePluginsButton->setPosition($width * 0.5, $height * -0.37, 2); $updatePluginsButton->setWidth(10); $updatePluginsButton->setStyle($updatePluginsButton::STYLE_CardButtonSmallS); $updatePluginsButton->setText(count($pluginUpdates) . ' update(s)'); @@ -278,7 +278,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns $posY = 0; $index = 0; $settingHeight = 5.; - $pageSettingsMaxCount = floor(($height * 0.78) / $settingHeight); + $pageSettingsMaxCount = floor(($height * 0.70) / $settingHeight); $pageFrame = null; //Headline Label @@ -322,7 +322,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns $descriptionLabel = new Label_Text(); $pageFrame->addChild($descriptionLabel); $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->setTextSize(2); $descriptionLabel->setTranslate(true); @@ -390,7 +390,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns self::ACTION_PREFIX_MANAGE_SETTING_LINK . $settingClass ); $frame->addChild($mapNameButton); - $mapNameButton->setPosition(-$width / 2 + 60, -35); + $mapNameButton->setPosition(-$width / 2 + 60, $height * -0.45); } return $frame; @@ -457,7 +457,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns $descriptionLabel = new Label_Text(); $pageFrame->addChild($descriptionLabel); $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->setTextSize(2); $descriptionLabel->setTranslate(true); diff --git a/core/Statistics/SimpleStatsList.php b/core/Statistics/SimpleStatsList.php index 65d38b8a..6536249f 100644 --- a/core/Statistics/SimpleStatsList.php +++ b/core/Statistics/SimpleStatsList.php @@ -38,7 +38,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, const ACTION_OPEN_STATSLIST = 'SimpleStatsList.OpenStatsList'; const ACTION_SORT_STATS = 'SimpleStatsList.SortStats'; const ACTION_PAGING_CHUNKS = 'SimpleStatsList.PagingChunk'; - const MAX_PLAYERS_PER_PAGE = 15; const MAX_PAGES_PER_CHUNK = 10; const CACHE_CURRENT_PAGE = 'SimpleStatsList.CurrentPage'; @@ -146,7 +145,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $chunkIndex = $this->getChunkIndexFromPageNumber($pageIndex, $totalPlayersCount); $playerBeginIndex = $this->getChunkStatsBeginIndex($chunkIndex); - $pagesCount = ceil($totalPlayersCount / self::MAX_PLAYERS_PER_PAGE); + $pagesCount = ceil($totalPlayersCount / $this->getPlayersPerPage()); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $width = $this->statsWidth + 60; @@ -231,16 +230,17 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $posY -= 10; $pageFrame = null; $playerIndex = 1 + $playerBeginIndex; + $pageMaxCount = $this->getPlayersPerPage(); if (!isset($statRankings[$order])) { return; } //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; foreach ($statRankings[$order] as $playerId => $value) { - if ($index % self::MAX_PLAYERS_PER_PAGE === 1) { + if ($index % $pageMaxCount === 1) { $pageFrame = new Frame(); $frame->addChild($pageFrame); $pageFrame->setZ(1); @@ -337,7 +337,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, * @return int */ private function getChunkIndexFromPageNumber($pageIndex, $totalPlayersCount) { - $pagesCount = ceil($totalPlayersCount / self::MAX_PLAYERS_PER_PAGE); + $pagesCount = ceil($totalPlayersCount / $this->getPlayersPerPage()); if ($pageIndex > $pagesCount - 1) { $pageIndex = $pagesCount - 1; } @@ -351,9 +351,20 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, * @return int */ 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 *