示例#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 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();
     }
 }
示例#4
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();
 }
示例#5
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();
示例#6
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);
     }
 }
示例#7
0
$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;
        $ui = new ManiaLib\Gui\Elements\Button();
        $ui->setText($menu_item->title);