- worked on ingame configurator (not possible like that!)
- fml fix
This commit is contained in:
parent
284fc5f6e7
commit
1871617ac9
@ -18,6 +18,8 @@ use FML\Script\Menus;
|
||||
use FML\Script\Pages;
|
||||
use FML\Script\Script;
|
||||
use FML\Script\Tooltips;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\ManiaLinks;
|
||||
|
||||
require_once __DIR__ . '/ConfiguratorMenu.php';
|
||||
require_once __DIR__ . '/ScriptSettings.php';
|
||||
@ -172,7 +174,10 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$subMenuWidth = $menuWidth - $menuListWidth;
|
||||
$subMenuHeight = $menuHeight;
|
||||
|
||||
$manialinks = new ManiaLinks();
|
||||
|
||||
$manialink = new ManiaLink(self::MLID_MENU);
|
||||
$manialinks->add($manialink);
|
||||
|
||||
$frame = new Frame();
|
||||
$manialink->add($frame);
|
||||
@ -231,6 +236,14 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
||||
}
|
||||
$menus->add($menuRelationships);
|
||||
|
||||
// Add Close Quad (X)
|
||||
$closeQuad = new Quad_Icons64x64_1();
|
||||
$frame->add($closeQuad);
|
||||
$closeQuad->setPosition($menuWidth * 0.484, $menuHeight * 0.47, 3);
|
||||
$closeQuad->setSize(6, 6);
|
||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
||||
$closeQuad->setAction(self::ACTION_TOGGLEMENU);
|
||||
|
||||
// Add close button
|
||||
$closeButton = new Label();
|
||||
$frame->add($closeButton);
|
||||
@ -253,7 +266,7 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$saveButton->setText('Save');
|
||||
$saveButton->setAction(self::ACTION_SAVECONFIG);
|
||||
|
||||
$this->manialink = $manialink;
|
||||
$this->manialink = $manialinks;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,20 +80,20 @@ class ScriptSettings implements ConfiguratorMenu {
|
||||
// Pagers
|
||||
$pagerPrev = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerPrev);
|
||||
$pagerPrev->setPosition($width * 0.39, $height * -0.44);
|
||||
$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);
|
||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||
|
||||
$pageCountLabel = new Label();
|
||||
$frame->add($pageCountLabel);
|
||||
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||
$pageCountLabel->setPosition($width * 0.35, $height * -0.44);
|
||||
$pageCountLabel->setPosition($width * 0.35, $height * -0.44, 1);
|
||||
$pageCountLabel->setStyle('TextTitle1');
|
||||
$pageCountLabel->setTextSize(2);
|
||||
|
||||
|
@ -128,11 +128,17 @@ class ManiaLink implements Container {
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function render($echo = false, $domDocument = null) {
|
||||
if (!$domDocument) {
|
||||
$isChild = false;
|
||||
if ($domDocument) {
|
||||
$isChild = true;
|
||||
}
|
||||
if (!$isChild) {
|
||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
||||
}
|
||||
$manialink = $domDocument->createElement($this->tagName);
|
||||
$domDocument->appendChild($manialink);
|
||||
if (!$isChild) {
|
||||
$domDocument->appendChild($manialink);
|
||||
}
|
||||
if ($this->id) {
|
||||
$manialink->setAttribute('id', $this->id);
|
||||
}
|
||||
@ -157,6 +163,9 @@ class ManiaLink implements Container {
|
||||
$scriptXml = $this->script->render($domDocument);
|
||||
$manialink->appendChild($scriptXml);
|
||||
}
|
||||
if ($isChild) {
|
||||
return $manialink;
|
||||
}
|
||||
if ($echo) {
|
||||
header('Content-Type: application/xml');
|
||||
echo $domDocument->saveXML();
|
||||
|
@ -56,10 +56,11 @@ class ManiaLinks {
|
||||
*/
|
||||
public function render($echo = false) {
|
||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
||||
$manialink = $domDocument->createElement($this->tagName);
|
||||
$domDocument->appendChild($manialink);
|
||||
$manialinks = $domDocument->createElement($this->tagName);
|
||||
$domDocument->appendChild($manialinks);
|
||||
foreach ($this->children as $child) {
|
||||
$child->render(false, $domDocument);
|
||||
$childXml = $child->render(false, $domDocument);
|
||||
$manialinks->appendChild($childXml);
|
||||
}
|
||||
if ($echo) {
|
||||
header('Content-Type: application/xml');
|
||||
|
@ -97,8 +97,8 @@ class ManiaControl implements CommandListener {
|
||||
$this->playerManager = new PlayerManager($this);
|
||||
$this->authenticationManager = new AuthenticationManager($this);
|
||||
$this->mapManager = new MapManager($this);
|
||||
$this->pluginManager = new PluginManager($this);
|
||||
$this->configurator = new Configurator($this);
|
||||
$this->pluginManager = new PluginManager($this);
|
||||
|
||||
$this->commandManager->registerCommandListener('version', $this, 'command_Version');
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace ManiaControl\Plugins;
|
||||
|
||||
require_once __DIR__ . '/Plugin.php';
|
||||
require_once __DIR__ . '/PluginMenu.php';
|
||||
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
@ -21,6 +22,7 @@ class PluginManager {
|
||||
* Private properties
|
||||
*/
|
||||
private $maniaControl = null;
|
||||
private $pluginMenu = null;
|
||||
private $activePlugins = array();
|
||||
private $pluginClasses = array();
|
||||
|
||||
@ -32,6 +34,9 @@ class PluginManager {
|
||||
public function __construct(ManiaControl $maniaControl) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
$this->initTables();
|
||||
|
||||
$this->pluginMenu = new PluginMenu($maniaControl);
|
||||
$this->maniaControl->configurator->addMenu($this->pluginMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
57
application/core/Plugins/PluginMenu.php
Normal file
57
application/core/Plugins/PluginMenu.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Plugins;
|
||||
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Configurators\ConfiguratorMenu;
|
||||
use FML\Script\Pages;
|
||||
use FML\Script\Tooltips;
|
||||
use FML\Controls\Frame;
|
||||
|
||||
/**
|
||||
* Configurator for enabling and disabling plugins
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class PluginMenu implements ConfiguratorMenu {
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
private $maniaControl = null;
|
||||
|
||||
/**
|
||||
* Create a new plugin menu instance
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||
*/
|
||||
public function getTitle() {
|
||||
return "Plugins";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||
*/
|
||||
public function getMenu($width, $height, Pages $pages, Tooltips $tooltips) {
|
||||
$frame = new Frame();
|
||||
return $frame;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
||||
*/
|
||||
public function saveConfigData(array $configData, Player $player) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user