script settings and plugin configurators improvements
This commit is contained in:
parent
196b6eeee4
commit
30717ce343
@ -215,7 +215,7 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
$menuRelationships = array();
|
$menuRelationships = array();
|
||||||
$menuItemY = $menuHeight * 0.42;
|
$menuItemY = $menuHeight * 0.42;
|
||||||
foreach ($this->menus as $menu) {
|
foreach ($this->menus as $index => $menu) {
|
||||||
// Add title
|
// Add title
|
||||||
$menuItemLabel = new Label();
|
$menuItemLabel = new Label();
|
||||||
$menuItemsFrame->add($menuItemLabel);
|
$menuItemsFrame->add($menuItemLabel);
|
||||||
@ -226,6 +226,9 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
// Add menu
|
// Add menu
|
||||||
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $pages, $tooltips);
|
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $pages, $tooltips);
|
||||||
|
if ($index > 0) {
|
||||||
|
$menuControl->setVisible(false);
|
||||||
|
}
|
||||||
$menusFrame->add($menuControl);
|
$menusFrame->add($menuControl);
|
||||||
|
|
||||||
// Add menu relationship
|
// Add menu relationship
|
||||||
|
@ -18,14 +18,12 @@ use ManiaControl\Players\Player;
|
|||||||
*
|
*
|
||||||
* @author steeffeen & kremsy
|
* @author steeffeen & kremsy
|
||||||
*/
|
*/
|
||||||
|
// TODO: boolean script settings not as entries
|
||||||
class ScriptSettings implements ConfiguratorMenu {
|
class ScriptSettings implements ConfiguratorMenu {
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const NAME_PREFIX = 'Script.';
|
const ACTION_PREFIX_SETTING = 'ScriptSetting.';
|
||||||
const SETTING_TITLE = 'Menu Title';
|
|
||||||
const SETTING_STYLE_SETTING = 'Setting Label Style';
|
|
||||||
const SETTING_STYLE_DESCRIPTION = 'Description Label Style';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
@ -39,11 +37,6 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
*/
|
*/
|
||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
// Init settings
|
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_TITLE, 'Script Settings');
|
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_STYLE_SETTING, Label_Text::STYLE_TextStaticSmall);
|
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_STYLE_DESCRIPTION, Label_Text::STYLE_TextTips);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,9 +44,9 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||||
*/
|
*/
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_TITLE);
|
return 'Script Settings';
|
||||||
}
|
}
|
||||||
//TODO: boolean values not as entry
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||||
@ -69,8 +62,6 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
$scriptSettings = $this->maniaControl->client->getResponse();
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
$labelStyleSetting = $this->maniaControl->settingManager->getSetting($this, self::SETTING_STYLE_SETTING);
|
|
||||||
$labelStyleDescription = $this->maniaControl->settingManager->getSetting($this, self::SETTING_STYLE_DESCRIPTION);
|
|
||||||
$pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
$settingHeight = 5.;
|
$settingHeight = 5.;
|
||||||
$labelTextSize = 2;
|
$labelTextSize = 2;
|
||||||
@ -98,7 +89,7 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
|
|
||||||
// Setting pages
|
// Setting pages
|
||||||
$pageFrames = array();
|
$pageFrames = array();
|
||||||
$y = 0.;
|
$y = 0.;
|
||||||
foreach ($scriptParams as $index => $scriptParam) {
|
foreach ($scriptParams as $index => $scriptParam) {
|
||||||
$settingName = $scriptParam['Name'];
|
$settingName = $scriptParam['Name'];
|
||||||
if (!isset($scriptSettings[$settingName])) continue;
|
if (!isset($scriptSettings[$settingName])) continue;
|
||||||
@ -114,12 +105,12 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
$pageFrame->add($settingFrame);
|
$pageFrame->add($settingFrame);
|
||||||
$settingFrame->setY($y);
|
$settingFrame->setY($y);
|
||||||
|
|
||||||
$nameLabel = new Label();
|
$nameLabel = new Label_Text();
|
||||||
$settingFrame->add($nameLabel);
|
$settingFrame->add($nameLabel);
|
||||||
$nameLabel->setHAlign(Control::LEFT);
|
$nameLabel->setHAlign(Control::LEFT);
|
||||||
$nameLabel->setX($width * -0.46);
|
$nameLabel->setX($width * -0.46);
|
||||||
$nameLabel->setSize($width * 0.4, $settingHeight);
|
$nameLabel->setSize($width * 0.4, $settingHeight);
|
||||||
$nameLabel->setStyle($labelStyleSetting);
|
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
|
||||||
$nameLabel->setTextSize($labelTextSize);
|
$nameLabel->setTextSize($labelTextSize);
|
||||||
$nameLabel->setText($settingName);
|
$nameLabel->setText($settingName);
|
||||||
|
|
||||||
@ -127,8 +118,8 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
$settingFrame->add($entry);
|
$settingFrame->add($entry);
|
||||||
$entry->setHAlign(Control::RIGHT);
|
$entry->setHAlign(Control::RIGHT);
|
||||||
$entry->setX($width * 0.44);
|
$entry->setX($width * 0.44);
|
||||||
$entry->setSize($width * 0.43, $settingHeight);
|
$entry->setSize($width * 0.4, $settingHeight);
|
||||||
$entry->setName(self::NAME_PREFIX . $settingName);
|
$entry->setName(self::ACTION_PREFIX_SETTING . $settingName);
|
||||||
$settingValue = $scriptSettings[$settingName];
|
$settingValue = $scriptSettings[$settingName];
|
||||||
if ($settingValue === false) {
|
if ($settingValue === false) {
|
||||||
$settingValue = 0;
|
$settingValue = 0;
|
||||||
@ -140,7 +131,6 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
$descriptionLabel->setHAlign(Control::LEFT);
|
$descriptionLabel->setHAlign(Control::LEFT);
|
||||||
$descriptionLabel->setPosition($width * -0.45, $height * -0.44);
|
$descriptionLabel->setPosition($width * -0.45, $height * -0.44);
|
||||||
$descriptionLabel->setSize($width * 0.7, $settingHeight);
|
$descriptionLabel->setSize($width * 0.7, $settingHeight);
|
||||||
$descriptionLabel->setStyle($labelStyleDescription);
|
|
||||||
$descriptionLabel->setTranslate(true);
|
$descriptionLabel->setTranslate(true);
|
||||||
$descriptionLabel->setTextPrefix('Desc: ');
|
$descriptionLabel->setTextPrefix('Desc: ');
|
||||||
$descriptionLabel->setText($scriptParam['Desc']);
|
$descriptionLabel->setText($scriptParam['Desc']);
|
||||||
@ -164,13 +154,15 @@ class ScriptSettings implements ConfiguratorMenu {
|
|||||||
public function saveConfigData(array $configData, Player $player) {
|
public function saveConfigData(array $configData, Player $player) {
|
||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$this->maniaControl->client->query('GetModeScriptSettings');
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
$scriptSettings = $this->maniaControl->client->getResponse();
|
||||||
// var_dump($configData);
|
// var_dump($configData);
|
||||||
// var_dump($scriptSettings);
|
// var_dump($scriptSettings);
|
||||||
$prefixLength = strlen(self::NAME_PREFIX);
|
$prefixLength = strlen(self::ACTION_PREFIX_SETTING);
|
||||||
foreach ($configData[3] as $dataName => $dataValue) {
|
foreach ($configData[3] as $dataName => $dataValue) {
|
||||||
if (substr($dataName, 0, $prefixLength) != self::NAME_PREFIX) continue;
|
if (substr($dataName, 0, $prefixLength) != self::ACTION_PREFIX_SETTING) continue;
|
||||||
|
|
||||||
$settingName = substr($dataName, $prefixLength);
|
$settingName = substr($dataName, $prefixLength);
|
||||||
|
|
||||||
|
// TODO: apply new script settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ class PluginManager {
|
|||||||
private $activePlugins = array();
|
private $activePlugins = array();
|
||||||
private $pluginClasses = array();
|
private $pluginClasses = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct plugin manager
|
* Construct plugin manager
|
||||||
*
|
*
|
||||||
@ -138,6 +137,40 @@ class PluginManager {
|
|||||||
return $active;
|
return $active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate and start the plugin with the given name
|
||||||
|
*
|
||||||
|
* @param string $pluginClass
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function activatePlugin($pluginClass) {
|
||||||
|
if (!in_array($pluginClass, $this->pluginClasses)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isset($this->activePlugins[$pluginClass])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->savePluginStatus($pluginClass, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deactivate the plugin with the given name
|
||||||
|
*
|
||||||
|
* @param string $pluginClass
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function deactivatePlugin($pluginClass) {
|
||||||
|
if (!in_array($pluginClass, $this->pluginClasses)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isset($this->activePlugins[$pluginClass])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->savePluginStatus($pluginClass, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load complete plugins directory and start all configured plugins
|
* Load complete plugins directory and start all configured plugins
|
||||||
*/
|
*/
|
||||||
@ -165,24 +198,26 @@ class PluginManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$plugin = new $className($this->maniaControl);
|
$plugin = new $className($this->maniaControl);
|
||||||
array_push($this->activePlugins, $plugin);
|
$this->activePlugins[$className] = $plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all declared plugin class names
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getPluginClasses()
|
public function getPluginClasses() {
|
||||||
{
|
|
||||||
return $this->pluginClasses;
|
return $this->pluginClasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all active plugins
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getActivePlugins()
|
public function getActivePlugins() {
|
||||||
{
|
|
||||||
return $this->activePlugins;
|
return $this->activePlugins;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,23 @@ use FML\Controls\Frame;
|
|||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Labels\Label_Text;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
|
use FML\Controls\Labels\Label_Button;
|
||||||
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configurator for enabling and disabling plugins
|
* Configurator for enabling and disabling plugins
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
*/
|
*/
|
||||||
class PluginMenu implements ConfiguratorMenu {
|
class PluginMenu implements CallbackListener, ConfiguratorMenu {
|
||||||
|
/**
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
const ACTION_PREFIX_ENABLEPLUGIN = 'PluginMenu.Enable.';
|
||||||
|
const ACTION_PREFIX_DISABLEPLUGIN = 'PluginMenu.Disable.';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
@ -31,6 +41,9 @@ class PluginMenu implements ConfiguratorMenu {
|
|||||||
*/
|
*/
|
||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||||
|
'handleManialinkPageAnswer');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,7 +51,7 @@ class PluginMenu implements ConfiguratorMenu {
|
|||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||||
*/
|
*/
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
return "Plugins";
|
return 'Plugins';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,15 +62,37 @@ class PluginMenu implements ConfiguratorMenu {
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
|
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
|
||||||
//$labelStyleSetting = $this->maniaControl->settingManager->getSetting($this, self::SETTING_STYLE_SETTING);
|
|
||||||
$labelStyleSetting = Label_Text::STYLE_TextStaticSmall;
|
// Config
|
||||||
// $pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
$entryHeight = 5.;
|
$entryHeight = 5.;
|
||||||
$labelTextSize = 2;
|
$labelTextSize = 2;
|
||||||
// $pageMaxCount = 13;
|
$pageMaxCount = 10;
|
||||||
|
|
||||||
|
// Pagers
|
||||||
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
|
$frame->add($pagerPrev);
|
||||||
|
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
|
||||||
|
$pagerPrev->setSize($pagerSize, $pagerSize);
|
||||||
|
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
|
||||||
|
|
||||||
|
$pagerNext = new Quad_Icons64x64_1();
|
||||||
|
$frame->add($pagerNext);
|
||||||
|
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||||
|
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||||
|
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||||
|
|
||||||
|
$pageCountLabel = new Label_Text();
|
||||||
|
$frame->add($pageCountLabel);
|
||||||
|
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||||
|
$pageCountLabel->setPosition($width * 0.35, $height * -0.44, 1);
|
||||||
|
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
||||||
|
$pageCountLabel->setTextSize(2);
|
||||||
|
|
||||||
|
// Plugin pages
|
||||||
$pageFrames = array();
|
$pageFrames = array();
|
||||||
$y = 0.;
|
$y = 0.;
|
||||||
foreach ($pluginClasses as $pluginClass) {
|
foreach ($pluginClasses as $index => $pluginClass) {
|
||||||
if (!isset($pageFrame)) {
|
if (!isset($pageFrame)) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
@ -65,64 +100,69 @@ class PluginMenu implements ConfiguratorMenu {
|
|||||||
$y = $height * 0.41;
|
$y = $height * 0.41;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if plugin is aktiv
|
|
||||||
$active = $this->maniaControl->pluginManager->getPluginStatus($pluginClass);
|
$active = $this->maniaControl->pluginManager->getPluginStatus($pluginClass);
|
||||||
|
|
||||||
|
$pluginFrame = new Frame();
|
||||||
|
$pageFrame->add($pluginFrame);
|
||||||
|
$pluginFrame->setY($y);
|
||||||
|
|
||||||
$settingFrame = new Frame();
|
$activeQuad = new Quad_Icons64x64_1();
|
||||||
$pageFrame->add($settingFrame);
|
$pluginFrame->add($activeQuad);
|
||||||
$settingFrame->setY($y);
|
$activeQuad->setPosition($width * -0.45, -0.1, 1);
|
||||||
|
$activeQuad->setSize($entryHeight * 0.9, $entryHeight * 0.9);
|
||||||
|
if ($active) {
|
||||||
|
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlGreen);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlRed);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Red or Green quad to see if the plugin is aktiv (not working yet)
|
$nameLabel = new Label_Text();
|
||||||
$activeQuad = new Quad();
|
$pluginFrame->add($nameLabel);
|
||||||
$settingFrame->add($activeQuad);
|
|
||||||
if($active)
|
|
||||||
$activeQuad->setStyles("Icons64x64_1", "LvlGreen");
|
|
||||||
else
|
|
||||||
$activeQuad->setStyles("Icons64x64_1", "LvlRed");
|
|
||||||
$activeQuad->setHeight(5);
|
|
||||||
$activeQuad->setWidth(5);
|
|
||||||
$activeQuad->setX($width * -0.455);
|
|
||||||
//TODO handle z position automatically in fml pls
|
|
||||||
|
|
||||||
$nameLabel = new Label();
|
|
||||||
$settingFrame->add($nameLabel);
|
|
||||||
$nameLabel->setHAlign(Control::LEFT);
|
$nameLabel->setHAlign(Control::LEFT);
|
||||||
$nameLabel->setX($width * -0.4);
|
$nameLabel->setX($width * -0.4);
|
||||||
$nameLabel->setSize($width * 0.4, $entryHeight);
|
$nameLabel->setSize($width * 0.5, $entryHeight);
|
||||||
$nameLabel->setStyle($labelStyleSetting);
|
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
|
||||||
$nameLabel->setTextSize($labelTextSize);
|
$nameLabel->setTextSize($labelTextSize);
|
||||||
$nameLabel->setText($pluginClass);
|
$nameLabel->setText($pluginClass::getName());
|
||||||
|
|
||||||
//TODO description
|
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$pageFrame->add($descriptionLabel);
|
$pageFrame->add($descriptionLabel);
|
||||||
$descriptionLabel->setHAlign(Control::LEFT);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
$descriptionLabel->setPosition($width * -0.45, $height * -0.44);
|
$descriptionLabel->setPosition($width * -0.45, $height * -0.22);
|
||||||
//$descriptionLabel->setSize($width * 0.7, $settingHeight);
|
$descriptionLabel->setSize($width * 0.7, $entryHeight);
|
||||||
//$descriptionLabel->setStyle($labelStyleDescription);
|
$descriptionLabel->setTextSize(2);
|
||||||
$descriptionLabel->setTranslate(true);
|
$descriptionLabel->setTranslate(true);
|
||||||
$descriptionLabel->setTextPrefix('Desc: ');
|
$descriptionLabel->setVisible(false);
|
||||||
//$descriptionLabel->setText($scriptParam['Desc']);
|
$descriptionLabel->setAutoNewLine(true);
|
||||||
|
$descriptionLabel->setMaxLines(5);
|
||||||
|
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
|
||||||
|
$descriptionLabel->setText($description);
|
||||||
$tooltips->add($nameLabel, $descriptionLabel);
|
$tooltips->add($nameLabel, $descriptionLabel);
|
||||||
|
|
||||||
//TODO set aktive button
|
$statusChangeButton = new Label_Button();
|
||||||
/*$aktivButton = new Quad();
|
$pluginFrame->add($statusChangeButton);
|
||||||
$aktivButton->setBgColor("F00");
|
$statusChangeButton->setHAlign(Control::RIGHT);
|
||||||
$aktivButton->setHeight(10);
|
$statusChangeButton->setX($width * 0.45);
|
||||||
$aktivButton->setWidth(10);
|
$statusChangeButton->setStyle($statusChangeButton::STYLE_CardButtonSmall);
|
||||||
$aktivButton->setX($width * 0.2);
|
if ($active) {
|
||||||
$settingFrame->add($aktivButton);*/
|
$statusChangeButton->setTextPrefix('$f00');
|
||||||
//$aktivButton = new Labels\Label_Button();
|
$statusChangeButton->setText('Deactivate');
|
||||||
|
$statusChangeButton->setAction(self::ACTION_PREFIX_DISABLEPLUGIN . $pluginClass);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$statusChangeButton->setTextPrefix('a');
|
||||||
|
$statusChangeButton->setText('Activate');
|
||||||
|
$statusChangeButton->setAction(self::ACTION_PREFIX_ENABLEPLUGIN . $pluginClass);
|
||||||
|
}
|
||||||
|
|
||||||
$y -= $entryHeight;
|
$y -= $entryHeight;
|
||||||
// if ($index % $pageMaxCount == $pageMaxCount - 1) {
|
if ($index % $pageMaxCount == $pageMaxCount - 1) {
|
||||||
// unset($pageFrame);
|
unset($pageFrame);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
//TODO multiple pages
|
|
||||||
//$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
|
$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
|
||||||
|
|
||||||
return $frame;
|
return $frame;
|
||||||
}
|
}
|
||||||
@ -133,6 +173,32 @@ class PluginMenu implements ConfiguratorMenu {
|
|||||||
*/
|
*/
|
||||||
public function saveConfigData(array $configData, Player $player) {
|
public function saveConfigData(array $configData, Player $player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle PlayerManialinkPageAnswer callback
|
||||||
|
*
|
||||||
|
* @param array $callback
|
||||||
|
*/
|
||||||
|
public function handleManialinkPageAnswer(array $callback) {
|
||||||
|
$actionId = $callback[1][2];
|
||||||
|
$enable = (strpos($actionId, self::ACTION_PREFIX_ENABLEPLUGIN) === 0);
|
||||||
|
$disable = (strpos($actionId, self::ACTION_PREFIX_DISABLEPLUGIN) === 0);
|
||||||
|
if (!$enable && !$disable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$login = $callback[1][1];
|
||||||
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
|
if (!$player) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($enable) {
|
||||||
|
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_ENABLEPLUGIN));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN));
|
||||||
|
}
|
||||||
|
var_dump($pluginClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user