Example #1
0
 function __construct()
 {
     parent::__construct(70, 180);
     $this->setSubStyle(Bgs1::BgWindow1);
     $this->setPosition(-150, 90, 0.1);
     $this->titleBg = new Quad(70, 70);
     $this->titleBg->setImage(Config::getInstance()->titleBgURL, true);
     $this->addCardElement($this->titleBg);
     $this->logo = new Icons128x128_1(16);
     $this->logo->setPosition(4, -38, 0.1);
     $this->logo->setSubStyle(Icons128x128_1::Vehicles);
     $this->addCardElement($this->logo);
     $this->title = new Label(46);
     $this->title->setPosition(22, -41, 0.1);
     $this->title->setStyle(Label::TextTitle1);
     $this->title->setScriptEvents();
     $this->addCardElement($this->title);
     $this->subTitle = new Label(46);
     $this->subTitle->setPosition(22, -47.75, 0.1);
     $this->subTitle->setStyle(Label::TextSubTitle1);
     $this->addCardElement($this->subTitle);
     $this->quitButton = new Button();
     $this->quitButton->setPosition(-1, -163.5, 0.1);
     $this->quitButton->text->setText('Back');
     $this->quitButton->text->setStyle(Label::TextButtonNavBack);
     $this->quitButton->icon->setPosition(-8.5, -0.5, 0.1);
     $this->quitButton->icon->setStyle(Quad::Icons128x128_1);
     $this->quitButton->icon->setSubStyle(Icons128x128_1::BackFocusable);
     $this->quitButton->icon->setSize(11, 11);
 }
 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();
 }
Example #3
0
 public function display()
 {
     $manialink = $this->request->createLink('/rent/');
     $ui = new \ManiaLib\Gui\Cards\Navigation\Menu();
     $ui->title->setText(\ManiaHost\Config::getInstance()->appName);
     $ui->quitButton->setManialink($manialink);
     $ui->subTitle->setText('Admin panel');
     $ui->addItem();
     $ui->lastItem->text->setText('Incomes');
     $ui->lastItem->icon->setSubStyle(Icons128x128_1::Coppers);
     $ui->lastItem->setSelected();
     $manialink = $this->request->createLink('/admin/audience-list/');
     $ui->addItem();
     $ui->lastItem->text->setText('Servers Audience');
     $ui->lastItem->icon->setSubStyle(Icons128x128_1::Statistics);
     $ui->lastItem->setManialink($manialink);
     $ui->save();
     Manialink::beginFrame(35);
     $quad = new Quad(180, 60);
     $quad->setPosY(64);
     $quad->setHalign('center');
     $quad->setImage($this->response->rentalUrl, true);
     $quad->save();
     $quad = new Quad(180, 60);
     $quad->setPosY(-4);
     $quad->setHalign('center');
     $quad->setImage($this->response->incomesUrl, true);
     $quad->save();
     Manialink::endFrame();
 }
Example #4
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);
 }
 protected function onConstruct()
 {
     $this->setLayer(\ManiaLive\Gui\Window::LAYER_CUT_SCENE);
     $this->setSize(self::SIZE_X, self::SIZE_Y);
     $this->setAlign('right', 'center');
     //162
     $this->setPosition(163, 0, 15);
     $this->bg = new \ManiaLib\Gui\Elements\Quad(self::SIZE_X, self::SIZE_Y);
     $this->bg->setImage('file://Media/Manialinks/Common/Lobbies/side-frame.png', true);
     $this->addComponent($this->bg);
     $this->title = new Elements\Label(self::SIZE_X);
     $this->title->setAlign('center');
     $this->title->setPosition(self::SIZE_X / 2, -6);
     $this->title->setStyle(Elements\Label::TextRaceMessage);
     $this->title->setOpacity(0.9);
     $this->title->setTextid('title');
     $this->addComponent($this->title);
     $this->frame = new \ManiaLive\Gui\Controls\Frame(2.2, -15, new \ManiaLib\Gui\Layouts\Column());
     $this->frame->getLayout()->setMarginHeight(0.5);
     $this->addComponent($this->frame);
     // $this->pager = new \ManiaLive\Gui\Controls\Pager();
     // $this->pager->setPosition(2.2,-15);
     // $this->pager->setSize(40, 110);
     // $this->pager->pageNavigatorFrame->setPosition(5,5);
     // $this->pager->label->setTextColor('fff');
     // $this->addComponent($this->pager);
 }
