- Ingame configurator -> script settings
- fixed local records plugin - fixed systeminfo command - FML update
This commit is contained in:
parent
fed96b36d0
commit
4951829017
@ -8,12 +8,19 @@ use ManiaControl\Callbacks\CallbackManager;
|
|||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use FML\Controls\Quad;
|
use FML\Controls\Control;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Quads\Quad_UiSMSpectatorScoreBig;
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Quads\Quad_EnergyBar;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
use FML\Controls\Quad;
|
||||||
use FML\Controls\Quads\Quad_BgRaceScore2;
|
use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||||
|
use FML\Script\Menus;
|
||||||
|
use FML\Script\Pages;
|
||||||
|
use FML\Script\Script;
|
||||||
|
use FML\Script\Tooltips;
|
||||||
|
|
||||||
|
require_once __DIR__ . '/ConfiguratorMenu.php';
|
||||||
|
require_once __DIR__ . '/ScriptSettings.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class managing ingame ManiaControl configuration
|
* Class managing ingame ManiaControl configuration
|
||||||
@ -26,14 +33,22 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
*/
|
*/
|
||||||
const MLID_MENU = 'Configurator.Menu.MLID';
|
const MLID_MENU = 'Configurator.Menu.MLID';
|
||||||
const ACTION_TOGGLEMENU = 'Configurator.ToggleMenuAction';
|
const ACTION_TOGGLEMENU = 'Configurator.ToggleMenuAction';
|
||||||
|
const ACTION_SAVECONFIG = 'Configurator.SaveConfigAction';
|
||||||
|
const SETTING_MENU_POSX = 'Menu Widget Position: X';
|
||||||
|
const SETTING_MENU_POSY = 'Menu Widget Position: Y';
|
||||||
|
const SETTING_MENU_WIDTH = 'Menu Widget Width';
|
||||||
|
const SETTING_MENU_HEIGHT = 'Menu Widget Height';
|
||||||
|
const SETTING_MENU_STYLE = 'Menu Widget BackgroundQuad Style';
|
||||||
|
const SETTING_MENU_SUBSTYLE = 'Menu Widget BackgroundQuad Substyle';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
|
private $scriptSettings = null;
|
||||||
|
private $menus = array();
|
||||||
private $playersMenuShown = array();
|
private $playersMenuShown = array();
|
||||||
private $manialink = null;
|
private $manialink = null;
|
||||||
private $emptyManialink = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Configurator
|
* Create a new Configurator
|
||||||
@ -44,13 +59,37 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
$this->addAdminMenuItem();
|
$this->addAdminMenuItem();
|
||||||
|
|
||||||
|
// Init settings
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_POSX, 0.);
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_POSY, 0.);
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_WIDTH, 170.);
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_HEIGHT, 90.);
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_STYLE, Quad_BgRaceScore2::STYLE);
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_SUBSTYLE,
|
||||||
|
Quad_BgRaceScore2::SUBSTYLE_HandleSelectable);
|
||||||
|
|
||||||
// Register for page answers
|
// Register for page answers
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_TOGGLEMENU, $this,
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_TOGGLEMENU, $this,
|
||||||
'handleToggleMenuAction');
|
'handleToggleMenuAction');
|
||||||
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SAVECONFIG, $this,
|
||||||
|
'handleSaveConfigAction');
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this,
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this,
|
||||||
'handlePlayerDisconnect');
|
'handlePlayerDisconnect');
|
||||||
|
|
||||||
|
// Create script settings
|
||||||
|
$this->scriptSettings = new ScriptSettings($maniaControl);
|
||||||
|
$this->addMenu($this->scriptSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a configurator menu
|
||||||
|
*
|
||||||
|
* @param ConfiguratorMenu $menu
|
||||||
|
*/
|
||||||
|
public function addMenu(ConfiguratorMenu $menu) {
|
||||||
|
array_push($this->menus, $menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,6 +106,18 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
$this->showMenu($player);
|
$this->showMenu($player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the config data received from the manialink
|
||||||
|
*
|
||||||
|
* @param array $callback
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
public function handleSaveConfigAction(array $callback, Player $player) {
|
||||||
|
foreach ($this->menus as $menu) {
|
||||||
|
$menu->saveConfigData($callback[1], $player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle PlayerDisconnect callback
|
* Handle PlayerDisconnect callback
|
||||||
*
|
*
|
||||||
@ -74,9 +125,7 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
*/
|
*/
|
||||||
public function handlePlayerDisconnect(array $callback) {
|
public function handlePlayerDisconnect(array $callback) {
|
||||||
$login = $callback[1][0];
|
$login = $callback[1][0];
|
||||||
if (isset($this->playersMenuShown[$login])) {
|
unset($this->playersMenuShown[$login]);
|
||||||
unset($this->playersMenuShown[$login]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,8 +147,8 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
private function hideMenu(Player $player) {
|
private function hideMenu(Player $player) {
|
||||||
$this->buildManialink();
|
$emptyManialink = new ManiaLink(self::MLID_MENU);
|
||||||
$manialinkText = $this->emptyManialink->render()->saveXML();
|
$manialinkText = $emptyManialink->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
||||||
$this->maniaControl->manialinkManager->enableAltMenu($player);
|
$this->maniaControl->manialinkManager->enableAltMenu($player);
|
||||||
unset($this->playersMenuShown[$player->login]);
|
unset($this->playersMenuShown[$player->login]);
|
||||||
@ -111,19 +160,98 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
* @param bool $forceBuild
|
* @param bool $forceBuild
|
||||||
*/
|
*/
|
||||||
private function buildManialink($forceBuild = false) {
|
private function buildManialink($forceBuild = false) {
|
||||||
if (is_object($this->manialink) && !$forceBuild) return;
|
$menuPosX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSX);
|
||||||
|
$menuPosY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSY);
|
||||||
|
$menuWidth = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_WIDTH);
|
||||||
|
$menuHeight = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_HEIGHT);
|
||||||
|
$quadStyle = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_STYLE);
|
||||||
|
$quadSubstyle = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_SUBSTYLE);
|
||||||
|
|
||||||
$this->emptyManialink = new ManiaLink(self::MLID_MENU);
|
$menuListWidth = $menuWidth * 0.3;
|
||||||
|
$menuItemHeight = 10.;
|
||||||
|
$subMenuWidth = $menuWidth - $menuListWidth;
|
||||||
|
$subMenuHeight = $menuHeight;
|
||||||
|
|
||||||
$manialink = new ManiaLink(self::MLID_MENU);
|
$manialink = new ManiaLink(self::MLID_MENU);
|
||||||
|
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$manialink->add($frame);
|
$manialink->add($frame);
|
||||||
|
$frame->setPosition($menuPosX, $menuPosY);
|
||||||
|
|
||||||
$backgroundQuad = new Quad_BgRaceScore2();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
$backgroundQuad->setSize(100, 70);
|
$backgroundQuad->setSize($menuWidth, $menuHeight);
|
||||||
$backgroundQuad->setSubStyle($backgroundQuad::SUBSTYLE_HandleSelectable);
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
|
$menuItemsFrame = new Frame();
|
||||||
|
$frame->add($menuItemsFrame);
|
||||||
|
$menuItemsFrame->setX($menuWidth * -0.5 + $menuListWidth * 0.5);
|
||||||
|
|
||||||
|
$itemsBackgroundQuad = new Quad();
|
||||||
|
$menuItemsFrame->add($itemsBackgroundQuad);
|
||||||
|
$itemsBackgroundQuad->setSize($menuListWidth, $menuHeight);
|
||||||
|
$itemsBackgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
|
$menusFrame = new Frame();
|
||||||
|
$frame->add($menusFrame);
|
||||||
|
$menusFrame->setX($menuWidth * -0.5 + $menuListWidth + $subMenuWidth * 0.5);
|
||||||
|
|
||||||
|
// Create script and features
|
||||||
|
$script = new Script();
|
||||||
|
$manialink->setScript($script);
|
||||||
|
|
||||||
|
$pages = new Pages();
|
||||||
|
$script->addFeature($pages);
|
||||||
|
|
||||||
|
$tooltips = new Tooltips();
|
||||||
|
$script->addFeature($tooltips);
|
||||||
|
|
||||||
|
$menus = new Menus();
|
||||||
|
$script->addFeature($menus);
|
||||||
|
|
||||||
|
$menuRelationships = array();
|
||||||
|
$menuItemY = $menuHeight * 0.42;
|
||||||
|
foreach ($this->menus as $menu) {
|
||||||
|
// Add title
|
||||||
|
$menuItemLabel = new Label();
|
||||||
|
$menuItemsFrame->add($menuItemLabel);
|
||||||
|
$menuItemLabel->setY($menuItemY);
|
||||||
|
$menuItemLabel->setSize($menuListWidth * 0.9, $menuItemHeight * 0.9);
|
||||||
|
$menuItemLabel->setStyle(Label_Text::STYLE_TextCardRaceRank);
|
||||||
|
$menuItemLabel->setText($menu->getTitle());
|
||||||
|
|
||||||
|
// Add menu
|
||||||
|
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $pages, $tooltips);
|
||||||
|
$menusFrame->add($menuControl);
|
||||||
|
|
||||||
|
// Add menu relationship
|
||||||
|
array_push($menuRelationships, array($menuItemLabel, $menuControl));
|
||||||
|
|
||||||
|
$menuItemY -= $menuItemHeight * 1.1;
|
||||||
|
}
|
||||||
|
$menus->add($menuRelationships);
|
||||||
|
|
||||||
|
// Add close button
|
||||||
|
$closeButton = new Label();
|
||||||
|
$frame->add($closeButton);
|
||||||
|
$closeButton->setPosition($menuWidth * -0.5 + $menuListWidth * 0.29, $menuHeight * -0.43);
|
||||||
|
$closeButton->setSize($menuListWidth * 0.3, $menuListWidth * 0.1);
|
||||||
|
$closeButton->setStyle(Label_Text::STYLE_TextButtonNavBack);
|
||||||
|
$closeButton->setTextPrefix('$999');
|
||||||
|
$closeButton->setTranslate(true);
|
||||||
|
$closeButton->setText('Close');
|
||||||
|
$closeButton->setAction(self::ACTION_TOGGLEMENU);
|
||||||
|
|
||||||
|
// Add save button
|
||||||
|
$saveButton = new Label();
|
||||||
|
$frame->add($saveButton);
|
||||||
|
$saveButton->setPosition($menuWidth * -0.5 + $menuListWidth * 0.71, $menuHeight * -0.43);
|
||||||
|
$saveButton->setSize($menuListWidth * 0.3, $menuListWidth * 0.1);
|
||||||
|
$saveButton->setStyle(Label_Text::STYLE_TextButtonNavBack);
|
||||||
|
$saveButton->setTextPrefix('$0f5');
|
||||||
|
$saveButton->setTranslate(true);
|
||||||
|
$saveButton->setText('Save');
|
||||||
|
$saveButton->setAction(self::ACTION_SAVECONFIG);
|
||||||
|
|
||||||
$this->manialink = $manialink;
|
$this->manialink = $manialink;
|
||||||
}
|
}
|
||||||
|
43
application/core/Configurators/ConfiguratorMenu.php
Normal file
43
application/core/Configurators/ConfiguratorMenu.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ManiaControl\Configurators;
|
||||||
|
|
||||||
|
use FML\Script\Pages;
|
||||||
|
use FML\Script\Tooltips;
|
||||||
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for configurator menus
|
||||||
|
*
|
||||||
|
* @author steeffeen & kremsy
|
||||||
|
*/
|
||||||
|
interface ConfiguratorMenu {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the menu title
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTitle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the configurator menu
|
||||||
|
*
|
||||||
|
* @param float $width
|
||||||
|
* @param float $height
|
||||||
|
* @param Pages $pages
|
||||||
|
* @param Tooltips $tooltips
|
||||||
|
* @return \FML\Controls\Control
|
||||||
|
*/
|
||||||
|
public function getMenu($width, $height, Pages $pages, Tooltips $tooltips);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the config data
|
||||||
|
*
|
||||||
|
* @param array $configData
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
public function saveConfigData(array $configData, Player $player);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
174
application/core/Configurators/ScriptSettings.php
Normal file
174
application/core/Configurators/ScriptSettings.php
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ManiaControl\Configurators;
|
||||||
|
|
||||||
|
use ManiaControl\ManiaControl;
|
||||||
|
use FML\Controls\Frame;
|
||||||
|
use FML\Controls\Label;
|
||||||
|
use FML\Script\Pages;
|
||||||
|
use FML\Script\Tooltips;
|
||||||
|
use FML\Controls\Control;
|
||||||
|
use FML\Controls\Quad;
|
||||||
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
|
use FML\Controls\Labels\Label_Text;
|
||||||
|
use FML\Controls\Entry;
|
||||||
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class offering a configurator for current script settings
|
||||||
|
*
|
||||||
|
* @author steeffeen & kremsy
|
||||||
|
*/
|
||||||
|
class ScriptSettings implements ConfiguratorMenu {
|
||||||
|
/**
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
const NAME_PREFIX = 'Script.';
|
||||||
|
const SETTING_TITLE = 'Menu Title';
|
||||||
|
const SETTING_STYLE_SETTING = 'Setting Label Style';
|
||||||
|
const SETTING_STYLE_DESCRIPTION = 'Description Label Style';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private properties
|
||||||
|
*/
|
||||||
|
private $maniaControl = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new script settings instance
|
||||||
|
*
|
||||||
|
* @param ManiaControl $maniaControl
|
||||||
|
*/
|
||||||
|
public function __construct(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||||
|
*/
|
||||||
|
public function getTitle() {
|
||||||
|
return $this->maniaControl->settingManager->getSetting($this, self::SETTING_TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||||
|
*/
|
||||||
|
public function getMenu($width, $height, Pages $pages, Tooltips $tooltips) {
|
||||||
|
$frame = new Frame();
|
||||||
|
|
||||||
|
$this->maniaControl->client->query('GetModeScriptInfo');
|
||||||
|
$scriptInfo = $this->maniaControl->client->getResponse();
|
||||||
|
$scriptParams = $scriptInfo['ParamDescs'];
|
||||||
|
|
||||||
|
$this->maniaControl->client->query('GetModeScriptSettings');
|
||||||
|
$scriptSettings = $this->maniaControl->client->getResponse();
|
||||||
|
|
||||||
|
// Config
|
||||||
|
$labelStyleSetting = $this->maniaControl->settingManager->getSetting($this, self::SETTING_STYLE_SETTING);
|
||||||
|
$labelStyleDescription = $this->maniaControl->settingManager->getSetting($this, self::SETTING_STYLE_DESCRIPTION);
|
||||||
|
$pagerSize = 9.;
|
||||||
|
$settingHeight = 5.;
|
||||||
|
$labelTextSize = 2;
|
||||||
|
$pageMaxCount = 15;
|
||||||
|
|
||||||
|
// Pagers
|
||||||
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
|
$frame->add($pagerPrev);
|
||||||
|
$pagerPrev->setPosition($width * 0.39, $height * -0.44);
|
||||||
|
$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->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->setStyle('TextTitle1');
|
||||||
|
$pageCountLabel->setTextSize(2);
|
||||||
|
|
||||||
|
// Setting pages
|
||||||
|
$pageFrames = array();
|
||||||
|
foreach ($scriptParams as $index => $scriptParam) {
|
||||||
|
$settingName = $scriptParam['Name'];
|
||||||
|
if (!isset($scriptSettings[$settingName])) continue;
|
||||||
|
|
||||||
|
if (!isset($pageFrame)) {
|
||||||
|
$pageFrame = new Frame();
|
||||||
|
$frame->add($pageFrame);
|
||||||
|
array_push($pageFrames, $pageFrame);
|
||||||
|
$y = $height * 0.43;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nameLabel = new Label();
|
||||||
|
$pageFrame->add($nameLabel);
|
||||||
|
$nameLabel->setHAlign(Control::LEFT);
|
||||||
|
$nameLabel->setPosition($width * -0.46, $y);
|
||||||
|
$nameLabel->setSize($width * 0.4, $settingHeight);
|
||||||
|
$nameLabel->setStyle($labelStyleSetting);
|
||||||
|
$nameLabel->setTextSize($labelTextSize);
|
||||||
|
$nameLabel->setText($settingName);
|
||||||
|
|
||||||
|
$decriptionLabel = new Label();
|
||||||
|
$pageFrame->add($decriptionLabel);
|
||||||
|
$decriptionLabel->setHAlign(Control::LEFT);
|
||||||
|
$decriptionLabel->setPosition($width * -0.45, $height * -0.44);
|
||||||
|
$decriptionLabel->setSize($width * 0.7, $settingHeight);
|
||||||
|
$decriptionLabel->setStyle($labelStyleDescription);
|
||||||
|
$decriptionLabel->setTranslate(true);
|
||||||
|
$decriptionLabel->setTextPrefix('Desc: ');
|
||||||
|
$decriptionLabel->setText($scriptParam['Desc']);
|
||||||
|
$tooltips->add($nameLabel, $decriptionLabel);
|
||||||
|
|
||||||
|
$entry = new Entry();
|
||||||
|
$pageFrame->add($entry);
|
||||||
|
$entry->setHAlign(Control::RIGHT);
|
||||||
|
$entry->setPosition($width * 0.46, $y);
|
||||||
|
$entry->setSize($width * 0.45, $settingHeight);
|
||||||
|
$entry->setName(self::NAME_PREFIX . $settingName);
|
||||||
|
$settingValue = $scriptSettings[$settingName];
|
||||||
|
if ($settingValue === false) {
|
||||||
|
$settingValue = 0;
|
||||||
|
}
|
||||||
|
$entry->setDefault($settingValue);
|
||||||
|
|
||||||
|
$y -= $settingHeight;
|
||||||
|
if ($index % $pageMaxCount == $pageMaxCount - 1) {
|
||||||
|
unset($pageFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
|
||||||
|
|
||||||
|
return $frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
||||||
|
*/
|
||||||
|
public function saveConfigData(array $configData, Player $player) {
|
||||||
|
$this->maniaControl->client->query('GetModeScriptSettings');
|
||||||
|
$scriptSettings = $this->maniaControl->client->getResponse();
|
||||||
|
// var_dump($configData);
|
||||||
|
// var_dump($scriptSettings);
|
||||||
|
$prefixLength = strlen(self::NAME_PREFIX);
|
||||||
|
foreach ($configData[3] as $dataName => $dataValue) {
|
||||||
|
if (substr($dataName, 0, $prefixLength) != self::NAME_PREFIX) continue;
|
||||||
|
|
||||||
|
$settingName = substr($dataName, $prefixLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
|
use FML\Types\NewLineable;
|
||||||
|
use FML\Types\Scriptable;
|
||||||
|
use FML\Types\Styleable;
|
||||||
|
use FML\Types\TextFormatable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing CMlEntry
|
* Class representing CMlEntry
|
||||||
*
|
*
|
||||||
@ -13,6 +18,13 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
*/
|
*/
|
||||||
protected $name = '';
|
protected $name = '';
|
||||||
protected $default = null;
|
protected $default = null;
|
||||||
|
protected $autoNewLine = 0;
|
||||||
|
protected $scriptEvents = 0;
|
||||||
|
protected $style = '';
|
||||||
|
protected $textColor = '';
|
||||||
|
protected $textSize = -1;
|
||||||
|
protected $areaColor = '';
|
||||||
|
protected $areaFocusColor = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new entry control
|
* Construct a new entry control
|
||||||
@ -46,6 +58,76 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\NewLineable::setAutoNewLine()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setAutoNewLine($autoNewLine) {
|
||||||
|
$this->autoNewLine = ($autoNewLine ? 1 : 0);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setScriptEvents($scriptEvents) {
|
||||||
|
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\Styleable::setStyle()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setStyle($style) {
|
||||||
|
$this->style = $style;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\TextFormatable::setTextColor()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setTextColor($textColor) {
|
||||||
|
$this->textColor = $textColor;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\TextFormatable::setTextSize()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setTextSize($textSize) {
|
||||||
|
$this->textSize = $textSize;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\TextFormatable::setAreaColor()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setAreaColor($areaColor) {
|
||||||
|
$this->areaColor = $areaFocusColor;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
||||||
|
* @return \FML\Controls\Entry
|
||||||
|
*/
|
||||||
|
public function setAreaFocusColor($areaFocusColor) {
|
||||||
|
$this->areaFocusColor = $areaFocusColor;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see \FML\Control::render()
|
* @see \FML\Control::render()
|
||||||
@ -58,6 +140,27 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
if ($this->default !== null) {
|
if ($this->default !== null) {
|
||||||
$xml->setAttribute('default', $this->default);
|
$xml->setAttribute('default', $this->default);
|
||||||
}
|
}
|
||||||
|
if ($this->autoNewLine) {
|
||||||
|
$xml->setAttribute('autonewline', $this->autoNewLine);
|
||||||
|
}
|
||||||
|
if ($this->scriptEvents) {
|
||||||
|
$xml->setAttribute('scriptevents', $this->scriptEvents);
|
||||||
|
}
|
||||||
|
if ($this->style) {
|
||||||
|
$xml->setAttribute('style', $this->style);
|
||||||
|
}
|
||||||
|
if ($this->textColor) {
|
||||||
|
$xml->setAttribute('textcolor', $this->textColor);
|
||||||
|
}
|
||||||
|
if ($this->textSize >= 0.) {
|
||||||
|
$xml->setAttribute('textsize', $this->textSize);
|
||||||
|
}
|
||||||
|
if ($this->areaColor) {
|
||||||
|
$xml->setAttribute('areacolor', $this->areaColor);
|
||||||
|
}
|
||||||
|
if ($this->areaFocusColor) {
|
||||||
|
$xml->setAttribute('areafocuscolor', $this->areaFocusColor);
|
||||||
|
}
|
||||||
return $xml;
|
return $xml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ class Label_Button extends Label {
|
|||||||
const STYLE_CardButtonSmall = 'CardButtonSmall';
|
const STYLE_CardButtonSmall = 'CardButtonSmall';
|
||||||
const STYLE_CardButtonSmallL = 'CardButtonSmallL';
|
const STYLE_CardButtonSmallL = 'CardButtonSmallL';
|
||||||
const STYLE_CardButtonSmallS = 'CardButtonSmallS';
|
const STYLE_CardButtonSmallS = 'CardButtonSmallS';
|
||||||
const STYLE_CardButtonSmallS = 'CardButtonSmallS';
|
|
||||||
const STYLE_CardButtonSmallWide = 'CardButtonSmallWide';
|
const STYLE_CardButtonSmallWide = 'CardButtonSmallWide';
|
||||||
const STYLE_CardButtonSmallXL = 'CardButtonSmallXL';
|
const STYLE_CardButtonSmallXL = 'CardButtonSmallXL';
|
||||||
const STYLE_CardButtonSmallXS = 'CardButtonSmallXS';
|
const STYLE_CardButtonSmallXS = 'CardButtonSmallXS';
|
||||||
|
@ -80,7 +80,7 @@ class ServerCommands implements CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
$systemInfo = $this->maniaControl->server->getSystemInfo();
|
$systemInfo = $this->maniaControl->server->getSystemInfo();
|
||||||
$message = 'SystemInfo: ip=' . $systemInfo['PublishedIp'] . ', port=' . $systemInfo['Port'] . ', p2pPort=' .
|
$message = 'SystemInfo: ip=' . $systemInfo['PublishedIp'] . ', port=' . $systemInfo['Port'] . ', p2pPort=' .
|
||||||
$systemInfo['P2PPort'] . ', title=' . $systemInfo['TitleId'] . ', login=' . $systemInfo['ServerLogin'] . ', ';
|
$systemInfo['P2PPort'] . ', title=' . $systemInfo['TitleId'] . ', login=' . $systemInfo['ServerLogin'] . '.';
|
||||||
return $this->maniaControl->chat->sendInformation($message, $player->login);
|
return $this->maniaControl->chat->sendInformation($message, $player->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,13 +279,13 @@ class LocalRecordsPlugin extends Plugin implements CallbackListener {
|
|||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$recordFrame->add($backgroundQuad);
|
$recordFrame->add($backgroundQuad);
|
||||||
$backgroundQuad->setSize($width, $lineHeight);
|
$backgroundQuad->setSize($width * 1.03, $lineHeight * 1.25);
|
||||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
$rankLabel = new Label();
|
$rankLabel = new Label();
|
||||||
$recordFrame->add($rankLabel);
|
$recordFrame->add($rankLabel);
|
||||||
$rankLabel->setHAlign(Control::LEFT);
|
$rankLabel->setHAlign(Control::LEFT);
|
||||||
$rankLabel->setPosition($width * -0.47);
|
$rankLabel->setX($width * -0.47);
|
||||||
$rankLabel->setSize($width * 0.06, $lineHeight);
|
$rankLabel->setSize($width * 0.06, $lineHeight);
|
||||||
$rankLabel->setTextSize(1);
|
$rankLabel->setTextSize(1);
|
||||||
$rankLabel->setTextPrefix('$o');
|
$rankLabel->setTextPrefix('$o');
|
||||||
@ -294,7 +294,7 @@ class LocalRecordsPlugin extends Plugin implements CallbackListener {
|
|||||||
$nameLabel = new Label();
|
$nameLabel = new Label();
|
||||||
$recordFrame->add($nameLabel);
|
$recordFrame->add($nameLabel);
|
||||||
$nameLabel->setHAlign(Control::LEFT);
|
$nameLabel->setHAlign(Control::LEFT);
|
||||||
$nameLabel->setPosition($width * -0.4);
|
$nameLabel->setX($width * -0.4);
|
||||||
$nameLabel->setSize($width * 0.6, $lineHeight);
|
$nameLabel->setSize($width * 0.6, $lineHeight);
|
||||||
$nameLabel->setTextSize(1);
|
$nameLabel->setTextSize(1);
|
||||||
$nameLabel->setText($record->nickname);
|
$nameLabel->setText($record->nickname);
|
||||||
@ -302,7 +302,7 @@ class LocalRecordsPlugin extends Plugin implements CallbackListener {
|
|||||||
$timeLabel = new Label();
|
$timeLabel = new Label();
|
||||||
$recordFrame->add($timeLabel);
|
$recordFrame->add($timeLabel);
|
||||||
$timeLabel->setHAlign(Control::RIGHT);
|
$timeLabel->setHAlign(Control::RIGHT);
|
||||||
$timeLabel->setPosition($width * 0.47);
|
$timeLabel->setX($width * 0.47);
|
||||||
$timeLabel->setSize($width * 0.25, $lineHeight);
|
$timeLabel->setSize($width * 0.25, $lineHeight);
|
||||||
$timeLabel->setTextSize(1);
|
$timeLabel->setTextSize(1);
|
||||||
$timeLabel->setText(Formatter::formatTime($record->time));
|
$timeLabel->setText(Formatter::formatTime($record->time));
|
||||||
|
Loading…
Reference in New Issue
Block a user