FML Update
This commit is contained in:
parent
c935cf9cac
commit
ac1ea81b94
@ -146,9 +146,6 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xmlElement = parent::render($domDocument);
|
||||
if (false) {
|
||||
$xmlElement->setAttribute('action', 'TestAction');
|
||||
}
|
||||
if ($this->name) {
|
||||
$xmlElement->setAttribute('name', $this->name);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class ManiaLink {
|
||||
/**
|
||||
* Create a new ManiaLink Object
|
||||
*
|
||||
* @param string $id (optional) Manialink Id
|
||||
* @param string $id (optional) ManiaLink Id
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public static function create($id = null) {
|
||||
@ -50,7 +50,7 @@ class ManiaLink {
|
||||
/**
|
||||
* Construct a new ManiaLink Object
|
||||
*
|
||||
* @param string $id (optional) Manialink Id
|
||||
* @param string $id (optional) ManiaLink Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
if ($id !== null) {
|
||||
@ -70,9 +70,9 @@ class ManiaLink {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Manialink Id
|
||||
* Set ManiaLink Id
|
||||
*
|
||||
* @param string $id Manialink Id
|
||||
* @param string $id ManiaLink Id
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public function setId($id) {
|
||||
@ -80,6 +80,15 @@ class ManiaLink {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ManiaLink Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Background
|
||||
*
|
||||
|
@ -44,9 +44,9 @@ class ManiaLinks {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Child Manialink
|
||||
* Add a Child ManiaLink
|
||||
*
|
||||
* @param ManiaLink $child Child Manialink
|
||||
* @param ManiaLink $child Child ManiaLink
|
||||
* @return \FML\ManiaLinks
|
||||
*/
|
||||
public function add(ManiaLink $child) {
|
||||
@ -57,7 +57,7 @@ class ManiaLinks {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all Child Manialinks
|
||||
* Remove all Child ManiaLinks
|
||||
*
|
||||
* @return \FML\ManiaLinks
|
||||
*/
|
||||
|
@ -47,4 +47,18 @@ abstract class Builder {
|
||||
if (!fmod($value, 1)) $stringVal .= '.';
|
||||
return $stringVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Boolean String-Representation of the given Value
|
||||
*
|
||||
* @param bool $value The Value to convert to a ManiaScript Boolean
|
||||
* @return string
|
||||
*/
|
||||
public static function getBoolean($value) {
|
||||
$bool = (bool) $value;
|
||||
if ($bool) {
|
||||
return "True";
|
||||
}
|
||||
return "False";
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ main() {
|
||||
declare FML_ScriptStart = Now;
|
||||
+++OnInit+++
|
||||
declare FML_LoopCounter = 0;
|
||||
declare FML_LastTick = 0;
|
||||
while (True) {
|
||||
yield;
|
||||
foreach (Event in PendingEvents) {
|
||||
@ -24,7 +25,10 @@ main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
+++Loop+++
|
||||
FML_LoopCounter += 1;
|
||||
+++Loop+++
|
||||
if (FML_LastTick + 250 > Now) continue;
|
||||
FML_LastTick = Now;
|
||||
+++Tick+++
|
||||
}
|
||||
}
|
@ -28,14 +28,17 @@ class Script {
|
||||
const CLASS_TOGGLE = 'FML_Toggle';
|
||||
const CLASS_SPECTATE = 'FML_Spectate';
|
||||
const CLASS_PAGEACTION = 'FML_PageAction';
|
||||
const CLASS_TIME = 'FML_Time';
|
||||
const OPTION_TOOLTIP_STAYONCLICK = 'FML_StayOnClick_Tooltip';
|
||||
const OPTION_TOOLTIP_INVERT = 'FML_Invert_Tooltip';
|
||||
const OPTION_TOOLTIP_TEXT = 'FML_Text_Tooltip';
|
||||
const OPTION_TOGGLE_SHOW = 'FML_Show_Toggle';
|
||||
const OPTION_TOGGLE_HIDE = 'FML_Hide_Toggle';
|
||||
const OPTION_PROFILE_OWN = 'FML_Own_Profile';
|
||||
const OPTION_TIME_FULLDATE = 'FML_FullDate_Time';
|
||||
const LABEL_ONINIT = 'OnInit';
|
||||
const LABEL_LOOP = 'Loop';
|
||||
const LABEL_TICK = 'Tick';
|
||||
const LABEL_ENTRYSUBMIT = 'EntrySubmit';
|
||||
const LABEL_KEYPRESS = 'KeyPress';
|
||||
const LABEL_MOUSECLICK = 'MouseClick';
|
||||
@ -63,6 +66,7 @@ class Script {
|
||||
protected $toggles = false;
|
||||
protected $spectate = false;
|
||||
protected $pageActions = false;
|
||||
protected $times = false;
|
||||
|
||||
/**
|
||||
* Create a new Script Object
|
||||
@ -365,6 +369,7 @@ class Script {
|
||||
*
|
||||
* @param Control $actionControl The Control triggering the Action
|
||||
* @param string $action (optional) The Action to trigger (if empty the Action of the Control will be triggered)
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addPageActionTrigger(Control $actionControl, $action = null) {
|
||||
if (!($actionControl instanceof Scriptable)) {
|
||||
@ -387,6 +392,22 @@ class Script {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Label showing the current Time
|
||||
*
|
||||
* @param Label $timeLabel The Label showing the current Time
|
||||
* @param bool $showFullDate Whether to show the full Date Text
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addTimeLabel(Label $timeLabel, $showFullDate = false) {
|
||||
$timeLabel->addClass(self::CLASS_TIME);
|
||||
if ($showFullDate) {
|
||||
$timeLabel->addClass(self::OPTION_TIME_FULLDATE);
|
||||
}
|
||||
$this->times = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Script XML Tag
|
||||
*
|
||||
@ -553,6 +574,7 @@ Text " . self::FUNCTION_GETTOOLTIPCONTROLID . "(Text _ControlClass) {
|
||||
$labelsText .= $this->getSoundLabels();
|
||||
$labelsText .= $this->getToggleLabels();
|
||||
$labelsText .= $this->getSpectateLabels();
|
||||
$labelsText .= $this->getTimeLabels();
|
||||
return $labelsText;
|
||||
}
|
||||
|
||||
@ -898,6 +920,29 @@ if (Event.Control.HasClass(\"" . self::CLASS_PAGEACTION . "\")) {
|
||||
return $pageActionScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Time Labels
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getTimeLabels() {
|
||||
if (!$this->times) return '';
|
||||
$this->setInclude('TextLib', 'TextLib');
|
||||
$timesScript = "
|
||||
Page.GetClassChildren(\"" . self::CLASS_TIME . "\", Page.MainFrame, True);
|
||||
foreach (TimeLabelControl in Page.GetClassChildren_Result) {
|
||||
declare TimeLabel = (TimeLabelControl as CMlLabel);
|
||||
declare ShowFullDate = TimeLabel.HasClass(\"" . self::OPTION_TIME_FULLDATE . "\");
|
||||
if (ShowFullDate) {
|
||||
TimeLabel.Value = CurrentLocalDateText;
|
||||
} else {
|
||||
TimeLabel.Value = TextLib::SubText(CurrentLocalDateText, 11, 8);
|
||||
}
|
||||
}";
|
||||
$timesScript = Builder::getLabelImplementationBlock(self::LABEL_TICK, $timesScript);
|
||||
return $timesScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Main Function
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user