Exemplo n.º 1
0
 protected function onConstruct()
 {
     $this->bg = new \ManiaLib\Gui\Elements\Bgs1(320, 16);
     $this->bg->setSubStyle(\ManiaLib\Gui\Elements\Bgs1::BgDialogBlur);
     $this->bg->setAlign('center', 'center2');
     $this->addComponent($this->bg);
     $this->label = new \ManiaLib\Gui\Elements\Label(240);
     $this->label->setStyle(\ManiaLib\Gui\Elements\Label::TextRaceMessageBig);
     $this->label->setTextSize(4);
     $this->label->setAlign('center', 'center2');
     $this->label->enableAutonewline();
     $this->label->setId('info-label');
     $this->label->setTextid('text');
     $this->addComponent($this->label);
     $this->label2 = new \ManiaLib\Gui\Elements\Label(240);
     $this->label2->setStyle(\ManiaLib\Gui\Elements\Label::TextRaceMessageBig);
     $this->label2->setTextSize(4);
     $this->label2->setAlign('center', 'center2');
     $this->label2->enableAutonewline();
     $this->label2->setTextid('wait');
     $this->label2->setId('wait-label');
     $this->addComponent($this->label2);
     $this->sound = new \ManiaLib\Gui\Elements\Audio();
     $this->sound->setData('http://static.maniaplanet.com/manialinks/lobbies/timer.wav', true);
     $this->sound->setPosition(200);
     $this->sound->autoPlay();
 }
