From b5494576d28e607b259215bfe585e5f97042dccd Mon Sep 17 00:00:00 2001 From: Jocy Date: Wed, 17 May 2017 16:08:51 +0200 Subject: [PATCH] Fixed https://github.com/ManiaControl/ManiaControl/issues/131 Fixed https://github.com/ManiaControl/ManiaControl/issues/130 Fixed https://github.com/ManiaControl/ManiaControl/issues/129 --- core/Manialinks/SidebarMenuManager.php | 15 ++++++++++++++- core/Maps/MapList.php | 2 +- core/Players/PlayerList.php | 6 +++++- core/Server/ServerOptionsMenu.php | 2 +- plugins/MCTeam/CustomVotesPlugin.php | 10 ++++++---- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/core/Manialinks/SidebarMenuManager.php b/core/Manialinks/SidebarMenuManager.php index 8a06082e..80d7d971 100644 --- a/core/Manialinks/SidebarMenuManager.php +++ b/core/Manialinks/SidebarMenuManager.php @@ -61,7 +61,6 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener { } else { $posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA); } - $pos = new Position(); $pos->setX($posX); $pos->setY($posY); @@ -69,6 +68,16 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener { return $pos; } + private function getElementCountbeforeAdminMenu(){ + $count = 0; + foreach($this->menuEntries as $k => $entry){ + if($k < SidebarMenuManager::ORDER_ADMIN_MENU){ + $count++; + } + } + return $count; + } + /** * Returns PositionObject of a menu item of the sidebar, or null if it's not found * @@ -81,6 +90,10 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener { $itemMarginFactor = 1.2; $pos = $this->getSidebarPosition(); + $count = $this->getElementCountbeforeAdminMenu(); + $pos->setY($pos->getY() + $itemSize * $itemMarginFactor * $count); + + if (isset($this->yPositions[$id])) { $pos->setY($this->yPositions[$id]); return $pos; diff --git a/core/Maps/MapList.php b/core/Maps/MapList.php index 175b1158..acf0c810 100644 --- a/core/Maps/MapList.php +++ b/core/Maps/MapList.php @@ -56,7 +56,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor'; const ACTION_RESET = 'MapList.ResetMapList'; const MAX_MAPS_PER_PAGE = 13; - const MAX_PAGES_PER_CHUNK = 10; + const MAX_PAGES_PER_CHUNK = 2; const DEFAULT_KARMA_PLUGIN = 'MCTeam\KarmaPlugin'; const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin'; const CACHE_CURRENT_PAGE = 'CurrentPage'; diff --git a/core/Players/PlayerList.php b/core/Players/PlayerList.php index d965146c..31404e55 100644 --- a/core/Players/PlayerList.php +++ b/core/Players/PlayerList.php @@ -60,7 +60,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin'; const SHOWN_MAIN_WINDOW = -1; const MAX_PLAYERS_PER_PAGE = 15; - const MAX_PAGES_PER_CHUNK = 10; + const MAX_PAGES_PER_CHUNK = 2; /* * Private properties @@ -674,7 +674,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer public function handleManialinkPageAnswer(array $callback) { $actionId = $callback[1][2]; $actionArray = explode('.', $actionId, 3); + if(count($actionArray) < 2){ + return; + } $action = $actionArray[0] . '.' . $actionArray[1]; + if (count($actionArray) > 2) { $adminLogin = $callback[1][1]; diff --git a/core/Server/ServerOptionsMenu.php b/core/Server/ServerOptionsMenu.php index dea5ee47..cb94f85b 100644 --- a/core/Server/ServerOptionsMenu.php +++ b/core/Server/ServerOptionsMenu.php @@ -311,7 +311,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList $entry->setStyle(Label_Text::STYLE_TextValueSmall)->setX($width * 0.23)->setTextSize(1)->setSize($width * 0.48, $optionHeight * 0.9)->setName(self::ACTION_PREFIX_OPTION . $name)->setDefault($value); if ($name === 'Comment') { - $entry->setSize($width * 0.48, $optionHeight * 3. + $optionHeight * 0.9)->setAutoNewLine(true); + $entry->setSize($width * 0.48, $optionHeight * 3. + $optionHeight * 0.9)->setAutoNewLine(true)->setVerticalAlign($entry::TOP)->setY($optionHeight * 1.5 + 2.5); $optionsFrame->setY($posY - $optionHeight * 1.5); $posY -= $optionHeight * 3.; $index += 3; diff --git a/plugins/MCTeam/CustomVotesPlugin.php b/plugins/MCTeam/CustomVotesPlugin.php index 219b50c3..54d55634 100644 --- a/plugins/MCTeam/CustomVotesPlugin.php +++ b/plugins/MCTeam/CustomVotesPlugin.php @@ -162,7 +162,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener, $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_TIME, 40); - $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry($this,SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID); + $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry($this, SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID); //Define Votes $this->defineVote("teambalance", "Vote for Team Balance"); @@ -317,6 +317,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener, $popoutFrame = new Frame(); $maniaLink->addChild($popoutFrame); $popoutFrame->setPosition($pos->getX() - $itemSize * 0.5, $pos->getY()); + $popoutFrame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE); $popoutFrame->setHorizontalAlign($popoutFrame::RIGHT); $popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY); $popoutFrame->setVisible(false); @@ -371,7 +372,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener, $this->destroyVote(); $this->maniaControl->getManialinkManager()->hideManialink(self::MLID_ICON); - $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->deleteMenuEntry($this,self::CUSTOMVOTES_MENU_ID,true); + $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->deleteMenuEntry($this, self::CUSTOMVOTES_MENU_ID, true); } /** @@ -708,7 +709,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener, $frame->addChild($timeGauge); $timeGauge->setY(1.5); $timeGauge->setSize($width * 0.95, 6); - $timeGauge->setDrawBg(false); + $timeGauge->setDrawBlockBackground(false); if (!$timeUntilExpire) { $timeUntilExpire = 1; } @@ -731,10 +732,11 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener, $frame->addChild($voteGauge); $voteGauge->setY(-4); $voteGauge->setSize($width * 0.65, 12); - $voteGauge->setDrawBg(false); + $voteGauge->setDrawBlockBackground(false); $voteGauge->setRatio($votePercentage + 0.10 - $votePercentage * 0.10); $gaugeColor = ColorUtil::floatToStatusColor($votePercentage); $voteGauge->setColor($gaugeColor . '6'); + $voteGauge->setZ(-0.1); $posY = -4.4; $voteLabel = new Label();