change the script method

This commit is contained in:
Beu 2022-03-04 18:51:08 +01:00
parent b88bddb76b
commit 8197e3e307

View File

@ -8,9 +8,9 @@ use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons128x128_1; use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\Controls\Quads\Quad_Icons128x32_1; use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Elements\SimpleScript;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Script; use FML\Script\Script;
use FML\Script\ScriptLabel;
use FML\XmlRpc\TMUIProperties; use FML\XmlRpc\TMUIProperties;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
@ -281,15 +281,15 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$label->setTextSize(1); $label->setTextSize(1);
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_NICKNAME)) { if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_NICKNAME)) {
$nicknameScript = array( $script->appendGenericScriptLabel(ScriptLabel::ONINIT, '
'declare CMlLabel Author_Label <=> (Page.GetFirstChild("author_label") as CMlLabel);', declare CMlLabel Author_Label = (Page.GetFirstChild("author_label") as CMlLabel);
'if (Map != Null) {', declare Ident Last_MapId;
' Author_Label.SetText(Map.AuthorNickName);', ');
'}' $script->appendGenericScriptLabel(ScriptLabel::TICK, '
); if (Map != Null && Last_MapId != Map.Id) {
$simpleScript = new SimpleScript(); Author_Label.Value = Map.AuthorNickName;
$simpleScript->setText(implode(PHP_EOL, $nicknameScript)); }
$frame->addChild($simpleScript); ');
} else { } else {
$label->setText($map->authorLogin); $label->setText($map->authorLogin);
$label->setTextColor('fff'); $label->setTextColor('fff');