Unified Creations of round Text-Buttons

This commit is contained in:
Alexander Nell
2020-05-07 18:39:27 +02:00
parent 860678e57f
commit 67c9180f9c
5 changed files with 186 additions and 194 deletions

View File

@ -162,67 +162,37 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
// Admin Buttons
if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) {
// Clear Map-Queue
$label = new Label_Button();
$frame->addChild($label);
$label->setText('Clear Map-Queue');
$label->setTextSize(1);
$label->setPosition($width / 2 - 8, $buttonY, 0.1);
$label->setHorizontalAlign($label::RIGHT);
$quad = new Quad_BgsPlayerCard();
$frame->addChild($quad);
$quad->setPosition($width / 2 - 5, $buttonY, 0.01);
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
$quad->setHorizontalAlign($quad::RIGHT);
$quad->setSize(29, 4);
$quad->setAction(self::ACTION_CLEAR_MAPQUEUE);
$clearMapQueueButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
'Clear Map-Queue',
30,
4,
self::ACTION_CLEAR_MAPQUEUE
);
$frame->addChild($clearMapQueueButton);
$clearMapQueueButton->setPosition($width/2 - 5 - 30/2, $buttonY);
}
if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_CHECK_UPDATE)) {
$mxCheckForUpdatesX = $width / 2 - 37;
$buttonWidth = 35;
$iconSize = 3;
// Check Update
$label = new Label_Button();
$frame->addChild($label);
$label->setText('Check MX for Updates');
$label->setPosition($mxCheckForUpdatesX - 1.5, $buttonY, 0.02);
$label->setTextSize(1);
$label->setWidth(30);
$label->setHorizontalAlign($label::RIGHT);
$quad = new Quad_BgsPlayerCard();
$frame->addChild($quad);
$quad->setPosition($mxCheckForUpdatesX, $buttonY, 0.01);
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
$quad->setHorizontalAlign($quad::RIGHT);
$quad->setSize($buttonWidth, 4);
$quad->setAction(self::ACTION_CHECK_UPDATE);
$mxQuad = new Quad();
$frame->addChild($mxQuad);
$mxQuad->setSize($iconSize, $iconSize);
$mxQuad->setImageUrl($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_GREEN));
$mxQuad->setImageFocusUrl($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_GREEN_MOVER));
$mxQuad->setPosition($mxCheckForUpdatesX - $buttonWidth + 3, $buttonY);
$mxQuad->setZ(0.2);
$mxCheckForUpdatesButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
'Check MX for Updates',
36,
4,
self::ACTION_CHECK_UPDATE,
$this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_GREEN)
);
$frame->addChild($mxCheckForUpdatesButton);
$mxCheckForUpdatesButton->setPosition($width/2 - 5 - 30 - 5 - 36/2, $buttonY);
}
if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
// Directory browser
$browserButton = new Label_Button();
$browserButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
'Directory Browser',
36,
4,
DirectoryBrowser::ACTION_SHOW
);
$frame->addChild($browserButton);
$browserButton->setPosition($width / -2 + 20, $buttonY, 0.01);
$browserButton->setTextSize(1);
$browserButton->setText('Directory Browser');
$browserQuad = new Quad_BgsPlayerCard();
$frame->addChild($browserQuad);
$browserQuad->setPosition($width / -2 + 20, $buttonY, 0.01);
$browserQuad->setSubStyle($browserQuad::SUBSTYLE_BgPlayerCardBig);
$browserQuad->setSize(35, 4);
$browserQuad->setAction(DirectoryBrowser::ACTION_SHOW);
$browserButton->setPosition(-$width/2 + 5 + 36/2, $buttonY);
}
// Headline