updated manialink code for FML 1.1

This commit is contained in:
Steffen Schröder
2014-04-27 16:22:12 +02:00
parent 332f8d76fb
commit 483d673e5f
26 changed files with 222 additions and 137 deletions

View File

@ -11,6 +11,7 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
@ -81,7 +82,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
*/
public function getMenu($width, $height, Script $script) {
$pagesId = 'PluginPages';
$paging = new Paging();
$script->addFeature($paging);
$frame = new Frame();
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
@ -105,8 +107,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
$pageCountLabel = new Label_Text();
$frame->add($pageCountLabel);
@ -115,8 +117,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
$script->addPageLabel($pageCountLabel, $pagesId);
$paging->setLabel($pageCountLabel);
//Show Settings Menu
if ($this->settingsClass != '') { //TODO improve
@ -136,7 +137,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$settingFrame = new Frame();
@ -165,11 +166,10 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
}
$settingFrame = new Frame();
$pageFrame->add($settingFrame);
$settingFrame->setY($y);
@ -187,7 +187,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$substyle = '';
$entry = new Entry();
$settingFrame->add($entry);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
@ -255,7 +254,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
array_push($pageFrames, $pageFrame);
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
$y = $height * 0.41;
}
@ -296,7 +295,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$descriptionLabel->setMaxLines(5);
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
$descriptionLabel->setText($description);
$script->addTooltip($nameLabel, $descriptionLabel);
$nameLabel->addTooltipFeature($descriptionLabel);
$quad = new Quad_Icons128x32_1();
$pluginFrame->add($quad);