예제 #1
0
 /**
  * Sets the button selected and change its styles accordingly
  */
 function setSelected()
 {
     $this->isSelected = true;
     $this->selectedIcon = new \ManiaLib\Gui\Elements\Icons64x64_1(11);
     $this->selectedIcon->setSubStyle(\ManiaLib\Gui\Elements\Icons64x64_1::ShowRight);
     $this->selectedIcon->setValign('center');
     $this->selectedIcon->setPosX(71);
     $this->addCardElement($this->selectedIcon);
 }
예제 #2
0
 function __construct($sizeX = 90, $sizeY = 8)
 {
     parent::__construct($sizeX, $sizeY);
     $this->setSubStyle(Bgs1::BgCardChallenge);
     $this->name = new Label(85);
     $this->name->setValign('center2');
     $this->name->setPosition(5, -4, 0.1);
     $this->addCardElement($this->name);
     $this->deleteIcon = new Icons64x64_1();
     $this->deleteIcon->setSubStyle(Icons64x64_1::Close);
     $this->deleteIcon->setAlign('right', 'center');
     $this->deleteIcon->setPosition($sizeX - 3, -$sizeY / 2);
     $this->addCardElement($this->deleteIcon);
 }
예제 #3
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 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);
 }
예제 #5
0
파일: Header.php 프로젝트: kremsy/manialib
 function display()
 {
     Manialink::load();
     if (static::$showRefreshButton) {
         $ui = new Icons64x64_1(10);
         $ui->setAlign('right', 'bottom');
         $ui->setSubStyle('Refresh');
         $ui->setPosition(160, -90, 15);
         $ui->setManiazone($this->request->createLink());
         $ui->save();
     }
 }
예제 #6
0
 public function display()
 {
     \ManiaLib\ManiaScript\Main::begin();
     $ui = new \ManiaLib\Gui\Cards\Navigation\Menu();
     $ui->title->setText(\ManiaHost\Config::getInstance()->appName);
     $ui->subTitle->setText('Select maps');
     $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('../upload/');
     $ui->addItem(\ManiaLib\Gui\Cards\Navigation\Menu::BUTTONS_BOTTOM);
     $ui->lastItem->text->setText('Upload');
     $ui->lastItem->icon->setSubStyle(\ManiaLib\Gui\Elements\Icons128x128_1::Save);
     $ui->lastItem->setManialink($manialink);
     $manialink = $this->request->createLinkArgList('../select-map/');
     $ui->quitButton->text->setText('Back');
     $ui->quitButton->setManialink($manialink);
     $ui->save();
     Manialink::beginFrame(17, 66, 0.2);
     $ui = new \ManiaLib\Gui\Cards\Panel(94, 20);
     $ui->setHalign('center');
     $ui->title->setText('Maps');
     $ui->save();
     $ui = new Label();
     $ui->setText($this->response->mapCount);
     $ui->setHalign('right');
     $ui->setPosition(43, -7, 0.1);
     $ui->save();
     Manialink::beginFrame(0, -20, 0);
     $ui = new Bgs1(90, 6);
     $ui->setSubStyle(Bgs1::BgList);
     $ui->setHalign('center');
     $ui->save();
     $manialink = $this->request->createLink();
     $ui = new Icons64x64_1(6, 6);
     $ui->setPosition(-45, 0, 0.1);
     $ui->setSubStyle(Icons64x64_1::ToolUp);
     $ui->setManialink($manialink);
     $ui->save();
     $ui = new Icons64x64_1(6, 6);
     $ui->setHalign('right');
     $ui->setPosition(45, 0, 0.1);
     $ui->setSubStyle(Icons64x64_1::Refresh);
     $ui->setManialink($manialink);
     $ui->save();
     $this->request->set('path', $this->response->path);
     $manialink = $this->request->createLink($this->response->selector);
     $this->request->delete('path');
     $ui = new Icons64x64_1(6, 6);
     $ui->setHalign('right');
     $ui->setPosition(39, 0, 0.1);
     $ui->setSubStyle(Icons64x64_1::ToolRoot);
     $ui->setManialink($manialink);
     $ui->save();
     Manialink::endFrame();
     $layout = new \ManiaLib\Gui\Layouts\Column();
     Manialink::beginFrame(-45, -30, 0.1, 1, $layout);
     foreach ($this->response->files as $file) {
         $this->request->set('filename', $file->path . DIRECTORY_SEPARATOR . $file->filename);
         $card = new \ManiaHost\Cards\File();
         if (in_array($file->path . DIRECTORY_SEPARATOR . $file->filename, $this->response->selected)) {
             $manialink = $this->request->createLink('../unselect/');
             $card->setSubStyle(Bgs1::BgCard);
         } else {
             $manialink = $this->request->createLink('../select/');
         }
         $card->setManialink($manialink);
         $card->name->setText($file->name);
         if (!in_array($file->path . $file->filename, $this->response->used)) {
             $manialink = $this->request->createLink('../delete-map');
             $card->deleteIcon->setId('delete');
             $card->deleteIcon->setScriptEvents();
             \ManiaLib\ManiaScript\UI::dialog('delete', 'Dou you want to delete this map ' . $file->name, array(\ManiaLib\ManiaScript\Action::manialink, $manialink));
         } else {
             $card->deleteIcon->setScale(0);
         }
         $card->save();
     }
     Manialink::endFrame();
     $this->response->multipage->pageNavigator->setPosition(0, -135, 0.1);
     $this->response->multipage->savePageNavigator();
     $manialink = $this->request->createLink('../checkout');
     $ui = new \ManiaLib\Gui\Elements\Button();
     $ui->setText('Play');
     $ui->setAlign('center', 'center2');
     $ui->setPosition(100, -136.25);
     $ui->setManialink($manialink);
     $ui->save();
     Manialink::endFrame();
     \ManiaLib\ManiaScript\Main::loop();
     \ManiaLib\ManiaScript\Main::end();
 }
