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);
 }
 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);
     }
 }
Example #4
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);
 }
 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 #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);
     }
 }
Example #8
0
 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 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));
 }