/**
  * Set the paging Control
  *
  * @api
  * @param Control $control Paging Control
  * @return static
  */
 public function setControl(Control $control)
 {
     $control->checkId();
     if ($control instanceof Scriptable) {
         $control->setScriptEvents(true);
     }
     $this->control = $control;
     return $this;
 }
 /**
  * @see ScriptFeature::prepare()
  */
 public function prepare(Script $script)
 {
     $hoverControlId = Builder::escapeText($this->hoverControl->getId());
     $tooltipControlId = Builder::escapeText($this->tooltipControl->getId());
     // MouseOver
     $visibility = Builder::getBoolean(!$this->invert);
     $scriptText = "\nif (Event.Control.ControlId == {$hoverControlId}) {\n\tdeclare TooltipControl = Page.GetFirstChild({$tooltipControlId});\n\tTooltipControl.Visible = {$visibility};";
     if (is_string($this->text) && $this->tooltipControl instanceof Label) {
         $tooltipText = Builder::escapeText($this->text);
         $scriptText .= "\n\tdeclare TooltipLabel = (TooltipControl as CMlLabel);\n\tTooltipLabel.Value = {$tooltipText};";
     }
     $scriptText .= "\n}";
     $script->appendGenericScriptLabel(ScriptLabel::MOUSEOVER, $scriptText);
     // MouseOut
     $visibility = Builder::getBoolean($this->invert);
     $scriptText = "\nif (Event.Control.ControlId == {$hoverControlId}) {\n\tdeclare TooltipControl = Page.GetFirstChild({$tooltipControlId});";
     if ($this->stayOnClick) {
         $scriptText .= "\n\tdeclare FML_Clicked for Event.Control = False;\n\tif (!FML_Clicked) ";
     }
     $scriptText .= "\n\tTooltipControl.Visible = {$visibility};\n}";
     $script->appendGenericScriptLabel(ScriptLabel::MOUSEOUT, $scriptText);
     // MouseClick
     if ($this->stayOnClick) {
         $scriptText = "\nif (Event.Control.ControlId == {$hoverControlId}) {\n\tdeclare FML_Clicked for Event.Control = False;\n\tFML_Clicked = !FML_Clicked;\n}";
         $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $scriptText);
     }
     return $this;
 }
 /**
  * Get the script text
  *
  * @return string
  */
 protected function getScriptText()
 {
     if ($this->control) {
         // Control event
         $controlId = Builder::escapeText($this->control->getId());
         return "\nif (Event.Control.ControlId == {$controlId}) {\n\tPlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume});\n}";
     }
     // Other events
     return "\nPlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume});";
 }
 /**
  * Get the script text
  *
  * @return string
  */
 protected function getScriptText()
 {
     if ($this->control) {
         // Control event
         $controlId = Builder::escapeText($this->control->getId());
         return "\nif (Event.Control.ControlId == {$controlId}) {\n\tShowCurChallengeCard();\n}";
     }
     // Other events
     return "\nShowCurChallengeCard();";
 }
 /**
  * Get the script text
  *
  * @return string
  */
 protected function getScriptText()
 {
     $login = Builder::escapeText($this->login);
     if ($this->control) {
         // Control event
         $controlId = Builder::escapeText($this->control->getId());
         return "\nif (Event.Control.ControlId == {$controlId}) {\n\tShowProfile({$login});\n}";
     }
     // Other events
     return "\nShowProfile({$login});";
 }
 /**
  * Get the script text
  *
  * @return string
  */
 protected function getScriptText()
 {
     $actionName = Builder::escapeText($this->actionName);
     if ($this->control) {
         // Control event
         $controlId = Builder::escapeText($this->control->getId());
         $scriptText = "\nif (Event.Control.ControlId == {$controlId}) {\n\tTriggerPageAction({$actionName});\n}";
     } else {
         // Other
         $scriptText = "\nTriggerPageAction({$actionName});";
     }
     return $scriptText;
 }
