function onConstruct() { $this->background = new Elements\Quad(160, 90); $this->background->setAlign('center', 'center'); $this->background->setBgcolor('000a'); $this->addComponent($this->background); $this->button = new Elements\Button(); $this->button->setHalign('center'); $this->button->setPosY(-47); $this->button->setText('Close'); $this->addComponent($this->button); }
function onConstruct() { $this->setLayer(\ManiaLive\Gui\Window::LAYER_CUT_SCENE); $ui = new Elements\Bgs1(320, 180); $ui->setAlign('center', 'center'); $ui->setSubStyle(Elements\Bgs1::BgDialogBlur); $this->addComponent($ui); $ui = new Elements\Bgs1(163, 63); $ui->setAlign('center', 'center'); $ui->setSubStyle(Elements\Bgs1::BgShadow); $this->addComponent($ui); $ui = new Elements\Quad(160, 60); $ui->setAlign('center', 'center'); $ui->setBgcolor('eeef'); $this->addComponent($ui); $this->questionLabel = new Elements\Label(160); $this->questionLabel->setAlign('center', 'center2'); $this->questionLabel->setPosY(5); $this->questionLabel->enableAutonewline(); $this->questionLabel->setStyle(Elements\Label::TextInfoMedium); $this->addComponent($this->questionLabel); $this->yesButton = new Elements\Button(); $this->yesButton->setAlign('left', 'bottom'); $this->yesButton->setPosition(-45, -25); $this->yesButton->setTextid('yes'); $this->addComponent($this->yesButton); $this->noButton = new Elements\Button(); $this->noButton->setAlign('right', 'bottom'); $this->noButton->setPosition(45, -25); $this->noButton->setTextid('no'); $this->addComponent($this->noButton); }
function __construct() { $this->setSize(80, 20); $ui = new Elements\Quad(80, 20); $ui->setImage('http://static.maniaplanet.com/manialinks/elite/PlayerCardBg.dds', true); $this->addComponent($ui); $this->icon = new Elements\Icons64x64_1(18.5, 18.5); $this->icon->setBgcolor('F00'); $this->icon->setAlign('left', 'center'); $this->addComponent($this->icon); $this->label = new Elements\Label(38); $this->label->setPosition(22, -2.5); $this->label->setTextSize(3); $this->label->setStyle(Elements\Label::TextRaceMessage); $this->addComponent($this->label); $this->teamLabel = new Elements\Label(25); $this->teamLabel->setPosition(27, -11.5); $this->teamLabel->setValign('center2'); $this->teamLabel->setStyle(Elements\Label::TextRaceMessage); $this->teamLabel->setTextSize(2); $this->teamLabel->setText('$o$09FLorem$z Ipsum Team'); // $this->addComponent($this->teamLabel); $this->teamIcon = new Elements\Quad(4, 4); $this->teamIcon->setValign('center'); $this->teamIcon->setPosition(22, -11.5); $this->teamIcon->setBgcolor('FF0a'); // $this->addComponent($this->teamIcon); $this->rankLabel = new Elements\Label(30); $this->rankLabel->setAlign('left', 'center2'); $this->rankLabel->setPosition(27, -17.5); $this->rankLabel->setText('-'); $this->rankLabel->setStyle(Elements\Label::TextRaceMessage); $this->rankLabel->setTextSize(1); $this->addComponent($this->rankLabel); $this->countryFlag = new Elements\Quad(4, 4); $this->countryFlag->setAlign('left', 'center'); $this->countryFlag->setPosition(22, -17.5); $this->addComponent($this->countryFlag); $frame = new \ManiaLive\Gui\Controls\Frame(72, 0); $frame->setScale(1.13); $frame->setPosZ(0.1); $this->addComponent($frame); $this->echelonQuad = new Elements\Quad(14.1551, 17.6938); $this->echelonQuad->setAlign('center', 'top'); $frame->addComponent($this->echelonQuad); $ui = new Elements\Label(15); $ui->setAlign('center', 'top'); $ui->setStyle(Elements\Label::TextRaceMessage); $ui->setPosition(-0.25, -3.6); $ui->setTextSize(0.5); $ui->setText('Echelon'); $frame->addComponent($ui); $this->echelonLabel = new Elements\Label(10, 10); $this->echelonLabel->setAlign('center', 'center'); $this->echelonLabel->setPosition(-0.25, -10.6); $this->echelonLabel->setStyle(Elements\Label::TextRaceMessageBig); $frame->addComponent($this->echelonLabel); $this->disableQuad = new Elements\Quad(80, 20); $this->disableQuad->setBgcolor('333A'); $this->disableQuad->setVisibility(false); $this->disableQuad->setPosZ(3); $this->addComponent($this->disableQuad); }
public function display() { Manialink::load(); Manialink::appendXML(Dictionary::getInstance()->getManiaLink($this->displayedText)); Manialink::appendScript(<<<MANIASCRIPT #RequireContext CMlScript #Include "MathLib" as MathLib #Include "TextLib" as TextLib main() { \tdeclare Boolean countdown = True; \tdeclare Integer countdownTime = CurrentTime; \tdeclare Integer countdownTimeLeft = 10; \tdeclare CMlFrame frame <=> (Page.MainFrame.GetFirstChild("block-quit") as CMlFrame); \tdeclare CMlLabel label <=> (Page.MainFrame.GetFirstChild("countdown-label") as CMlLabel); \tlabel.SetText(TextLib::ToText(countdownTimeLeft)); \twhile(True) \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::ToText(countdownTimeLeft)); \t\t} \t\telse if(countdown && countdownTimeLeft <= 0) \t\t{ \t\t\tframe.Hide(); \t\t} \t\tyield; \t} } MANIASCRIPT ); $frame = new \ManiaLib\Gui\Elements\Frame(); $frame->setPosition(0, 5, 0); $label = new Label(170); $label->setAlign('center', 'center2'); $label->setStyle(Label::TextRaceMessageBig); $label->setTextSize(5); $label->setTextColor('f00'); $label->setTextId('text'); $frame->add($label); $iconBlink = new Icons128x128_Blink(15); $iconBlink->setAlign('right', 'center'); $iconBlink->setPosition(-87, 0); $iconBlink->setSubStyle(Icons128x128_Blink::Hard); $frame->add($iconBlink); $iconBlink = new Icons128x128_Blink(15); $iconBlink->setAlign('left', 'center'); $iconBlink->setPosition(87, 0); $iconBlink->setSubStyle(Icons128x128_Blink::Hard); $frame->add($iconBlink); $frame->save(); $frame = new \ManiaLib\Gui\Elements\Frame(); $frame->setPosition(0, -6.5, 10); $frame->setScriptEvents(); $frame->setId('block-quit'); $bg = new Bgs1(180, 45); $bg->setSubStyle(Bgs1::BgDialogBlur); $bg->setAlign('center'); $bg->setScriptEvents(); $bg->setId('background'); $bg->setManialink(''); $frame->add($bg); $bg = new Quad(180, 45); $bg->setBgcolor('0008'); $bg->setAlign('center'); $bg->setScriptEvents(); $frame->add($bg); $ui = new Label(120); $ui->setAlign('center'); $ui->setPosition(0, -6, 0.1); $ui->setStyle(Label::TextRaceMessageBig); $ui->setTextSize(4); $ui->setTextid('available'); $frame->add($ui); $ui = new Label(20); $ui->setId('countdown-label'); $ui->setAlign('center'); $ui->setPosition(0, -15, 0.1); $ui->setStyle(Label::TextRaceMessageBig); $ui->setTextSize(5); $ui->setText('10'); $frame->add($ui); $frame->save(); return Manialink::render(true); }
function onNewNetworkValue($newValue) { $this->networkSums[] = $newValue[0] + $newValue[1]; $this->networkStats[] = $newValue; if (count($this->networkSums) > 10) { array_shift($this->networkSums); array_shift($this->networkStats); $bars = array_shift($this->bars); $this->barsFrame->removeComponent($bars[2]); } else { $frame = new Frame(); $frame->setSizeX(($this->sizeX - 2) / 10); $sentBar = new Quad(); $sentBar->setSizeX(($this->sizeX - 2) / 10); $sentBar->setBgcolor('a00'); $sentBar->setValign('bottom'); $frame->addComponent($sentBar); $receivedBar = new Quad(); $receivedBar->setSizeX(($this->sizeX - 2) / 10); $receivedBar->setBgcolor('0a0'); $receivedBar->setValign('bottom'); $frame->addComponent($receivedBar); $bars = array($sentBar, $receivedBar, $frame); } $this->barsFrame->addComponent($bars[2]); $this->bars[] = $bars; $heightFactor = ($this->sizeY - 6) / max(51200, 1.2 * max($this->networkSums)); foreach ($this->bars as $i => $bars) { $bars[0]->setSizeY($this->networkStats[$i][1] * $heightFactor); $bars[1]->setSizeY($this->networkStats[$i][0] * $heightFactor); $bars[1]->setPosY($bars[0]->getRealSizeY()); } $i = 1; $step = max(51200, 1.2 * max($this->networkSums)) / 4096; foreach ($this->lines as $line) { $line[1]->setText('$fff' . round($i++ * $step) . ' kb/s'); } $this->redraw(); }
$ui = new \ManiaLib\Gui\Elements\Bgs1InRace(202, 200); $ui->setPosition(0, 0, 0.09); $ui->setAlign('center', 'center'); $ui->setSubStyle(\ManiaLib\Gui\Elements\Bgs1InRace::BgTitleShadow); $ui->save(); Manialink::beginFrame(-100, 90, 0.1); $ui = new Quad(200, 28); $ui->setBgcolor(maniapress_get_option('theme-header-bg', 'fff')); $ui->save(); $ui = new \ManiaLib\Gui\Elements\Quad(200, 145); $ui->setPosition(0, -28, 0); $ui->setBgcolor(maniapress_get_option('theme-content-bg', 'fffa')); $ui->save(); $ui = new \ManiaLib\Gui\Elements\Quad(200, 7); $ui->setPosition(0, -173, 0); $ui->setBgcolor(maniapress_get_option('theme-footer-bg', 'fff')); $ui->save(); Manialink::beginFrame(10, -5.5, 0.1); $ui = new Icons128x128_1(15); $ui->setSubStyle(Icons128x128_1::Vehicles); $ui->save(); $ui = new Label(100); $ui->setPosition(17, -2.5, 0); $ui->setScale(1.75); $ui->setStyle(Label::TextButtonBig); $ui->setText(maniapress_get_bloginfo('name')); $ui->save(); $ui = new Label(150); $ui->setPosition(17, -9, 0.1); $ui->setStyle(Label::TextTips); $ui->setText(maniapress_get_bloginfo('description'));
function onNewMemoryValue($newValue) { $lastValue = end($this->memoryStats); $this->memoryStats[] = $newValue; if (count($this->memoryStats) > 10) { array_shift($this->memoryStats); $bar = array_shift($this->bars); $this->barsFrame->removeComponent($bar); } else { $bar = new Quad(); $bar->setSizeX(($this->sizeX - 2) / 10); $bar->setValign('bottom'); } if ($lastValue === false || $lastValue == $newValue) { $bar->setBgcolor('999'); } else { if ($lastValue < $newValue) { $bar->setBgcolor('a00'); } else { $bar->setBgcolor('0a0'); } } $this->barsFrame->addComponent($bar); $this->bars[] = $bar; $heightFactor = 2 * ($this->sizeY - 6) / ceil(3 * max($this->memoryStats)); foreach ($this->bars as $i => $bar) { $bar->setSizeY($this->memoryStats[$i] * $heightFactor); } $i = 1; $step = round(37.5 * max($this->memoryStats) / $this->memoryLimit, 2); foreach ($this->lines as $line) { $line[1]->setText('$fff' . $i++ * $step . '% of total'); } $this->redraw(); }