code refactoring

- variable names
- unused parameters
This commit is contained in:
Steffen Schröder
2014-06-14 15:48:27 +02:00
parent b1663303b0
commit ff0dfc4ae7
31 changed files with 439 additions and 489 deletions

View File

@ -334,13 +334,13 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
* @return int
*/
public function getMenuId($title) {
$i = 0;
$index = 0;
foreach ($this->menus as $menu) {
/** @var ConfiguratorMenu $menu */
/** @var ConfiguratorMenu $menu */
if ($menu === $title || $menu->getTitle() === $title) {
return $i;
return $index;
}
$i++;
$index++;
}
return 0;
}

View File

@ -221,7 +221,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pagerSize = 9.;
$settingHeight = 5.;
$pageMaxCount = 13;
$y = 0;
$posY = 0;
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
@ -254,7 +254,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame();
$frame->add($pageFrame);
$y = $height * 0.41;
$posY = $height * 0.41;
$paging->addPage($pageFrame);
}
@ -269,7 +269,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageFrame->add($classLabel);
$classLabel->setHAlign($classLabel::LEFT);
$classLabel->setPosition($width * -0.45, $y);
$classLabel->setPosition($width * -0.45, $posY);
$classLabel->setSize($width * 0.9, $settingHeight * 0.9);
$classLabel->setStyle($classLabel::STYLE_TextCardSmall);
$classLabel->setTextSize(2);
@ -277,7 +277,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$classLabel->setTextColor('fff');
$classLabel->setAction(self::ACTION_PREFIX_SETTINGCLASS . $settingClass);
$y -= $settingHeight;
$posY -= $settingHeight;
$index++;
}

View File

@ -15,7 +15,6 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -144,11 +143,9 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
}
/**
* Handle OnBegin Map Callback
*
* @param Map $map
* Handle Begin Map Callback
*/
public function onBeginMap(Map $map) {
public function onBeginMap() {
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) {
$this->loadSettingsFromDatabase();
}
@ -210,7 +207,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
// Setting pages
$pageFrame = null;
$y = 0.;
$posY = 0.;
foreach ($scriptParams as $index => $scriptParam) {
/** @var \Maniaplanet\DedicatedServer\Structures\ScriptSettings $scriptParam */
@ -223,13 +220,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
if ($index % 13 === 0) {
$pageFrame = new Frame();
$frame->add($pageFrame);
$y = $height * 0.41;
$posY = $height * 0.41;
$paging->addPage($pageFrame);
}
$settingFrame = new Frame();
$pageFrame->add($settingFrame);
$settingFrame->setY($y);
$settingFrame->setY($posY);
$nameLabel = new Label_Text();
$settingFrame->add($nameLabel);
@ -278,7 +275,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$descriptionLabel->setText($scriptParam->desc);
$nameLabel->addTooltipFeature($descriptionLabel);
$y -= $settingHeight;
$posY -= $settingHeight;
}
return $frame;