function __construct()
 {
     $this->setTitle('Memory Graph');
     $this->memoryLimit = intval(str_replace('M', 1024 * 1024, ini_get('memory_limit')));
     if ($this->memoryLimit == -1) {
         $this->memoryLimit = Profiler::MEM_DEFAULT;
     }
     $this->barsFrame = new Frame();
     $this->barsFrame->setLayout(new Line());
     $this->addComponent($this->barsFrame);
     $this->linesFrame = new Frame();
     $this->addComponent($this->linesFrame);
     $heightStep = ($this->sizeY - 6) / 4;
     for ($i = 1; $i <= 4; ++$i) {
         $ui = new Frame();
         $ui->setPosition(0, $i * $heightStep);
         $line = new Quad();
         $line->setBgcolor('fff');
         $line->setSize($this->sizeX - 2, 0.2);
         $ui->addComponent($line);
         $text = new Label();
         $text->setText('$fff0% of total');
         $text->setPosition(3, 3.5);
         $ui->addComponent($text);
         $this->linesFrame->addComponent($ui);
         $this->lines[] = array($line, $text, $ui);
     }
     Dispatcher::register(MonitorEvent::getClass(), $this, MonitorEvent::ON_NEW_MEMORY_VALUE);
 }
 protected function onConstruct()
 {
     $bullet = ' $<$ff0$o>$> ';
     $ui = new LegacyLabel(300);
     $ui->setPosition(0, -55);
     $ui->setStyle(LegacyLabel::TextRaceMessageBig);
     $ui->setTextSize(5);
     $ui->setHalign('center');
     $ui->setId('help-label');
     $ui->setTextid('switch');
     $this->addComponent($ui);
     $frame = new Frame();
     $frame->setId('help-frame');
     $ui = new Bgs1(340, 60);
     $ui->setPosition(-170, 0, -0.1);
     $ui->setSubStyle(Bgs1::BgDialogBlur);
     $frame->addComponent($ui);
     $this->textLabel = new LegacyLabel(200);
     $this->textLabel->setPosition(-140, -10);
     $this->textLabel->setStyle(LegacyLabel::TextRaceMessageBig);
     $this->textLabel->setTextSize(5);
     $this->textLabel->enableAutonewline();
     $this->textLabel->setId('help-label');
     $this->textLabel->setTextid('help');
     $frame->addComponent($this->textLabel);
     $allies = new Frame(80, 60);
     $allies->setPosition(100, -2);
     $ui = new LegacyLabel(70);
     $ui->setRelativeAlign('center');
     $ui->setAlign('center');
     $ui->setPosition(0, -3, 0.1);
     $ui->setTextid('tip');
     $ui->setStyle(LegacyLabel::TextTitle3);
     $allies->addComponent($ui);
     $ui = new \ManiaLib\Gui\Elements\Quad(70, 39);
     $ui->setRelativeAlign('center');
     $ui->setAlign('center');
     $ui->setPosition(0, -9, 0.1);
     $ui->setImage('http://static.maniaplanet.com/manialinks/lobbies/set-as-ally.bik', true);
     $allies->addComponent($ui);
     $ui = new LegacyLabel(70);
     $ui->setRelativeAlign('center');
     $ui->setAlign('center');
     $ui->setPosition(0, -50, 0.1);
     $ui->setTextColor('fff');
     $ui->setTextid('note');
     $allies->addComponent($ui);
     $frame->addComponent($allies);
     $this->addComponent($frame);
 }
 function set(array $players, $time)
 {
     $this->time = $time;
     $playerCard = new \ManiaLivePlugins\MatchMakingLobby\Controls\PlayerDetailed();
     $playerCard->setAlign('center');
     foreach ($players as $player) {
         $playerCard->nickname = $player->nickname;
         $playerCard->zone = $player->zone;
         $playerCard->rank = $player->rank;
         $playerCard->avatarUrl = 'file://Avatars/' . $player->login . '/Default';
         $playerCard->countryFlagUrl = $player->zoneFlag;
         $playerCard->echelon = $player->echelon;
         $this->players->addComponent(clone $playerCard);
     }
 }
 protected function updateItemList()
 {
     //$this->pager->clearItems();
     $this->frame->destroyComponents();
     if ($this->orderList) {
         uasort(static::$playerList, function ($p1, $p2) {
             if ($p1['state'] == $p2['state']) {
                 if ($p1['ladderPoints'] == $p2['ladderPoints']) {
                     return 0;
                 }
                 return $p1['ladderPoints'] > $p2['ladderPoints'] ? -1 : 1;
             }
             return $p1['state'] > $p2['state'] ? -1 : 1;
         });
     }
     $count = 0;
     reset(static::$playerList);
     while (current(static::$playerList) && $count++ < 18) {
         $player = current(static::$playerList);
         if ($this->smallCards) {
             $component = new PlayerSmall($player['nickname']);
         } else {
             $component = new Player($player['nickname']);
         }
         $component->state = $player['state'];
         $component->ladderPoints = $player['ladderPoints'];
         $component->zoneFlagURL = $flagURL = sprintf('file://ZoneFlags/Login/%s/country', $player['login']);
         //$this->pager->addItem($component);
         $this->frame->addComponent($component);
         next(static::$playerList);
     }
 }
 function __construct($nickname)
 {
     $this->setSize(46, 5);
     $this->bg = new Elements\Bgs1InRace($this->sizeX, $this->sizeY);
     $this->bg->setBgcolor('3338');
     $this->bg->setBgcolorFocus('CCC8');
     $this->bg->setScriptEvents();
     $this->addComponent($this->bg);
     $this->icon = new Elements\Quad(2, $this->sizeY);
     $this->icon->setBgcolor('F00');
     $this->icon->setAlign('left', 'center');
     $this->addComponent($this->icon);
     $this->label = new Elements\Label(34);
     $this->label->setValign('center2');
     $this->label->setText($nickname);
     $this->label->setTextColor('fff');
     $this->label->setTextSize(1);
     $this->addComponent($this->label);
     $this->hiddenLabel = new Elements\Label();
     $this->hiddenLabel->setHidden(true);
     $this->addComponent($this->hiddenLabel);
     $this->echelonFrame = new \ManiaLive\Gui\Controls\Frame(73.5, 1);
     $this->echelonFrame->setScale(0.29);
     $this->addComponent($this->echelonFrame);
     $this->echelonQuad = new Elements\Quad(14.1551, 17.6938);
     $this->echelonQuad->setPosition(-1.25, -1.25);
     $this->echelonQuad->setAlign('center', 'top');
     $this->echelonFrame->addComponent($this->echelonQuad);
     $ui = new Elements\Label(15);
     $ui->setAlign('center', 'top');
     $ui->setStyle(Elements\Label::TextRaceMessage);
     $ui->setPosition(-1, -4.95625);
     $ui->setTextSize(0.5);
     $ui->setText('Echelon');
     $this->echelonFrame->addComponent($ui);
     $this->echelonLabel = new Elements\Label(10, 10);
     $this->echelonLabel->setAlign('center', 'center');
     $this->echelonLabel->setPosition(-1, -11.895);
     $this->echelonLabel->setStyle(Elements\Label::TextRaceMessageBig);
     $this->echelonFrame->addComponent($this->echelonLabel);
     $this->countryFlag = new Elements\Quad(5, 5);
     $this->countryFlag->setAlign('left', 'center');
     $this->addComponent($this->countryFlag);
     $this->nickname = $nickname;
     $this->state = static::STATE_NOT_READY;
 }