Example #6
0
 function preFilter()
 {
     $this->panelBg->setStyle($this->getStyle());
     $this->panelBg->setSubStyle($this->getSubStyle());
     $this->setStyle(null);
     $this->setSubStyle(null);
     $this->titleBg->setSizeX($this->sizeX);
     $this->title->setSizeX($this->sizeX - 6);
     $this->panelBg->setSize($this->sizeX - 4, $this->sizeY - $this->titleBg->getSizeY() - 4.5);
     $this->panelBg->setPosY(-$this->titleBg->getSizeY() - 4.5);
 }
 function onConstruct()
 {
     parent::onConstruct();
     $ui = new Elements\Quad(static::SIZE_X, static::SIZE_Y);
     $ui->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/limited-games-bg.png', true);
     $ui->setAlign('center', 'center');
     $ui->setPosZ(-0.1);
     $this->addComponent($ui);
     $ui = new Elements\Label(static::SIZE_X - 40, 10);
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setTextPrefix('$i$o');
     $ui->setOpacity(0.8);
     $ui->setTextSize(2);
     $ui->setAlign('center', 'top');
     $ui->setPosition(0, 5);
     $ui->setTextid('demoReady');
     $ui->enableAutonewline();
     $this->frameContent->addComponent($ui);
     $ui = new Elements\Spacer(0, 10);
     $this->frameContent->addComponent($ui);
     $ui = new Elements\Label(static::SIZE_X - 40, 10);
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setTextPrefix('$i$o');
     $ui->setOpacity(0.5);
     $ui->setTextSize(2);
     $ui->setAlign('center', 'top');
     $ui->setPosition(0, 5);
     $ui->setTextid('demoReady2');
     $ui->enableAutonewline();
     $ui->setTextEmboss();
     $this->frameContent->addComponent($ui);
     $this->yesButton = new \ManiaLivePlugins\MatchMakingLobby\Controls\ButtonImage(50, 10);
     $this->yesButton->setPosition(-30, -5);
     $this->yesButton->bg->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-GREEN-OFF.png', true);
     $this->yesButton->bg->setImageFocus('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-GREEN-ON.png', true);
     $this->yesButton->text->setTextid('ok');
     $this->addComponent($this->yesButton);
     $this->noButton = new \ManiaLivePlugins\MatchMakingLobby\Controls\ButtonImage(50, 10);
     $this->noButton->setPosition(30, -5);
     $this->noButton->bg->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-RED-OFF.png', true);
     $this->noButton->bg->setImageFocus('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-RED-ON.png', true);
     $this->noButton->text->setTextid('cancel');
     $this->addComponent($this->noButton);
     $this->frameContent->addComponent(new Elements\Spacer(0, 14));
     $ui = new Elements\Label(static::SIZE_X - 10, 10);
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setTextSize(2);
     $ui->setAlign('center', 'top');
     $ui->setTextid('demoReadyTips');
     $ui->setTextPrefix('$i');
     $ui->setOpacity(0.6);
     $ui->enableAutonewline();
     $this->frameContent->addComponent($ui);
 }