Exemple #7
0
 /**
  * Get the script text
  *
  * @return string
  */
 protected function getScriptText()
 {
     $togglingControlId = Builder::escapeText($this->togglingControl->getId());
     $toggledControlId = Builder::escapeText($this->toggledControl->getId());
     $visibility = "!ToggleControl.Visible";
     if ($this->onlyShow) {
         $visibility = "True";
     } else {
         if ($this->onlyHide) {
             $visibility = "False";
         }
     }
     return "\nif (Event.Control.ControlId == {$togglingControlId}) {\n\tdeclare ToggleControl = Page.GetFirstChild({$toggledControlId});\n\tToggleControl.Visible = {$visibility};\n}";
 }
 /**
  * Build the script text for the Control
  *
  * @return string
  */
 protected function buildScriptText()
 {
     $controlId = Builder::escapeText($this->control->getId());
     $scriptText = '';
     $closeBlock = false;
     if (ScriptLabel::isEventLabel($this->labelName)) {
         $scriptText .= "\nif (Event.ControlId == {$controlId}) {\ndeclare Control <=> Event.Control;";
         $closeBlock = true;
     } else {
         $scriptText .= "\ndeclare Control <=> Page.GetFirstChild({$controlId});";
     }
     $class = $this->control->getManiaScriptClass();
     $name = preg_replace('/^CMl/', '', $class, 1);
     $scriptText .= "\ndeclare {$name} <=> (Control as {$class});\n";
     $scriptText .= $this->scriptText . "\n";
     if ($closeBlock) {
         $scriptText .= "}";
     }
     return $scriptText;
 }
Exemple #9
0
 /**
  * @see Renderable::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->data) {
         $domElement->setAttribute("data", $this->data);
     }
     if ($this->dataId) {
         $domElement->setAttribute("dataid", $this->dataId);
     }
     if ($this->play) {
         $domElement->setAttribute("play", 1);
     }
     if (!$this->looping) {
         $domElement->setAttribute("looping", 0);
     }
     if ($this->music) {
         $domElement->setAttribute("music", 1);
     }
     if ($this->volume != 1.0) {
         $domElement->setAttribute("volume", $this->volume);
     }
     if ($this->scriptEvents) {
         $domElement->setAttribute("scriptevents", 1);
     }
     return $domElement;
 }
 /**
  * Set the Page Control
  *
  * @api
  * @param Control $control Page Control
  * @return static
  */
 public function setControl(Control $control)
 {
     $control->checkId();
     $this->control = $control;
     return $this;
 }
