protected function onDraw() { $this->posZ = 5; $countdown = (int) $this->time; \ManiaLive\Gui\Manialinks::appendScript(<<<MANIASCRIPT #RequireContext CMlScript #Include "MathLib" as MathLib #Include "TextLib" as TextLib main() { \tdeclare Integer countdownTime = CurrentTime; \tdeclare Integer countdownTimeLeft = {$countdown}; \tdeclare Boolean waiting = False; \tdeclare CMlLabel label <=> (Page.MainFrame.GetFirstChild("info-label") as CMlLabel); \tdeclare CMlLabel label2 <=> (Page.MainFrame.GetFirstChild("transfer-label") as CMlLabel); \tdeclare CMlLabel label3 <=> (Page.MainFrame.GetFirstChild("cancel-label") as CMlLabel); \tdeclare Text labelText = label.Value; \tlabel.SetText(TextLib::Compose(labelText, TextLib::ToText(countdownTimeLeft))); \tlabel2.Hide(); \tlabel3.Hide(); \twhile(True) \t{ \t\tif(countdownTimeLeft > 0 && CurrentTime - countdownTime > 1000) \t\t{ \t\t\tcountdownTime = CurrentTime; \t\t\tcountdownTimeLeft = countdownTimeLeft - 1; \t\t\tlabel.SetText(TextLib::Compose(labelText, TextLib::ToText(countdownTimeLeft))); \t\t} \t\telse if(countdownTimeLeft <= 0) \t\t{ \t\t\tlabel2.Show(); \t\t\tlabel.Hide(); \t\t\twaiting = True; \t\t} \t\tyield; \t} } MANIASCRIPT ); \ManiaLive\Gui\Manialinks::appendXML(\ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance()->getManialink(array('text' => 'launchMatch', 'transferText' => 'transfer', 'cancel' => 'cancel'))); }
function onDraw() { $this->posZ = 3; $bullet = ' $<$ff0$o>$> '; $displayHelpManiaScript = $this->displayHelp ? 'True' : 'False'; $this->dico = array('switch' => 'helpSwitch', 'help' => array('textId' => 'helpText', 'params' => array($bullet, $this->modeName)), 'tip' => 'helpTip', 'note' => 'helpNote'); \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink($this->dico)); \ManiaLive\Gui\Manialinks::appendScript(<<<MANIASCRIPT #RequireContext CMlScript #Include "MathLib" as MathLib #Include "TextLib" as TextLib main() { \tdeclare Boolean helpDisplayed = {$displayHelpManiaScript}; \tdeclare CMlLabel helpLabel <=> (Page.MainFrame.GetFirstChild("help-label") as CMlLabel); \tdeclare CMlFrame helpFrame <=> (Page.MainFrame.GetFirstChild("help-frame") as CMlFrame); \tif(helpDisplayed) \t{ \t\thelpLabel.Hide(); \t} \telse \t{ \t\thelpFrame.Hide(); \t} \twhile(True) \t{ \t\tforeach(Event in PendingEvents) \t\t{ \t\t\tif(Event.Type == CMlEvent::Type::KeyPress) \t\t\t{ \t\t\t\tif(Event.KeyName == "F7") \t\t\t\t{ \t\t\t\t\tif(helpDisplayed) \t\t\t\t\t{ \t\t\t\t\t\thelpFrame.Hide(); \t\t\t\t\t\thelpLabel.Show(); \t\t\t\t\t} \t\t\t\t\telse \t\t\t\t\t{ \t\t\t\t\t\thelpFrame.Show(); \t\t\t\t\t\thelpLabel.Hide(); \t\t\t\t\t} \t\t\t\t\thelpDisplayed = !helpDisplayed; \t\t\t\t} \t\t\t\telse if(Event.KeyName == "F6") \t\t\t\t{ \t\t\t\t\tif (helpDisplayed) \t\t\t\t\t{ \t\t\t\t\t\thelpFrame.Hide(); \t\t\t\t\t\thelpLabel.Show(); \t\t\t\t\t} \t\t\t\t} \t\t\t} \t\t} \t\tyield; \t} } MANIASCRIPT ); }
protected function setScript($countdown, $animated, $hideOnF6) { $animatedManiaScript = $animated ? 'True' : 'False'; $hideOnF6ManiaScript = $hideOnF6 ? 'True' : 'False'; $countdown = (int) $this->countdown; $countdownManiaScript = $countdown ? 'True' : 'False'; \ManiaLive\Gui\Manialinks::appendScript(<<<MANIASCRIPT #RequireContext CMlScript #Include "MathLib" as MathLib #Include "TextLib" as TextLib main() { \tdeclare Boolean animated = {$animatedManiaScript}; \tdeclare Boolean hideOnF6 = {$hideOnF6ManiaScript}; \tdeclare Boolean countdown = {$countdownManiaScript}; \tdeclare Integer countdownTime = CurrentTime; \tdeclare Integer countdownTimeLeft = {$countdown}; \tdeclare Boolean waiting = False; \tdeclare CMlLabel label <=> (Page.MainFrame.GetFirstChild("info-label") as CMlLabel); \tdeclare CMlLabel waitLabel <=> (Page.MainFrame.GetFirstChild("wait-label") as CMlLabel); \tdeclare Text labelText = label.Value; \tlabel.SetText(TextLib::Compose(labelText, TextLib::ToText(countdownTimeLeft))); \twaitLabel.Hide(); \twhile(True) \t{ \t\tforeach(Event in PendingEvents) \t\t{ \t\t\tif(Event.Type == CMlEvent::Type::KeyPress) \t\t\t{ \t\t\t\tif(Event.KeyName == "F6") \t\t\t\t{ \t\t\t\t\tif(hideOnF6 && !waiting) \t\t\t\t\t{ \t\t\t\t\t\twaiting = True; \t\t\t\t\t\tlabel.Hide(); \t\t\t\t\t\twaitLabel.Show(); \t\t\t\t\t} \t\t\t\t} \t\t\t} \t\t} \t\tif(animated) \t\t{ \t\t\tlabel.Scale = 2+MathLib::Cos(CurrentTime*.002); \t\t} \t\tif(countdown && countdownTimeLeft >= 0 && CurrentTime - countdownTime > 1000) \t\t{ \t\t\tcountdownTime = CurrentTime; \t\t\tcountdownTimeLeft = countdownTimeLeft - 1; \t\t\tlabel.SetText(TextLib::Compose(labelText, TextLib::ToText(countdownTimeLeft))); \t\t} \t\telse if(countdown && countdownTimeLeft <= 0) \t\t{ \t\t\twaiting = True; \t\t\tlabel.Hide(); \t\t\twaitLabel.Show(); \t\t} \t\tyield; \t} } MANIASCRIPT ); }
function onDraw() { $this->setPosZ(3); if (static::$displayAlliesHelp) { $this->title->setPosY(-4.5); $this->alliesHelp->setVisibility(true); } else { $this->title->setPosY(-6); $this->alliesHelp->setVisibility(false); } \ManiaLive\Gui\Manialinks::appendXML(\ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance()->getManiaLink($this->dictionnary)); \ManiaLive\Gui\Manialinks::appendScript(<<<EOSCRIPT #RequireContext CMlScript #Include "MathLib" as MathLib #Include "TextLib" as TextLib main() { \tdeclare Text ClickedIndex; \tdeclare Text ButtonIdPrefix; \tdeclare Text DataIdPrefix; \tdeclare Text DataEntryId; \tdeclare Integer ButtonIdPrefixLength; \tdeclare CMlLabel DataLabel; \tdeclare CMlEntry DataEntry; \t\t \tButtonIdPrefix = "player_button-"; \tDataIdPrefix = "player_label-"; \tDataEntryId = "allyLogin_entry"; \t \tButtonIdPrefixLength = TextLib::Length(ButtonIdPrefix); \tDataEntry <=> (Page.GetFirstChild(DataEntryId) as CMlEntry); \twhile(True) \t{ \t\tforeach(Event in PendingEvents) \t\t{ \t\t\tif(Event.Type == CMlEvent::Type::MouseOver) \t\t\t{ \t\t\t\tif(TextLib::SubString(Event.ControlId, 0, ButtonIdPrefixLength) == ButtonIdPrefix) \t\t\t\t{ \t\t\t\t\tClickedIndex = TextLib::SubString(Event.ControlId, ButtonIdPrefixLength, 2); \t\t\t\t\tDataLabel <=> (Page.GetFirstChild(DataIdPrefix^ClickedIndex) as CMlLabel); \t\t\t\t\tif(DataLabel != Null)\t \t\t\t\t\t{ \t\t\t\t\t\tDataEntry.Value = DataLabel.Value; \t\t\t\t\t} \t\t\t\t} \t\t\t} \t\t} \t\tyield; \t} } EOSCRIPT ); $this->updateItemList(); }