improved add & erase buttons

This commit is contained in:
steeffeen 2014-07-05 12:50:26 +02:00
parent c506c7b0da
commit 5066d31ca5
2 changed files with 16 additions and 11 deletions

View File

@ -168,7 +168,7 @@ class StyleManager {
// Background Quad // Background Quad
$backgroundQuad = new Quad(); $backgroundQuad = new Quad();
$frame->add($backgroundQuad); $frame->add($backgroundQuad);
$backgroundQuad->setZ(-1) $backgroundQuad->setZ(-2)
->setSize($width, $height) ->setSize($width, $height)
->setStyles($quadStyle, $quadSubstyle); ->setStyles($quadStyle, $quadSubstyle);

View File

@ -163,6 +163,9 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
->setText('No files found.') ->setText('No files found.')
->setTranslate(true); ->setTranslate(true);
} else { } else {
$canAddMaps = $this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP);
$canEraseMaps = $this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP);
foreach ($mapFiles as $filePath => $fileName) { foreach ($mapFiles as $filePath => $fileName) {
$shortFilePath = substr($filePath, strlen($folderPath)); $shortFilePath = substr($filePath, strlen($folderPath));
@ -183,7 +186,8 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
// Striped background line // Striped background line
$lineQuad = new Quad_BgsPlayerCard(); $lineQuad = new Quad_BgsPlayerCard();
$mapFrame->add($lineQuad); $mapFrame->add($lineQuad);
$lineQuad->setSize($width, 4) $lineQuad->setZ(-1)
->setSize($width, 4)
->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig); ->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
} }
@ -191,12 +195,11 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
$nameLabel = new Label_Text(); $nameLabel = new Label_Text();
$mapFrame->add($nameLabel); $mapFrame->add($nameLabel);
$nameLabel->setX($width * -0.48) $nameLabel->setX($width * -0.48)
->setSize($width * 0.8, 4) ->setSize($width * 0.79, 4)
->setHAlign($nameLabel::LEFT) ->setHAlign($nameLabel::LEFT)
->setTextSize(1) ->setTextSize(1)
->setText($fileName) ->setText($fileName)
->setAreaColor('f00') ->setAction('test');
->setAreaFocusColor('0f0');
if (is_dir($filePath)) { if (is_dir($filePath)) {
// Folder // Folder
@ -204,25 +207,27 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
$nameLabel->setAction($folderAction); $nameLabel->setAction($folderAction);
} else { } else {
// File // File
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { if ($canAddMaps) {
// 'Add' button // 'Add' button
$addButton = new Label_Button(); $addButton = new Label_Button();
$mapFrame->add($addButton); $mapFrame->add($addButton);
$addButton->setPosition($width / 2 - 9, 0, 0.2) $addButton->setX($width * 0.36)
->setSize(3, 3) ->setSize($width * 0.07, 4)
->setTextSize(2) ->setTextSize(2)
->setTextColor('4f0')
->setText('Add') ->setText('Add')
->setTranslate(true) ->setTranslate(true)
->setAction(self::ACTION_ADD_FILE); ->setAction(self::ACTION_ADD_FILE);
} }
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP)) { if ($canEraseMaps) {
// 'Erase' button // 'Erase' button
$eraseButton = new Label_Button(); $eraseButton = new Label_Button();
$mapFrame->add($eraseButton); $mapFrame->add($eraseButton);
$eraseButton->setPosition($width / 2 - 9, 0, 0.2) $eraseButton->setX($width * 0.44)
->setSize(3, 3) ->setSize($width * 0.07, 4)
->setTextSize(2) ->setTextSize(2)
->setTextColor('f40')
->setText('Erase') ->setText('Erase')
->setTranslate(true) ->setTranslate(true)
->setAction(self::ACTION_ERASE_FILE); ->setAction(self::ACTION_ERASE_FILE);