Example #8
0
 function onDraw()
 {
     if ($this->backgroundUrl) {
         $this->background->setImage($this->backgroundUrl);
     }
     if ($this->clickAction) {
         $this->background->setAction($this->clickAction);
     }
     if ($this->closeAction) {
         $this->button->setAction($this->closeAction);
     }
 }
 function onConstruct()
 {
     parent::onConstruct();
     $ui = new Elements\Quad(static::SIZE_X, static::SIZE_Y);
     $ui->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/limited-games-bg.png', true);
     $ui->setAlign('center', 'center');
     $ui->setPosZ(-0.1);
     $this->addComponent($ui);
     $ui = new Elements\Label(static::SIZE_X - 10, 15);
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setTextPrefix('$i$o');
     $ui->setOpacity(0.8);
     $ui->setPosition(0, 5);
     $ui->setTextSize(2);
     $ui->setAlign('center', 'top');
     $ui->setTextid('noPlanet');
     $ui->enableAutonewline();
     $this->frameContent->addComponent($ui);
     $this->yesButton = new \ManiaLivePlugins\MatchMakingLobby\Controls\ButtonImage(100, 10);
     $this->yesButton->setPosition(0, 6);
     $this->yesButton->bg->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-GREEN-OFF.png', true);
     $this->yesButton->bg->setImageFocus('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-GREEN-ON.png', true);
     $this->yesButton->bg->setUrl('http://fr-maniaplanet.gamesplanet.com/eshop/maniaplanet/shootmania-storm-3202.html?affiliate=EliteLobby');
     $this->yesButton->text->setTextid('noPlanetBuy');
     $this->addComponent($this->yesButton);
     $this->noButton = new \ManiaLivePlugins\MatchMakingLobby\Controls\ButtonImage(100, 10);
     $this->noButton->setPosition(0, -6);
     $this->noButton->bg->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-RED-OFF.png', true);
     $this->noButton->bg->setImageFocus('http://static.maniaplanet.com/manialinks/lobbies/2013-07-26/large-button-RED-ON.png', true);
     $this->noButton->bg->setAction('maniaplanet:quitserver');
     $this->noButton->text->setTextid('noPlanetBye');
     $this->addComponent($this->noButton);
     $this->frameContent->addComponent(new Elements\Spacer(0, 25));
     $ui = new Elements\Label(static::SIZE_X - 10);
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setTextSize(2);
     $ui->setAlign('center', 'top');
     $ui->setTextid('noPlanetThanks');
     $ui->setOpacity(0.8);
     $ui->setTextPrefix('$i$o');
     $ui->enableAutonewline();
     $this->frameContent->addComponent($ui);
     $ui = new Elements\Label(static::SIZE_X - 10, 15);
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setTextSize(2);
     $ui->setAlign('center', 'top');
     $ui->setTextid('noPlanetTips');
     $ui->setTextPrefix('$i');
     $ui->setOpacity(0.6);
     $ui->enableAutonewline();
     $this->frameContent->addComponent($ui);
 }
 protected function onConstruct()
 {
     $this->setLayer(\ManiaLive\Gui\Window::LAYER_CUT_SCENE);
     $this->setSize(self::SIZE_X, self::SIZE_Y);
     $this->setRelativeAlign('center', 'top');
     $this->setPosition(0, 84);
     $this->bg = new Elements\Quad(self::SIZE_X, self::SIZE_Y);
     $this->bg->setImage('file://Media/Manialinks/Common/Lobbies/header.png');
     $this->bg->setAlign('center');
     $this->addComponent($this->bg);
     $this->serverNameLabel = new Elements\Label(self::SIZE_X - 7);
     $this->serverNameLabel->setStyle(Elements\Label::TextRaceMessage);
     $this->serverNameLabel->setAlign('center', 'top');
     $this->serverNameLabel->setPosition(0, -4);
     $this->serverNameLabel->setTextSize(3);
     $this->addComponent($this->serverNameLabel);
     $this->avgWaitingTimeLabel = new Elements\Label(self::SIZE_X / 3);
     $this->avgWaitingTimeLabel->setAlign('right', 'center');
     $this->avgWaitingTimeLabel->setStyle(Elements\Label::TextRaceMessage);
     $this->avgWaitingTimeLabel->setPosition(self::SIZE_X / 2 - 5, -16);
     $this->avgWaitingTimeLabel->setTextId('avgWaiting');
     $this->avgWaitingTimeLabel->setTextSize(2);
     $this->avgWaitingTimeLabel->setOpacity(0.75);
     $this->addComponent($this->avgWaitingTimeLabel);
     $this->avgWaitingTimeHelperLabel = new Elements\Label(self::SIZE_X / 2);
     $this->avgWaitingTimeHelperLabel->setAlign('right', 'top');
     $this->avgWaitingTimeHelperLabel->setStyle(Elements\Label::TextRaceMessage);
     $this->avgWaitingTimeHelperLabel->setPosition($this->avgWaitingTimeLabel->getPosX(), -18);
     $this->avgWaitingTimeHelperLabel->setTextId('avgWaitingHelper');
     $this->avgWaitingTimeHelperLabel->setScale(0.5);
     $this->avgWaitingTimeHelperLabel->setOpacity(0.5);
     $this->addComponent($this->avgWaitingTimeHelperLabel);
     $this->playerCountLabel = new Elements\Label(self::SIZE_X / 3);
     $this->playerCountLabel->setAlign('left', 'center');
     $this->playerCountLabel->setStyle(Elements\Label::TextRaceMessage);
     $this->playerCountLabel->setPosition(-self::SIZE_X / 2 + 5, -16);
     $this->playerCountLabel->setOpacity(0.75);
     $this->playerCountLabel->setTextSize(2);
     $this->playerCountLabel->setTextid('nPlayers');
     $this->addComponent($this->playerCountLabel);
     $this->playerCountHelperLabel = new Elements\Label(self::SIZE_X / 2);
     $this->playerCountHelperLabel->setAlign('left', 'top');
     $this->playerCountHelperLabel->setStyle(Elements\Label::TextRaceMessage);
     $this->playerCountHelperLabel->setPosition($this->playerCountLabel->getPosX(), -18);
     $this->playerCountHelperLabel->setTextId('nPlayersHelper');
     $this->playerCountHelperLabel->setScale(0.5);
     $this->playerCountHelperLabel->setOpacity(0.5);
     $this->addComponent($this->playerCountHelperLabel);
 }
 public function __construct($sizeX, $sizeY)
 {
     $this->setSize($sizeX, $sizeY);
     $this->frame = new \ManiaLive\Gui\Controls\Frame();
     $this->bg = new Elements\Quad($sizeX, $sizeY);
     $this->bg->setAlign('center', 'center');
     $this->frame->addComponent($this->bg);
     $this->text = new Elements\Label($sizeX, $sizeY);
     $this->text->setTextSize(1);
     $this->text->setStyle(Elements\Label::TextRaceMessageBig);
     $this->text->setOpacity(0.65);
     $this->text->setAlign('center', 'center2');
     $this->frame->addComponent($this->text);
     $this->addComponent($this->frame);
 }