Exemple #6
0
 function __construct()
 {
     $this->items = array();
     $this->currentPage = 0;
     $this->stretchContentX = false;
     $this->needRefresh = false;
     $this->actionNext = $this->createAction(array($this, 'nextPage'));
     $this->actionPrev = $this->createAction(array($this, 'previousPage'));
     $this->pageNavigatorFrame = new Frame();
     $this->addComponent($this->pageNavigatorFrame);
     $this->buttonNext = new Icons64x64_1(9);
     $this->buttonNext->setSubStyle(Icons64x64_1::ArrowNext);
     $this->pageNavigatorFrame->addComponent($this->buttonNext);
     $this->buttonPrev = new Icons64x64_1(9);
     $this->buttonPrev->setSubStyle(Icons64x64_1::ArrowPrev);
     $this->pageNavigatorFrame->addComponent($this->buttonPrev);
     $this->container = new Frame(0, 0, new Column());
     $this->addComponent($this->container);
     $this->label = new Label();
     $this->label->setHalign('center');
     $this->pageNavigatorFrame->addComponent($this->label);
 }
 function addElements(array $players, \ManiaLive\Gui\Controls\Frame $frame)
 {
     $playerCard = new \ManiaLivePlugins\MatchMakingLobby\Controls\PlayerDetailed();
     $playerCard->setScale(0.7);
     $playerCard->setAlign('center');
     foreach ($players as $player) {
         $playerCard->nickname = $player->nickname;
         $playerCard->zone = $player->zone;
         $playerCard->rank = $player->rank;
         $playerCard->avatarUrl = 'file://Avatars/' . $player->login . '/Default';
         $playerCard->countryFlagUrl = $player->zoneFlag;
         $playerCard->echelon = $player->echelon;
         $frame->addComponent(clone $playerCard);
     }
 }
 function onConstruct()
 {
     $this->setLayer(\ManiaLive\Gui\Window::LAYER_CUT_SCENE);
     $this->dico = array('playing' => 'playing', 'rules' => 'rules', 'ready' => 'ready', 'invite' => 'invite', 'readyButton' => 'readyButton', 'players' => 'players', 'allies' => 'party', 'avgWaiting' => 'waitingScreenWaitingLabel', 'rules' => 'rules', 'back' => 'quit');
     //		$ui = new Elements\Quad(320, 20);
     //		$ui->setAlign('center', 'bottom');
     //		$ui->setBgcolor('000');
     //		$ui->setPosition(0,-90);
     //		$this->addComponent($ui);
     $ui = new Elements\Quad(self::SIZE_X, self::SIZE_Y);
     $ui->setAlign('center', 'center');
     $ui->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-08-23/main-bg.png', true);
     $this->addComponent($ui);
     $ui = new Elements\Label(self::SIZE_X);
     $ui->setAlign('center', 'top');
     $ui->setPosition(0, 38);
     $ui->setTextColor('fff');
     $ui->setScale(0.9);
     $ui->setTextSize(2.5);
     $ui->enableAutonewline();
     $ui->setTextid('text');
     $ui->setOpacity(0.9);
     $this->addComponent($ui);
     $frame = new Frame();
     $frame->setScale(0.6);
     $frame->setPosition(0, 20);
     $this->addComponent($frame);
     $this->emptySlot = new \ManiaLivePlugins\MatchMakingLobby\Controls\EmptySlot();
     $this->emptySlot->setSize(80, 20);
     $this->emptySlot->setAlign('center');
     $this->dico[$this->emptySlot->getLabelTextid()] = 'picked';
     $this->playerListFrame = new \ManiaLive\Gui\Controls\Frame(0, 5, new \ManiaLib\Gui\Layouts\Column());
     $this->playerListFrame->getLayout()->setMarginHeight(3);
     $frame->addComponent($this->playerListFrame);
     //quit button start
     $this->quitButtonFrame = new Frame();
     $this->quitButtonFrame->setSize(35, 10);
     $this->quitButtonFrame->setPosition(-47, -36);
     $this->addComponent($this->quitButtonFrame);
     $ui = new Elements\Quad($this->quitButtonFrame->getSizeX(), 10);
     $ui->setAlign('center', 'center');
     $ui->setImage('file://Media/Manialinks/Common/Lobbies/small-button-RED.dds', true);
     $ui->setImageFocus('file://Media/Manialinks/Common/Lobbies/small-button-RED-ON.dds', true);
     $ui->setAction('maniaplanet:quitserver');
     $this->quitButtonFrame->addComponent($ui);
     $ui = new Elements\Label($this->quitButtonFrame->getSizeX());
     $ui->setAlign('center', 'center2');
     $ui->setStyle(Elements\Label::TextRaceMessageBig);
     $ui->setTextid('back');
     $ui->setOpacity(0.8);
     $ui->setTextSize(2);
     $ui->setScale(0.95);
     $this->quitButtonFrame->addComponent($ui);
     //quit button  end
     //learn button start
     if (static::$rulesManialink) {
         $this->learnButtonFrame = new Frame();
         $this->learnButtonFrame->setSize(35, 10);
         $this->learnButtonFrame->setPosition(0, -25);
         $this->addComponent($this->learnButtonFrame);
         $ui = new Elements\Quad($this->learnButtonFrame->getSizeX(), 10);
         $ui->setAlign('center', 'center');
         //			$ui->setImage('file://Media/Manialinks/Common/Lobbies/small-button-YELLOW.dds', true);
         //			$ui->setImageFocus('file://Media/Manialinks/Common/Lobbies/small-button-YELLOW-ON.dds', true);
         $ui->setImage('http://static.maniaplanet.com/manialinks/lobbies/2013-08-23/small-button-YELLOW.dds', true);
         $ui->setImageFocus('http://static.maniaplanet.com/manialinks/lobbies/2013-08-23/small-button-YELLOW-ON.dds', true);
         $ui->setManialink(static::$rulesManialink);
         $this->learnButtonFrame->addComponent($ui);
         $ui = new Elements\Label($this->learnButtonFrame->getSizeX());
         $ui->setAlign('center', 'center2');
         $ui->setStyle(Elements\Label::TextRaceMessageBig);
         $ui->setTextid('rules');
         $ui->setOpacity(0.8);
         $ui->setTextSize(2);
         $ui->setScale(0.95);
         $this->learnButtonFrame->addComponent($ui);
     }
     //learn button  end
     //ready button start
     $this->readyButtonFrame = new Frame();
     $this->readyButtonFrame->setSize(48, 12);
     $this->readyButtonFrame->setPosition(0, -36);
     $this->addComponent($this->readyButtonFrame);
     $this->readyButton = new Elements\Quad(48, $this->readyButtonFrame->getSizeY());
     $this->readyButton->setAlign('center', 'center');
     $this->readyButton->setImage('file://Media/Manialinks/Common/Lobbies/ready-button-GREEN.dds', true);
     $this->readyButton->setImageFocus('file://Media/Manialinks/Common/Lobbies/ready-button-GREEN-ON.dds', true);
     $this->readyButtonFrame->addComponent($this->readyButton);
     $ui = new Elements\Label(48, $this->readyButtonFrame->getSizeY());
     $ui->setAlign('center', 'center2');
     $ui->setStyle(Elements\Label::TextRaceMessageBig);
     $ui->setTextid('readyButton');
     $ui->setOpacity(0.8);
     $ui->setTextSize(2.5);
     $this->readyButtonFrame->addComponent($ui);
     //ready button  end
     //Invite button start
     $this->inviteButtonFrame = new Frame();
     $this->inviteButtonFrame->setSize(35, 10);
     $this->inviteButtonFrame->setPosition(47, -36);
     $this->addComponent($this->inviteButtonFrame);
     $ui = new Elements\Quad($this->inviteButtonFrame->getSizeX(), 10);
     $ui->setAlign('center', 'center');
     $ui->setImage('file://Media/Manialinks/Common/Lobbies/small-button-BLUE.dds', true);
     $ui->setImageFocus('file://Media/Manialinks/Common/Lobbies/small-button-BLUE-ON.dds', true);
     $ui->setManialink(static::$inviteManialink);
     $this->inviteButtonFrame->addComponent($ui);
     $ui = new Elements\Label($this->inviteButtonFrame->getSizeX());
     $ui->setAlign('center', 'center2');
     $ui->setStyle(Elements\Label::TextRaceMessageBig);
     $ui->setTextid('invite');
     $ui->setOpacity(0.8);
     $ui->setTextSize(2);
     $ui->setScale(0.95);
     $this->inviteButtonFrame->addComponent($ui);
     //Invite button end
     $this->logo = new Elements\Quad(80, 20);
     $this->logo->setAlign('center', 'bottom');
     $this->logo->setPosY(-90);
 }
 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();
 }