Updated to ManiaLink v3
This commit is contained in:
@ -10,79 +10,184 @@ use FML\Types\Scriptable;
|
||||
* (CMlFrame)
|
||||
*
|
||||
* @author steeffeen <mail@steeffeen.com>
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class Frame3d extends Frame implements Scriptable {
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
const STYLE_BaseStation = 'BaseStation';
|
||||
const STYLE_BaseBoxCase = 'BaseBoxCase';
|
||||
const STYLE_Titlelogo = 'Titlelogo';
|
||||
const STYLE_ButtonBack = 'ButtonBack';
|
||||
const STYLE_ButtonNav = 'ButtonNav';
|
||||
const STYLE_ButtonH = 'ButtonH';
|
||||
const STYLE_Station3x3 = 'Station3x3';
|
||||
const STYLE_Title = 'Title';
|
||||
const STYLE_TitleEditor = 'TitleEditor';
|
||||
const STYLE_Window = 'Window';
|
||||
class Frame3d extends Frame implements Scriptable
|
||||
{
|
||||
|
||||
/*
|
||||
* Protected properties
|
||||
*/
|
||||
protected $tagName = 'frame3d';
|
||||
protected $style3dId = null;
|
||||
/** @var Style3d $style3d */
|
||||
protected $style3d = null;
|
||||
protected $scriptEvents = null;
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
const STYLE_BaseStation = 'BaseStation';
|
||||
const STYLE_BaseBoxCase = 'BaseBoxCase';
|
||||
const STYLE_TitleLogo = 'Titlelogo';
|
||||
const STYLE_ButtonBack = 'ButtonBack';
|
||||
const STYLE_ButtonNav = 'ButtonNav';
|
||||
const STYLE_ButtonH = 'ButtonH';
|
||||
const STYLE_Station3x3 = 'Station3x3';
|
||||
const STYLE_Title = 'Title';
|
||||
const STYLE_TitleEditor = 'TitleEditor';
|
||||
const STYLE_Window = 'Window';
|
||||
|
||||
/**
|
||||
* Set Style3d id
|
||||
*
|
||||
* @param string $style3dId Style3d id
|
||||
* @return static
|
||||
*/
|
||||
public function setStyle3dId($style3dId) {
|
||||
$this->style3dId = (string)$style3dId;
|
||||
$this->style3d = null;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @var string $style3dId Style3d id
|
||||
*/
|
||||
protected $style3dId = null;
|
||||
|
||||
/**
|
||||
* Set Style3d
|
||||
*
|
||||
* @param Style3d $style3d Style3d object
|
||||
* @return static
|
||||
*/
|
||||
public function setStyle3d(Style3d $style3d) {
|
||||
$this->style3d = $style3d;
|
||||
$this->style3dId = null;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @var Style3d $style3d Style3d
|
||||
*/
|
||||
protected $style3d = null;
|
||||
|
||||
/**
|
||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||
*/
|
||||
public function setScriptEvents($scriptEvents) {
|
||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @var bool $scriptEvents Script events usage
|
||||
*/
|
||||
protected $scriptEvents = null;
|
||||
|
||||
/**
|
||||
* @var string[] $scriptActionParameters Script action parameters
|
||||
*/
|
||||
protected $scriptActionParameters = null;
|
||||
|
||||
/**
|
||||
* @var string $scriptAction Script action
|
||||
*/
|
||||
protected $scriptAction = null;
|
||||
|
||||
/**
|
||||
* Get the Style3d id
|
||||
*
|
||||
* @api
|
||||
* @return string
|
||||
*/
|
||||
public function getStyle3dId()
|
||||
{
|
||||
return $this->style3dId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Style3d id
|
||||
*
|
||||
* @api
|
||||
* @param string $style3dId Style3d id
|
||||
* @return static
|
||||
*/
|
||||
public function setStyle3dId($style3dId)
|
||||
{
|
||||
$this->style3dId = (string)$style3dId;
|
||||
$this->style3d = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Style3d
|
||||
*
|
||||
* @api
|
||||
* @return Style3d
|
||||
*/
|
||||
public function getStyle3d()
|
||||
{
|
||||
return $this->style3d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Style3d
|
||||
*
|
||||
* @api
|
||||
* @param Style3d $style3d Style3d
|
||||
* @return static
|
||||
*/
|
||||
public function setStyle3d(Style3d $style3d)
|
||||
{
|
||||
$this->style3dId = null;
|
||||
$this->style3d = $style3d;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Scriptable::getScriptEvents()
|
||||
*/
|
||||
public function getScriptEvents()
|
||||
{
|
||||
return $this->scriptEvents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Scriptable::setScriptEvents()
|
||||
*/
|
||||
public function setScriptEvents($scriptEvents)
|
||||
{
|
||||
$this->scriptEvents = (bool)$scriptEvents;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Scriptable::getScriptAction()
|
||||
*/
|
||||
public function getScriptAction()
|
||||
{
|
||||
return $this->scriptAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Scriptable::getScriptActionParameters()
|
||||
*/
|
||||
public function getScriptActionParameters()
|
||||
{
|
||||
return $this->scriptActionParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Control::getTagName()
|
||||
*/
|
||||
public function getTagName()
|
||||
{
|
||||
return "frame3d";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument)
|
||||
{
|
||||
$domElement = parent::render($domDocument);
|
||||
if ($this->style3d) {
|
||||
$this->style3d->checkId();
|
||||
$domElement->setAttribute("style3d", $this->style3d->getId());
|
||||
} else if ($this->style3dId) {
|
||||
$domElement->setAttribute("style3d", $this->style3dId);
|
||||
}
|
||||
if ($this->scriptEvents) {
|
||||
$domElement->setAttribute("scriptevents", 1);
|
||||
}
|
||||
if ($this->scriptAction) {
|
||||
$scriptAction = array($this->scriptAction);
|
||||
if ($this->scriptActionParameters) {
|
||||
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
|
||||
}
|
||||
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
|
||||
}
|
||||
return $domElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \FML\Types\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xmlElement = parent::render($domDocument);
|
||||
if ($this->style3d) {
|
||||
$this->style3d->checkId();
|
||||
$xmlElement->setAttribute('style3d', $this->style3d->getId());
|
||||
} else if ($this->style3dId) {
|
||||
$xmlElement->setAttribute('style3d', $this->style3dId);
|
||||
}
|
||||
if ($this->scriptEvents) {
|
||||
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
|
||||
}
|
||||
return $xmlElement;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user