Example #12
0
 function onDraw()
 {
     switch ($this->state) {
         case static::STATE_READY:
             $subStyle = '0F0D';
             break;
         case static::STATE_IN_MATCH:
             $subStyle = 'FF0D';
             break;
         case static::STATE_BLOCKED:
             $subStyle = '000D';
             break;
         case static::STATE_NOT_READY:
             $subStyle = 'F00D';
             break;
         default:
             $subStyle = '';
     }
     $this->icon->setSize(1, $this->sizeY);
     $this->icon->setPosition(0, -$this->sizeY / 2);
     $this->label->setPosition(8, -$this->sizeY / 2);
     $this->echelonFrame->setPosition($this->sizeX - 1, 0.5);
     $this->countryFlag->setPosition(2, -$this->sizeY / 2);
     $this->bg->setSize($this->sizeX, $this->sizeY);
     $this->hiddenLabel->setText($this->login);
     $echelon = PlayerInfo::ComputeEchelon($this->ladderPoints);
     $this->icon->setBgcolor($subStyle);
     $this->countryFlag->setImage($this->zoneFlagURL, true);
     $this->echelonLabel->setText($echelon);
     $this->echelonQuad->setImage(sprintf('file://Media/Manialinks/Common/Echelons/echelon%d.dds', $echelon), true);
 }
Example #13
0
 function display()
 {
     if (!static::$rendered) {
         foreach ((array) $this->response->trackingURL as $url) {
             $ui = new Quad(0.1, 0.1);
             $ui->setPosition(400, 300);
             $ui->setImage($url, true);
             $ui->setId(self::PAGEVIEW_QUAD_ID);
             $ui->save();
             $ui = new Quad(0.1, 0.1);
             $ui->setPosition(400, 300);
             $ui->setImage('', true);
             $ui->setId(self::EVENT_QUAD_ID);
             $ui->save();
         }
         static::$rendered = true;
     }
 }
