FML Improvements
This commit is contained in:
@ -67,30 +67,6 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Control Id
|
||||
*
|
||||
* @param bool $escaped (optional) Whether the Id should be escaped for ManiaScript
|
||||
* @return string
|
||||
*/
|
||||
public function getId($escaped = false) {
|
||||
if ($escaped) {
|
||||
return Builder::escapeText($this->id);
|
||||
}
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Id
|
||||
*
|
||||
* @param string $id Control Id
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->id = (string)$id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Id for dangerous Characters and assign a unique Id if necessary
|
||||
*
|
||||
@ -121,6 +97,47 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Control Id
|
||||
*
|
||||
* @param bool $escaped (optional) Whether the Id should be escaped for ManiaScript
|
||||
* @return string
|
||||
*/
|
||||
public function getId($escaped = false) {
|
||||
if ($escaped) {
|
||||
return Builder::escapeText($this->id);
|
||||
}
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Id
|
||||
*
|
||||
* @param string $id Control Id
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->id = (string)$id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Position
|
||||
*
|
||||
* @param float $x Horizontal Position
|
||||
* @param float $y Vertical Position
|
||||
* @param float $z (optional) Depth
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setPosition($x, $y, $z = null) {
|
||||
$this->setX($x);
|
||||
$this->setY($y);
|
||||
if ($z !== null) {
|
||||
$this->setZ($z);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set X Position
|
||||
*
|
||||
@ -155,19 +172,15 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Position
|
||||
* Set Control Size
|
||||
*
|
||||
* @param float $x Horizontal Position
|
||||
* @param float $y Vertical Position
|
||||
* @param float $z (optional) Depth
|
||||
* @param float $width Control Width
|
||||
* @param float $height Control Height
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setPosition($x, $y, $z = null) {
|
||||
$this->setX($x);
|
||||
$this->setY($y);
|
||||
if ($z !== null) {
|
||||
$this->setZ($z);
|
||||
}
|
||||
public function setSize($width, $height) {
|
||||
$this->setWidth($width);
|
||||
$this->setHeight($height);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -194,15 +207,25 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Size
|
||||
* Center Alignment
|
||||
*
|
||||
* @param float $width Control Width
|
||||
* @param float $height Control Height
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setSize($width, $height) {
|
||||
$this->setWidth($width);
|
||||
$this->setHeight($height);
|
||||
public function centerAlign() {
|
||||
$this->setAlign(self::CENTER, self::CENTER2);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Horizontal and Vertical Alignment
|
||||
*
|
||||
* @param string $hAlign Horizontal Alignment
|
||||
* @param string $vAlign Vertical Alignment
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setAlign($hAlign, $vAlign) {
|
||||
$this->setHAlign($hAlign);
|
||||
$this->setVAlign($vAlign);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -228,29 +251,6 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Horizontal and Vertical Alignment
|
||||
*
|
||||
* @param string $hAlign Horizontal Alignment
|
||||
* @param string $vAlign Vertical Alignment
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setAlign($hAlign, $vAlign) {
|
||||
$this->setHAlign($hAlign);
|
||||
$this->setVAlign($vAlign);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Center Alignment
|
||||
*
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function centerAlign() {
|
||||
$this->setAlign(self::CENTER, self::CENTER2);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Alignment
|
||||
*
|
||||
@ -310,6 +310,17 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Script Feature
|
||||
*
|
||||
* @param ScriptFeature $scriptFeature Script Feature
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addScriptFeature(ScriptFeature $scriptFeature) {
|
||||
array_push($this->scriptFeatures, $scriptFeature);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dynamic Feature opening the current Map Info
|
||||
*
|
||||
@ -398,26 +409,14 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
*
|
||||
* @param string $scriptText Script Text
|
||||
* @param string $label (optional) Script Label Name
|
||||
* @param bool $isolated (optional) Whether to isolate the Script Text
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addScriptText($scriptText, $label = ScriptLabel::MOUSECLICK, $isolated = true) {
|
||||
$customText = new ControlScript($this, $scriptText, $label, $isolated);
|
||||
public function addScriptText($scriptText, $label = ScriptLabel::MOUSECLICK) {
|
||||
$customText = new ControlScript($this, $scriptText, $label);
|
||||
$this->addScriptFeature($customText);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Script Feature
|
||||
*
|
||||
* @param ScriptFeature $scriptFeature Script Feature
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addScriptFeature(ScriptFeature $scriptFeature) {
|
||||
array_push($this->scriptFeatures, $scriptFeature);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all Script Features
|
||||
*
|
||||
@ -467,4 +466,11 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
}
|
||||
return $xmlElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ManiaScript Class of the Control
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public abstract function getManiaScriptClass();
|
||||
}
|
||||
|
Reference in New Issue
Block a user