예제 #7
0
    }
    $url = 'http://maniahome.maniaplanet.com/add/?' . http_build_query($params);
    $ui = new \ManiaLib\Gui\Elements\IncludeManialink();
    $ui->setUrl($url);
    $ui->save();
    Manialink::endFrame();
}
Manialink::beginFrame(188, -1, 0.1);
$ui = new Icons64x64_1(5);
$ui->setSubStyle(Icons64x64_1::ToolUp);
$ui->setScriptEvents();
$ui->setId('view-external');
//$ui->setUrl(ManiaLib\Utils\URI::getCurrent());
$ui->save();
UI::tooltip('view-external', 'Visit the Website');
Event::addListener('view-external', Event::mouseClick, array(Action::external, \ManiaLib\Utils\URI::getCurrent()));
$ui = new Icons64x64_1(5);
$ui->setPosition(5.5);
$ui->setSubStyle(Icons64x64_1::Refresh);
$ui->setScriptEvents();
$ui->setId('refresh-button');
//$ui->setManialink(ManiaLib\Utils\URI::getCurrent());
$ui->save();
UI::tooltip('refresh-button', 'Refresh');
Event::addListener('refresh-button', Event::mouseClick, array(Action::manialink, \ManiaLib\Utils\URI::getCurrent()));
Manialink::endFrame();
Manialink::endFrame();
\ManiaLib\ManiaScript\Main::loop();
\ManiaLib\ManiaScript\Main::end();
maniapress_google_analytics();
Manialink::render();
예제 #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);
     }
 }
예제 #9
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'));
$ui->save();
Manialink::endFrame();
Manialink::beginFrame(145, -8.5, 0.1);
$ui = new \ManiaLib\Gui\Elements\Entry(40, 5);
$ui->setName('search');
$ui->setDefault(\ManiaLib\Application\Request::getInstance()->get('s'));
$ui->save();
$ui = new Icons64x64_1(6);
$ui->setPosition(41, 0.5);
$ui->setSubStyle(Icons64x64_1::Maximize);
$ui->setManialink(maniapress_get_bloginfo('url') . '?s=search');
$ui->save();
Manialink::endFrame();
$layout = new ManiaLib\Gui\Layouts\Line();
$layout->setMarginWidth(1);
Manialink::beginFrame(10, -24, 0.2, 1, $layout);
// TODO MANIAPRESS Handle drop-down menus
$menu = wp_get_nav_menu_object('manialink');
if ($menu) {
    $menu_items = wp_get_nav_menu_items($menu->term_id);
    foreach ((array) $menu_items as $key => $menu_item) {
        $title = $menu_item->title;
        $url = $menu_item->url;