Compare commits

..

No commits in common. "8b3e624d1c6adbd226988134441b4dc176e4016a" and "02b7b279af2009ecf864b934b3fd8a62e8730244" have entirely different histories.

7 changed files with 20 additions and 49 deletions

View File

@ -37,6 +37,7 @@ 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
@ -128,10 +129,9 @@ 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 % $pageMaxCount === 1) { if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->addChild($pageFrame); $frame->addChild($pageFrame);
@ -236,16 +236,6 @@ 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.
* *

View File

@ -238,10 +238,9 @@ 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 % $pageMaxCount === 1) { if ($index % 15 === 1) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->addChild($pageFrame); $frame->addChild($pageFrame);
$posY = $height / 2 - 10; $posY = $height / 2 - 10;

View File

@ -336,7 +336,6 @@ 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();
@ -400,7 +399,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
); );
} }
if ($index % $pageMaxCount === 0) { if ($index % 13 === 0) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->addChild($pageFrame); $frame->addChild($pageFrame);
$posY = 0.41 * $height; $posY = 0.41 * $height;
@ -419,9 +418,6 @@ 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])) {

View File

@ -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, $height * -0.45); $mapNameButton->setPosition(-$width / 2 + 60, -35);
} }
return $frame; return $frame;

View File

@ -107,7 +107,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
// Config // Config
$pagerSize = 9.; $pagerSize = 9.;
$entryHeight = 5.; $entryHeight = 5.;
$pageMaxCount = floor(($height * 0.70) / $entryHeight); $pageMaxCount = floor(($height * 0.85) / $entryHeight);
// Pagers // Pagers
$pagerPrev = new Quad_Icons64x64_1(); $pagerPrev = new Quad_Icons64x64_1();
@ -150,7 +150,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
// Plugin pages // Plugin pages
$posY = 0.; $posY = 0.;
$pluginUpdates = null;
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CHECK_UPDATE_WHEN_OPENING)) { if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CHECK_UPDATE_WHEN_OPENING)) {
$pluginUpdates = $this->maniaControl->getUpdateManager()->getPluginUpdateManager()->getPluginsUpdates(); $pluginUpdates = $this->maniaControl->getUpdateManager()->getPluginUpdateManager()->getPluginsUpdates();
} }
@ -198,8 +197,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$descriptionLabel = new Label(); $descriptionLabel = new Label();
$pageFrame->addChild($descriptionLabel); $pageFrame->addChild($descriptionLabel);
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::BOTTOM); $descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
$descriptionLabel->setPosition($width * -0.45, $height * -0.45); $descriptionLabel->setPosition($width * -0.45, $height * -0.22);
$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 +235,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($width / 2 - 3); $quadUpdate->setX(56);
$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 +248,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, $height * -0.37, 2); $updatePluginsButton->setPosition($width * 0.5, -29, 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 +277,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$posY = 0; $posY = 0;
$index = 0; $index = 0;
$settingHeight = 5.; $settingHeight = 5.;
$pageSettingsMaxCount = floor(($height * 0.70) / $settingHeight); $pageSettingsMaxCount = floor(($height * 0.78) / $settingHeight);
$pageFrame = null; $pageFrame = null;
//Headline Label //Headline Label
@ -322,7 +321,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, $height * -0.38); $descriptionLabel->setPosition(-0.45 * $width, -0.35 * $height);
$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 +389,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, $height * -0.45); $mapNameButton->setPosition(-$width / 2 + 60, -35);
} }
return $frame; return $frame;
@ -457,7 +456,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, $height * -0.40); $descriptionLabel->setPosition(-0.45 * $width, -0.35 * $height);
$descriptionLabel->setSize(0.9 * $width, $settingHeight); $descriptionLabel->setSize(0.9 * $width, $settingHeight);
$descriptionLabel->setTextSize(2); $descriptionLabel->setTextSize(2);
$descriptionLabel->setTranslate(true); $descriptionLabel->setTranslate(true);

View File

@ -38,6 +38,7 @@ 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';
@ -145,7 +146,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 / $this->getPlayersPerPage()); $pagesCount = ceil($totalPlayersCount / self::MAX_PLAYERS_PER_PAGE);
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$width = $this->statsWidth + 60; $width = $this->statsWidth + 60;
@ -230,17 +231,16 @@ 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 * $pageMaxCount, true); $statRankings[$order] = array_slice($statRankings[$order], $playerBeginIndex, self::MAX_PAGES_PER_CHUNK * self::MAX_PLAYERS_PER_PAGE, 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 % $pageMaxCount === 1) { if ($index % self::MAX_PLAYERS_PER_PAGE === 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 / $this->getPlayersPerPage()); $pagesCount = ceil($totalPlayersCount / self::MAX_PLAYERS_PER_PAGE);
if ($pageIndex > $pagesCount - 1) { if ($pageIndex > $pagesCount - 1) {
$pageIndex = $pagesCount - 1; $pageIndex = $pagesCount - 1;
} }
@ -351,20 +351,9 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
* @return int * @return int
*/ */
private function getChunkStatsBeginIndex($chunkIndex) { private function getChunkStatsBeginIndex($chunkIndex) {
return $chunkIndex * self::MAX_PAGES_PER_CHUNK * $this->getPlayersPerPage(); return $chunkIndex * self::MAX_PAGES_PER_CHUNK * self::MAX_PLAYERS_PER_PAGE;
} }
/**
* 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
* *

View File

@ -119,8 +119,6 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
$message = "Plugins Update Check completed: There are {$updatesCount} Updates available!"; $message = "Plugins Update Check completed: There are {$updatesCount} Updates available!";
if ($player) { if ($player) {
$this->maniaControl->getChat()->sendSuccess($message, $player); $this->maniaControl->getChat()->sendSuccess($message, $player);
} else {
$this->maniaControl->getChat()->sendSuccessToAdmins($message . " (you can use //pluginsupdate)");
} }
Logger::log($message); Logger::log($message);
} }