From 0eb2e0922b80f5a56cced00f864d93020032af11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 25 Jul 2014 17:58:45 +0200 Subject: [PATCH] use api utility method --- application/core/Server/VoteRatiosMenu.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/application/core/Server/VoteRatiosMenu.php b/application/core/Server/VoteRatiosMenu.php index 0434a011..754233ec 100644 --- a/application/core/Server/VoteRatiosMenu.php +++ b/application/core/Server/VoteRatiosMenu.php @@ -56,15 +56,16 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene * @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu() */ public function getMenu($width, $height, Script $script, Player $player) { - $voteRatioCommands = $this->getAllVoteRatioCommands(); + $voteRatioCommands = VoteRatio::getCommands(); $voteRatios = $this->maniaControl->client->getCallVoteRatios(); $frame = new Frame(); $posY = $height * 0.41; $lineHeight = 5.; + $index = 0; - foreach ($voteRatioCommands as $index => $voteRatioCommand) { + foreach ($voteRatioCommands as $voteRatioCommand => $voteRatioDescription) { $voteRatioFrame = new Frame(); $frame->add($voteRatioFrame); $voteRatioFrame->setY($posY); @@ -75,7 +76,8 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene ->setX($width * -0.46) ->setSize($width * 0.7, $lineHeight) ->setTextSize(2) - ->setText($voteRatioCommand); + ->setTranslate(true) + ->setText($voteRatioDescription); $entry = new Entry(); $voteRatioFrame->add($entry); @@ -94,20 +96,12 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene if ($index === 0) { $posY -= $lineHeight; } + $index++; } return $frame; } - /** - * Return an array of all available vote ratio commands - * - * @return string[] - */ - private function getAllVoteRatioCommands() { - return array('*', VoteRatio::COMMAND_RESTART_MAP, VoteRatio::COMMAND_NEXT_MAP, VoteRatio::COMMAND_SET_NEXT_MAP, VoteRatio::COMMAND_JUMP_MAP, VoteRatio::COMMAND_TEAM_BALANCE, VoteRatio::COMMAND_SCRIPT_SETTINGS, VoteRatio::COMMAND_KICK, VoteRatio::COMMAND_BAN); - } - /** * Return the vote ratio for the given command *