Exemplo n.º 2
0
 function display()
 {
     $ui = new Bgs1(320, 200);
     $ui->setAlign('center', 'center');
     $ui->setPosition(0, 0, 14);
     $ui->setSubStyle(Bgs1::BgWindow1);
     $ui->save();
     Manialink::beginFrame(0, 0, 15);
     $ui = new \ManiaLib\Gui\Cards\Dialogs\TwoButtons($this->response->dialog->width, $this->response->dialog->height);
     $ui->setAlign('center', 'center');
     $ui->title->setText($this->response->dialog->title);
     $ui->text->setText($this->response->dialog->message);
     $ui->button->setText($this->response->dialog->buttonLabel);
     $ui->button->setManiazone($this->response->dialog->buttonManialink);
     if ($this->response->dialog->buttonAddplayerid) {
         $ui->button->addPlayerId();
     }
     $ui->button2->setText($this->response->dialog->button2Label);
     $ui->button2->setManiazone($this->response->dialog->button2Manialink);
     if ($this->response->dialog->button2Addplayerid) {
         $ui->button->addPlayerId();
     }
     $ui->save();
     Manialink::endFrame();
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 protected function onConstruct()
 {
     $this->setLayer(\ManiaLive\Gui\Window::LAYER_CUT_SCENE);
     $this->background = new Elements\Quad(190, 190);
     $this->background->setAlign('center', 'center');
     $this->background->setImage('file://Media/Manialinks/Common/Lobbies/versus-bg.dds', true);
     $this->addComponent($this->background);
     $this->label = new Elements\Label(200, 20);
     $this->label->setPosY(40);
     $this->label->setAlign('center', 'center2');
     $this->label->setStyle(\ManiaLib\Gui\Elements\Label::TextRaceMessageBig);
     $this->label->setTextid('text');
     $this->label->setId('info-label');
     $this->label->setTextSize(2);
     $this->addComponent($this->label);
     $this->transferLabel = clone $this->label;
     $this->transferLabel->setPosY(40);
     $this->transferLabel->setTextColor(null);
     $this->transferLabel->setTextid('transferText');
     $this->transferLabel->setId('transfer-label');
     $this->addComponent($this->transferLabel);
     $this->cancelLabel = new Elements\Label(200);
     $this->cancelLabel->setPosY(-47);
     $this->cancelLabel->setAlign('center', 'center2');
     $this->cancelLabel->setStyle(\ManiaLib\Gui\Elements\Label::TextRaceMessageBig);
     $this->cancelLabel->setTextColor('AAA');
     $this->cancelLabel->setTextid('cancel');
     $this->cancelLabel->setId('cancel-label');
     $this->cancelLabel->setTextSize(7);
     $this->addComponent($this->cancelLabel);
     $layout = new \ManiaLib\Gui\Layouts\Column();
     $layout->setMarginHeight(1);
     $this->team1 = new \ManiaLive\Gui\Controls\Frame();
     $this->team1->setLayout($layout);
     $this->team1->setPosition(-45);
     $this->addComponent($this->team1);
     $this->team2 = clone $this->team1;
     $this->team2->setPosX(45);
     $this->addComponent($this->team2);
 }
 protected function onConstruct()
 {
     $this->background = new Elements\Quad(320, 142);
     $this->background->setAlign('center', 'center');
     $this->background->setImage('http://static.maniaplanet.com/manialinks/lobbies/background.png', true);
     $this->addComponent($this->background);
     $this->label = new Elements\Label(200, 20);
     $this->label->setPosY(47);
     $this->label->setAlign('center', 'center2');
     $this->label->setStyle(\ManiaLib\Gui\Elements\Label::TextRaceMessageBig);
     $this->label->setTextid('text');
     $this->label->setId('info-label');
     $this->label->setTextSize(7);
     $this->addComponent($this->label);
     $this->transferLabel = clone $this->label;
     $this->transferLabel->setPosY(47);
     $this->transferLabel->setTextColor(null);
     $this->transferLabel->setTextid('transferText');
     $this->transferLabel->setId('transfer-label');
     $this->addComponent($this->transferLabel);
     $this->cancelLabel = new Elements\Label(200);
     $this->cancelLabel->setPosY(-47);
     $this->cancelLabel->setAlign('center', 'center2');
     $this->cancelLabel->setStyle(\ManiaLib\Gui\Elements\Label::TextRaceMessageBig);
     $this->cancelLabel->setTextColor('AAA');
     $this->cancelLabel->setTextid('cancel');
     $this->cancelLabel->setId('cancel-label');
     $this->cancelLabel->setTextSize(7);
     $this->addComponent($this->cancelLabel);
     $layout = new \ManiaLib\Gui\Layouts\Column();
     $layout->setMarginHeight(2);
     $this->players = new \ManiaLive\Gui\Controls\Frame();
     $this->players->setLayout($layout);
     $this->players->setPosition(0, 33);
     $this->addComponent($this->players);
 }
Exemplo n.º 6
0
 function display()
 {
     $ui = new \ManiaLib\Gui\Cards\Navigation\Menu();
     $ui->title->setText(\ManiaHost\Config::getInstance()->appName);
     $ui->subTitle->setText('Select maps');
     $manialink = $this->request->createLinkArgList('../my-maps/');
     $ui->addItem();
     $ui->lastItem->text->setText('My maps');
     $ui->lastItem->icon->setSubStyle(\ManiaLib\Gui\Elements\Icons128x128_1::Browse);
     $ui->lastItem->setManialink($manialink);
     $manialink = $this->request->createLinkArgList('../default-maps/');
     $ui->addItem();
     $ui->lastItem->text->setText('Default maps');
     $ui->lastItem->icon->setSubStyle(\ManiaLib\Gui\Elements\Icons128x128_1::Browse);
     $ui->lastItem->setManialink($manialink);
     $manialink = $this->request->createLinkArgList('../select-map/');
     $ui->quitButton->text->setText('Back');
     $ui->quitButton->setManialink($manialink);
     $ui->save();
     Manialink::beginFrame(40, 65, 0.1);
     $ui = new \ManiaLib\Gui\Cards\Panel(123, 65);
     $ui->setHalign('center');
     $ui->title->setText('Upload');
     $ui->save();
     $ui = new \ManiaLib\Gui\Elements\Label(115);
     $ui->setHalign('center');
     $ui->setPosition(0, -25, 0.1);
     $ui->setText('Your maps will be stored until the end of your rentals');
     $ui->setStyle(\ManiaLib\Gui\Elements\Label::TextTips);
     $ui->save();
     $ui = new \ManiaLib\Gui\Elements\FileEntry(100, 6);
     $ui->setHalign('center');
     $ui->setPosition(0, -35, 0.9);
     $ui->setFolder('Maps');
     $ui->setName('file');
     $ui->save();
     $this->request->set('file', 'file');
     $manialink = $this->request->createLink('../do-upload/');
     $ui = new \ManiaLib\Gui\Elements\Button();
     $ui->setHalign('center');
     $ui->setPosition(0, -45, 0.1);
     $ui->setText('Send');
     $ui->setManialink(sprintf('POST(%s,file)', $manialink));
     $ui->save();
     if ($this->response->message) {
         $ui = new \ManiaLib\Gui\Elements\Label(110);
         $ui->setHalign('center');
         $ui->setPosition(0, -56, 0.1);
         $ui->setStyle(\ManiaLib\Gui\Elements\Label::TextTitleError);
         $ui->setText($this->response->message);
         $ui->save();
     }
     Manialink::endFrame();
     Manialink::beginFrame(40, -10, 0.1);
     $ui = new \ManiaLib\Gui\Cards\Panel(123, 50);
     $ui->setHalign('center');
     $ui->title->setText('Available space');
     $ui->titleBg->setSubStyle(Bgs1::BgTitle3_2);
     $ui->save();
     $ui = new \ManiaLib\Gui\Elements\Label(80);
     $ui->setHalign('center');
     $ui->setPosition(0, -25, 0.1);
     $ui->setText(sprintf('%.2fMo / 20Mo', $this->response->availableSpace / pow(2, 20)));
     $ui->save();
     $ui = new Bgs1(100, 6);
     $ui->setAlign('center', 'center');
     $ui->setPosition(0, -35, 0.1);
     $ui->setSubStyle(Bgs1::BgProgressBar);
     $ui->save();
     $ui = new Bgs1($this->response->hRatioProgressBar * 100, 5);
     $ui->setValign('center');
     $ui->setPosition(-50, -35, 0.2);
     $ui->setSubStyle(Bgs1::ProgressBar);
     $ui->save();
     Manialink::endFrame();
 }
    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);
    }