Exemple #11
0
 /**
  * @see Control::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->ratio) {
         $domElement->setAttribute("ratio", $this->ratio);
     }
     if ($this->grading != 1.0) {
         $domElement->setAttribute("grading", $this->grading);
     }
     if ($this->color) {
         $domElement->setAttribute("color", $this->color);
     }
     if ($this->centered) {
         $domElement->setAttribute("centered", 1);
     }
     if ($this->clan) {
         $domElement->setAttribute("clan", $this->clan);
     }
     if (!$this->drawBackground) {
         $domElement->setAttribute("drawbg", 0);
     }
     if (!$this->drawBlockBackground) {
         $domElement->setAttribute("drawblockbg", 0);
     }
     if ($this->style) {
         $domElement->setAttribute("style", $this->style);
     }
     return $domElement;
 }
Exemple #12
0
 /**
  * @see Renderable::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->text) {
         $domElement->setAttribute("text", $this->text);
     }
     if ($this->textId) {
         $domElement->setAttribute("textid", $this->textId);
     }
     if ($this->textPrefix) {
         $domElement->setAttribute("textprefix", $this->textPrefix);
     }
     if ($this->textEmboss) {
         $domElement->setAttribute("textemboss", $this->textEmboss);
     }
     if ($this->translate) {
         $domElement->setAttribute("translate", $this->translate);
     }
     if ($this->maxLines >= 0) {
         $domElement->setAttribute("maxlines", $this->maxLines);
     }
     if ($this->opacity != 1.0) {
         $domElement->setAttribute("opacity", $this->opacity);
     }
     if ($this->action) {
         $domElement->setAttribute("action", $this->action);
     }
     if ($this->actionKey >= 0) {
         $domElement->setAttribute("actionkey", $this->actionKey);
     }
     if ($this->url) {
         $domElement->setAttribute("url", $this->url);
     }
     if ($this->urlId) {
         $domElement->setAttribute("urlid", $this->urlId);
     }
     if ($this->manialink) {
         $domElement->setAttribute("manialink", $this->manialink);
     }
     if ($this->manialinkId) {
         $domElement->setAttribute("manialinkid", $this->manialinkId);
     }
     if ($this->autoNewLine) {
         $domElement->setAttribute("autonewline", $this->autoNewLine);
     }
     if ($this->scriptEvents) {
         $domElement->setAttribute("scriptevents", $this->scriptEvents);
     }
     if ($this->style) {
         $domElement->setAttribute("style", $this->style);
     }
     if ($this->textSize >= 0) {
         $domElement->setAttribute("textsize", $this->textSize);
     }
     if ($this->textFont) {
         $domElement->setAttribute("textfont", $this->textFont);
     }
     if ($this->textColor) {
         $domElement->setAttribute("textcolor", $this->textColor);
     }
     if ($this->areaColor) {
         $domElement->setAttribute("focusareacolor1", $this->areaColor);
     }
     if ($this->focusAreaColor) {
         $domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
     }
     return $domElement;
 }
Exemple #13
0
 /**
  * @see Renderable::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->imageUrl) {
         $domElement->setAttribute("image", $this->imageUrl);
     }
     if ($this->imageId) {
         $domElement->setAttribute("imageid", $this->imageId);
     }
     if ($this->imageFocusUrl) {
         $domElement->setAttribute("imagefocus", $this->imageFocusUrl);
     }
     if ($this->imageFocusId) {
         $domElement->setAttribute("imagefocusid", $this->imageFocusId);
     }
     if ($this->colorize) {
         $domElement->setAttribute("colorize", $this->colorize);
     }
     if ($this->modulizeColor) {
         $domElement->setAttribute("modulizecolor", $this->modulizeColor);
     }
     if (!$this->autoScale) {
         $domElement->setAttribute("autoscale", 0);
     }
     if ($this->keepRatio) {
         $domElement->setAttribute("keepratio", $this->keepRatio);
     }
     if ($this->opacity !== 1.0) {
         $domElement->setAttribute("opacity", $this->opacity);
     }
     if ($this->backgroundColor) {
         $domElement->setAttribute("bgcolor", $this->backgroundColor);
     }
     if ($this->action) {
         $domElement->setAttribute("action", $this->action);
     }
     if ($this->actionKey) {
         $domElement->setAttribute("actionkey", $this->actionKey);
     }
     if ($this->url) {
         $domElement->setAttribute("url", $this->url);
     }
     if ($this->urlId) {
         $domElement->setAttribute("urlid", $this->urlId);
     }
     if ($this->manialink) {
         $domElement->setAttribute("manialink", $this->manialink);
     }
     if ($this->manialinkId) {
         $domElement->setAttribute("manialinkid", $this->manialinkId);
     }
     if ($this->scriptEvents) {
         $domElement->setAttribute("scriptevents", 1);
     }
     if ($this->style) {
         $domElement->setAttribute("style", $this->style);
     }
     if ($this->subStyle) {
         $domElement->setAttribute("substyle", $this->subStyle);
     }
     if ($this->styleSelected) {
         $domElement->setAttribute("styleselected", 1);
     }
     return $domElement;
 }
Exemple #14
0
 /**
  * @see Renderable::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->name) {
         $domElement->setAttribute("name", $this->name);
     }
     if ($this->default !== null) {
         $domElement->setAttribute("default", $this->default);
     } else {
         if ($this->autoComplete) {
             $value = Parameters::getValue($this->name);
             if ($value) {
                 $domElement->setAttribute("default", $value);
             }
         }
     }
     if ($this->autoNewLine) {
         $domElement->setAttribute("autonewline", 1);
     }
     if ($this->scriptEvents) {
         $domElement->setAttribute("scriptevents", 1);
     }
     if ($this->style) {
         $domElement->setAttribute("style", $this->style);
     }
     if ($this->textColor) {
         $domElement->setAttribute("textcolor", $this->textColor);
     }
     if ($this->textSize) {
         $domElement->setAttribute("textsize", $this->textSize);
     }
     if ($this->textFont) {
         $domElement->setAttribute("textfont", $this->textFont);
     }
     if ($this->areaColor) {
         $domElement->setAttribute("focusareacolor1", $this->areaColor);
     }
     if ($this->focusAreaColor) {
         $domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
     }
     return $domElement;
 }
Exemple #15
0
 /**
  * @see Renderable::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->format) {
         $formatXml = $this->format->render($domDocument);
         $domElement->appendChild($formatXml);
     }
     foreach ($this->children as $child) {
         $childXmlElement = $child->render($domDocument);
         $domElement->appendChild($childXmlElement);
     }
     return $domElement;
 }
 /**
  * @see Renderable::render()
  */
 public function render(\DOMDocument $domDocument)
 {
     $domElement = parent::render($domDocument);
     if ($this->model) {
         $this->model->checkId();
         $domElement->setAttribute("modelid", $this->model->getId());
     } else {
         if ($this->modelId) {
             $domElement->setAttribute("modelid", $this->modelId);
         }
     }
     return $domElement;
 }