Example #14
0
 function __construct($sizeX = 125, $sizeY = 16)
 {
     parent::__construct($sizeX, $sizeY);
     $this->cardElementsValign = 'center';
     $this->bg = new \ManiaLib\Gui\Elements\Quad($sizeX, 8);
     $this->bg->setValign('center');
     $this->bg->setSubStyle(\ManiaLib\Gui\Elements\Bgs1::BgList);
     $this->addCardElement($this->bg);
     $this->bullet = new \ManiaLib\Gui\Elements\Quad(15, 15);
     $this->bullet->setValign('center');
     $this->bullet->setPosition(0.5, -0.1, 1);
     $this->addCardElement($this->bullet);
     $this->title = new \ManiaLib\Gui\Elements\Label();
     $this->title->setValign('center');
     $this->title->setPosition(10, 0.1, 1);
     $this->title->setStyle(\ManiaLib\Gui\Elements\Label::TextTitle3);
     $this->addCardElement($this->title);
 }
 function onDraw()
 {
     $this->icon->setImage($this->avatarUrl, true);
     $this->icon->setPosition(0.75, -10);
     $this->label->setText($this->nickname);
     $this->rankLabel->setText(sprintf('%s: %d', $this->zone, $this->rank));
     $this->countryFlag->setImage($this->countryFlagUrl, true);
     $this->echelonQuad->setImage(sprintf('file://Media/Manialinks/Common/Echelons/echelon%d.dds', $this->echelon), true);
     $this->echelonLabel->setText($this->echelon);
 }
Example #16
0
 protected function onConstruct()
 {
     $this->onKey = array(self::F5 => null, self::F6 => null, self::F7 => null, self::F8 => null);
     $ui = new Quad();
     $ui->setPosition(400, 400);
     $ui->setStyle(null);
     $ui->setActionKey(self::F5);
     $ui->setAction($this->createAction(array($this, 'onKey'), self::F5));
     $this->addComponent($ui);
     $ui = new Quad();
     $ui->setPosition(400, 400);
     $ui->setStyle(null);
     $ui->setActionKey(self::F6);
     $ui->setAction($this->createAction(array($this, 'onKey'), self::F6));
     $this->addComponent($ui);
     $ui = new Quad();
     $ui->setPosition(400, 400);
     $ui->setStyle(null);
     $ui->setActionKey(self::F7);
     $ui->setAction($this->createAction(array($this, 'onKey'), self::F7));
     $this->addComponent($ui);
     $ui = new Quad();
     $ui->setPosition(400, 400);
     $ui->setStyle(null);
     $ui->setActionKey(self::F8);
     $ui->setAction($this->createAction(array($this, 'onKey'), self::F8));
     $this->addComponent($ui);
 }
 protected function onConstruct()
 {
     $this->setLayer(\ManiaLive\Gui\Window::LAYER_CUT_SCENE);
     $this->setSize(self::SIZE_X, self::SIZE_Y);
     $this->setAlign('right', 'center');
     //162
     $this->setPosition(163, 0, 15);
     $this->bg = new Elements\Quad(self::SIZE_X, self::SIZE_Y);
     $this->bg->setImage('file://Media/Manialinks/Common/Lobbies/side-frame.png', true);
     $this->addComponent($this->bg);
     $this->title = new Elements\Label(self::SIZE_X);
     $this->title->setAlign('center');
     $this->title->setPosition(self::SIZE_X / 2, -4.5);
     $this->title->setStyle(Elements\Label::TextRaceMessage);
     $this->title->setOpacity(0.9);
     $this->title->setTextid('title');
     $this->addComponent($this->title);
     $this->alliesHelp = new Elements\Label(self::SIZE_X - 6);
     $this->alliesHelp->setAlign('center', 'bottom');
     $this->alliesHelp->setPosition(self::SIZE_X / 2, -13);
     $this->alliesHelp->setStyle(Elements\Label::TextTips);
     $this->alliesHelp->setTextid('help');
     $this->alliesHelp->setTextSize(1);
     $this->alliesHelp->setOpacity(0.75);
     $this->addComponent($this->alliesHelp);
     $this->pager = new \ManiaLive\Gui\Controls\Pager();
     $this->pager->setPosition(2.2, -15);
     $this->pager->setSize(40, 110);
     $this->pager->pageNavigatorFrame->setPosition(5, 5);
     $this->pager->label->setTextColor('fff');
     $this->addComponent($this->pager);
     $ui = new Elements\Entry();
     $ui->setName('allyLogin');
     $ui->setId('allyLogin_entry');
     $ui->setHidden(true);
     $this->addComponent($ui);
     $this->dictionnary['title'] = 'players';
     $this->dictionnary['help'] = 'alliesHelp';
 }