Exemplo n.º 8
0
 /**
  * Saves the PageNavigator in the GUI objects stack
  */
 function preFilter()
 {
     // Show / hide text
     if (!$this->currentPage || !$this->pageNumber) {
         $this->showText(false);
     }
     // Auto show fast next / last
     if ($this->arrowFirst->hasLink() || $this->arrowLast->hasLink()) {
         $this->showLast();
     }
     if ($this->arrowFastNext->hasLink() || $this->arrowFastPrev->hasLink()) {
         $this->showFastNext();
     }
     // Arrow styles
     if ($this->arrowNext->hasLink()) {
         $this->arrowNext->setSubStyle($this->arrowNextStyle);
     }
     if ($this->arrowPrev->hasLink()) {
         $this->arrowPrev->setSubStyle($this->arrowPrevStyle);
     }
     if ($this->arrowNext->hasLink() && $this->arrowFastNext->hasLink()) {
         $this->arrowFastNext->setSubStyle($this->arrowFastNextStyle);
     } else {
         $this->arrowFastNext->setManialink(null);
     }
     if ($this->arrowPrev->hasLink() && $this->arrowFastPrev->hasLink()) {
         $this->arrowFastPrev->setSubStyle($this->arrowFastPrevStyle);
     } else {
         $this->arrowFastPrev->setManialink(null);
     }
     if ($this->arrowNext->hasLink() && $this->arrowLast->hasLink()) {
         $this->arrowLast->setSubStyle($this->arrowLastStyle);
     } else {
         $this->arrowLast->setManialink(null);
     }
     if ($this->arrowPrev->hasLink() && $this->arrowFirst->hasLink()) {
         $this->arrowFirst->setSubStyle($this->arrowFirstStyle);
     } else {
         $this->arrowFirst->setManialink(null);
     }
     // Text
     $this->text->setStyle(\ManiaLib\Gui\Elements\Label::TextValueSmall);
     $this->text->setText($this->currentPage . ' / ' . $this->pageNumber);
     // Positioning in relation to the center of the containing frame
     $this->text->setAlign("center", "center2");
     $this->text->setPosZ(1);
     $this->textBg->setSubStyle(\ManiaLib\Gui\Elements\Bgs1::BgPager);
     $this->textBg->setAlign('center', 'center');
     $this->textBg->setPosZ(0.5);
     $this->arrowNext->setValign("center");
     $this->arrowFastNext->setValign("center");
     $this->arrowLast->setValign("center");
     $this->arrowNext->setPosition($this->text->getSizeX() / 2 + 1, 0, 1);
     $this->arrowFastNext->setPosition($this->arrowNext->getPosX() + $this->arrowNext->getSizeX(), 0, 1);
     $this->arrowLast->setPosition($this->arrowNext->getPosX() + (int) $this->showFastNext * $this->arrowFastNext->getSizeX() + $this->arrowNext->getSizeX(), 0, 1);
     $this->arrowPrev->setAlign("right", "center");
     $this->arrowFastPrev->setAlign("right", "center");
     $this->arrowFirst->setAlign("right", "center");
     $this->arrowPrev->setPosition(-($this->text->getSizeX() / 2) - 1, 0, 1);
     $this->arrowFastPrev->setPosition($this->arrowPrev->getPosX() - $this->arrowPrev->getSizeX(), 0, 1);
     $this->arrowFirst->setPosition($this->arrowPrev->getPosX() - (int) $this->showFastNext * $this->arrowFastPrev->getSizeX() - $this->arrowPrev->getSizeX(), 0, 1);
     // Save the gui
     if ($this->showText) {
         $this->add($this->textBg);
         $this->add($this->text);
     }
     $this->add($this->arrowNext);
     $this->add($this->arrowPrev);
     if ($this->showLast) {
         $this->add($this->arrowFirst);
         $this->add($this->arrowLast);
     }
     if ($this->showFastNext) {
         $this->add($this->arrowFastNext);
         $this->add($this->arrowFastPrev);
     }
 }