updated manialink code for FML 1.1
This commit is contained in:
@ -10,7 +10,7 @@ use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
||||
use FML\ManiaLink;
|
||||
use FML\Script\Script;
|
||||
use FML\Script\Features\Menu;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
@ -285,8 +285,9 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
||||
$menusFrame->setX($menuWidth * -0.5 + $menuListWidth + $subMenuWidth * 0.5);
|
||||
|
||||
// Create script and features
|
||||
$script = new Script();
|
||||
$manialink->setScript($script);
|
||||
$script = $manialink->getScript();
|
||||
$menuScript = new Menu();
|
||||
$script->addFeature($menuScript);
|
||||
|
||||
$menuItemY = $menuHeight * 0.42;
|
||||
$menuId = 0;
|
||||
@ -306,7 +307,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
||||
if ($menuId == $menuIdShown) {
|
||||
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $script);
|
||||
$menusFrame->add($menuControl);
|
||||
$script->addMenu($menuItemLabel, $menuControl);
|
||||
$menuScript->addElement($menuItemLabel, $menuControl);
|
||||
}
|
||||
|
||||
$menuItemY -= $menuItemHeight * 1.1;
|
||||
|
@ -8,6 +8,7 @@ use FML\Controls\Frame;
|
||||
use FML\Controls\Label;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Script\Features\Paging;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
@ -67,7 +68,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
* @return \FML\Controls\Frame
|
||||
*/
|
||||
public function getMenu($width, $height, Script $script) {
|
||||
$pagesId = 'ManiaControlSettingsPages';
|
||||
$paging = new Paging();
|
||||
$script->addFeature($paging);
|
||||
$frame = new Frame();
|
||||
|
||||
// Config
|
||||
@ -89,8 +91,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$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();
|
||||
$frame->add($pageCountLabel);
|
||||
@ -99,8 +101,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$pageCountLabel->setStyle('TextTitle1');
|
||||
$pageCountLabel->setTextSize(2);
|
||||
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
|
||||
$paging->setLabel($pageCountLabel);
|
||||
|
||||
/** @var ManiaControl/SettingManager $this->maniaControl->settingManager */
|
||||
$settings = $this->maniaControl->settingManager->getSettings();
|
||||
@ -125,7 +126,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
}
|
||||
array_push($pageFrames, $pageFrame);
|
||||
$y = $height * 0.41;
|
||||
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
||||
$paging->addPage($pageFrame);
|
||||
}
|
||||
|
||||
$settingFrame = new Frame();
|
||||
@ -155,7 +156,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
}
|
||||
array_push($pageFrames, $pageFrame);
|
||||
$y = $height * 0.41;
|
||||
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
||||
$paging->addPage($pageFrame);
|
||||
}
|
||||
|
||||
$index++;
|
||||
|
@ -8,6 +8,7 @@ use FML\Controls\Frame;
|
||||
use FML\Controls\Label;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Script\Features\Paging;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
@ -164,7 +165,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||
*/
|
||||
public function getMenu($width, $height, Script $script) {
|
||||
$pagesId = 'ScriptSettingsPages';
|
||||
$paging = new Paging();
|
||||
$script->addFeature($paging);
|
||||
$frame = new Frame();
|
||||
|
||||
try {
|
||||
@ -203,8 +205,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$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();
|
||||
$frame->add($pageCountLabel);
|
||||
@ -213,7 +215,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$pageCountLabel->setStyle('TextTitle1');
|
||||
$pageCountLabel->setTextSize(2);
|
||||
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
$paging->setLabel($pageCountLabel);
|
||||
|
||||
// Setting pages
|
||||
$pageFrames = array();
|
||||
@ -234,7 +236,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
}
|
||||
array_push($pageFrames, $pageFrame);
|
||||
$y = $height * 0.41;
|
||||
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
||||
$paging->addPage($pageFrame);
|
||||
}
|
||||
|
||||
$settingFrame = new Frame();
|
||||
@ -288,7 +290,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$descriptionLabel->setTextSize($labelTextSize);
|
||||
$descriptionLabel->setTranslate(true);
|
||||
$descriptionLabel->setText($scriptParam->desc);
|
||||
$script->addTooltip($nameLabel, $descriptionLabel);
|
||||
$nameLabel->addTooltipFeature($descriptionLabel);
|
||||
|
||||
$y -= $settingHeight;
|
||||
if ($index % $pageMaxCount == $pageMaxCount - 1) {
|
||||
|
@ -8,6 +8,7 @@ use FML\Controls\Frame;
|
||||
use FML\Controls\Label;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Script\Features\Paging;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
@ -137,7 +138,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||
*/
|
||||
public function getMenu($width, $height, Script $script) {
|
||||
$pagesId = 'ServerSettingsPages';
|
||||
$paging = new Paging();
|
||||
$script->addFeature($paging);
|
||||
$frame = new Frame();
|
||||
|
||||
$serverSettings = $this->maniaControl->client->getServerOptions()->toArray();
|
||||
@ -161,8 +163,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$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();
|
||||
$frame->add($pageCountLabel);
|
||||
@ -171,7 +173,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$pageCountLabel->setStyle('TextTitle1');
|
||||
$pageCountLabel->setTextSize(2);
|
||||
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
$paging->setLabel($pageCountLabel);
|
||||
|
||||
// Setting pages
|
||||
$pageFrames = array();
|
||||
@ -192,7 +194,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
}
|
||||
array_push($pageFrames, $pageFrame);
|
||||
$y = $height * 0.41;
|
||||
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
||||
$paging->addPage($pageFrame);
|
||||
}
|
||||
|
||||
$settingFrame = new Frame();
|
||||
|
Reference in New Issue
Block a user