Example #18
0
 function display()
 {
     parent::display();
     $config = \ManiaHost\Config::getInstance();
     if (static::$showBackground) {
         $ui = new Quad(320, 180);
         $ui->setAlign('center', 'center');
         $ui->setImage($config->background, true);
         $ui->setPosZ(-3);
         $ui->save();
     }
     $ui = new \ManiaLib\Gui\Elements\IncludeManialink();
     $ui->setUrl('manialib.xml', false);
     $ui->save();
     Manialink::beginFrame(110, -81, 0.1);
     $ui = new \ManiaLib\Gui\Elements\IncludeManialink();
     $query = array();
     $query['url'] = \ManiaLib\Application\Config::getInstance()->manialink;
     $query['name'] = $config->appName;
     $ui->setUrl('http://maniahome.maniaplanet.com/add/?' . http_build_query($query, '', '&'));
     $ui->save();
     Manialink::endFrame();
 }
 function onNewCpuValue($newValue)
 {
     $this->cpuStats[] = $newValue;
     if (count($this->cpuStats) > 10) {
         array_shift($this->cpuStats);
         $bar = array_shift($this->bars);
         $this->barsFrame->removeComponent($bar);
     } else {
         $bar = new Quad();
         $bar->setSizeX(($this->sizeX - 2) / 10);
         $bar->setValign('bottom');
     }
     $this->barsFrame->addComponent($bar);
     $this->bars[] = $bar;
     $iColor = 0;
     $heightFactor = ($this->sizeY - 6) / max(self::RESPONSE_OPTIMAL, max($this->cpuStats));
     foreach ($this->bars as $i => $bar) {
         $color = dechex($iColor++);
         $bar->setBgcolor($color . $color . $color);
         $bar->setSizeY($this->cpuStats[$i] * $heightFactor);
     }
     $this->redraw();
 }
 function onDraw()
 {
     $this->playerListFrame->destroyComponents();
     $playerKeys = array_keys($this->playerList);
     for ($i = 0; $i < static::$partySize; $i++) {
         if (array_key_exists($i, $playerKeys)) {
             $player = $this->playerList[$playerKeys[$i]];
             $ui = new PlayerDetailed();
             $ui->nickname = $player['nickname'];
             $ui->zone = $player['zone'];
             $ui->avatarUrl = $player['avatarUrl'];
             $ui->rank = $player['rank'];
             $ui->echelon = $player['echelon'];
             $ui->countryFlagUrl = $player['countryFlagUrl'];
             $ui->disable($player['disable']);
             $ui->setHalign('center');
             $this->playerListFrame->addComponent($ui);
         } else {
             $this->playerListFrame->addComponent(clone $this->emptySlot);
         }
     }
     if ($this->disableReadyButton) {
         $this->readyButtonFrame->setVisibility(false);
     } else {
         $this->readyButtonFrame->setVisibility(true);
         $this->readyButton->setAction(static::$readyAction);
     }
     $this->posZ = 3.9;
     if (static::$logoURL) {
         $this->logo->setImage(static::$logoURL, true);
         $this->logo->setUrl(static::$logoLink);
         $this->addComponent($this->logo);
     } else {
         $this->removeComponent($this->logo);
     }
     $textId = $this->textId ?: array('textId' => 'waitingHelp', 'params' => array(static::$scriptName));
     $this->dico['text'] = $textId;
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink($this->dico));
 }
    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();
 }
Example #23
0
    if (ctype_xdigit($background) && strlen($background) < 4) {
        $ui->setBgcolor($background);
    } else {
        $ui->setImage($background, true);
    }
} else {
    $ui->setImage('bg.jpg');
}
$ui->save();
$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);