Fix different interfaces elements positions when changing size settings

This commit is contained in:
Beu 2024-07-13 14:47:11 +02:00
parent 4d1489ed34
commit 8e6fce3e2b
12 changed files with 411 additions and 221 deletions

View File

@ -243,7 +243,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage
*/
public function getPlayersPerPage() {
$pageheight = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
return floor($pageheight * 0.82 / 4);
return floor(($pageheight - 16) / 4);
}
/**

View File

@ -333,21 +333,24 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
}
// Config
$innerWidth = $width - 3;
$innerHeight = $height - 10;
$pagerSize = 9.;
$settingHeight = 5.;
$valueWidth = $innerWidth * 0.3;
$labelTextSize = 2;
$pageMaxCount = floor(($height * 0.85) / $settingHeight);
$pageMaxCount = floor($innerHeight / $settingHeight);
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
@ -357,7 +360,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.35, $height * -0.44, 1);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
@ -367,17 +370,24 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
$descriptionLabel = new Label();
$frame->addChild($descriptionLabel);
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
$descriptionLabel->setPosition($width * -0.45, $height * -0.44);
$descriptionLabel->setSize($width * 0.7, $settingHeight);
$descriptionLabel->setPosition($width * -0.5 + 3, $height * -0.5 + 5);
$descriptionLabel->setSize($width - 30, $settingHeight);
$descriptionLabel->setText('Changes only apply with map skip/restart');
$descriptionLabel->setTextColor('ff0');
$descriptionLabel->setTextSize($labelTextSize);
$descriptionLabel->setTextSize(1);
$descriptionLabel->setTranslate(true);
}
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$pagesFrame = new Frame();
$repositionnedFrame->addChild($pagesFrame);
$pagesFrame->setPosition(2, -1);
// Setting pages
$pageFrame = null;
$posY = 0.;
$index = 0;
foreach ($scriptParams as $key => $scriptParam) {
@ -402,23 +412,23 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$posY = 0.41 * $height;
$pagesFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$index = 1;
}
$settingFrame = new Frame();
$pageFrame->addChild($settingFrame);
$settingFrame->setY($posY);
$settingFrame->setY($settingHeight * $index * -1);
$nameLabel = new Label_Text();
$settingFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setSize(0.4 * $width, $settingHeight);
$nameLabel->setSize($innerWidth * 0.6, $settingHeight);
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
$nameLabel->setText($settingName);
$nameLabel->setTextSize($labelTextSize);
$nameLabel->setX(-0.46 * $width);
$nameLabel->setX(1);
if ($scriptParam->desc === self::DESCRIPTION_HIDDEN) {
$nameLabel->setTextColor("AAAAAA");
}
@ -433,18 +443,18 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
} else {
$activeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_LvlRed);
}
$activeQuad->setX(0.1 * $width);
$activeQuad->setX($innerWidth - $valueWidth - 2.5);
} else {
$currentLabel = new Label_Text();
$settingFrame->addChild($currentLabel);
$currentLabel->setHorizontalAlign(Label_Text::RIGHT);
$currentLabel->setSize(0.2 * $width, 0.9 * $settingHeight);
$currentLabel->setSize($innerWidth * 0.2, 0.9 * $settingHeight);
$currentLabel->setStyle(Label_Text::STYLE_TextValueSmall);
$currentLabel->setText($settingValue[0]);
$currentLabel->setTextColor('aaa');
$currentLabel->setTextPrefix('$i');
$currentLabel->setTextSize(1);
$currentLabel->setX(0.11 * $width);
$currentLabel->setTextSize(0.5);
$currentLabel->setX($innerWidth - $valueWidth);
}
$settingValue = $settingValue[1];
@ -454,7 +464,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
// Boolean checkbox
$quad = new Quad();
$quad->setSize(4, 4);
$quad->setX(0.27 * $width);
$quad->setPosition($innerWidth - $valueWidth / 2, 0);
$checkBox = new CheckBox(self::ACTION_PREFIX_SETTING . $settingName, $settingValue, $quad);
$settingFrame->addChild($checkBox);
} else {
@ -463,25 +473,24 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
$settingFrame->addChild($entry);
$entry->setDefault($settingValue);
$entry->setName(self::ACTION_PREFIX_SETTING . $settingName);
$entry->setSize(0.3 * $width, 0.9 * $settingHeight);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
$entry->setTextSize(1);
$entry->setMaxLength(1000);
$entry->setX(0.275 * $width);
$entry->setPosition($innerWidth - $valueWidth / 2, 0);
$entry->setSize($valueWidth, $settingHeight * 0.9);
}
if ($isScriptMode) {
$descriptionLabel = new Label();
$pageFrame->addChild($descriptionLabel);
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
$descriptionLabel->setPosition(-0.45 * $width, -0.44 * $height);
$descriptionLabel->setSize(0.7 * $width, $settingHeight);
$descriptionLabel->setTextSize($labelTextSize);
$descriptionLabel->setPosition(3, $height * -1 + 5);
$descriptionLabel->setSize($width - 30, $settingHeight);
$descriptionLabel->setTextSize(1);
$descriptionLabel->setTranslate(true);
$nameLabel->addTooltipLabelFeature($descriptionLabel, $scriptParam->desc);
}
$posY -= $settingHeight;
$index++;
}

View File

@ -113,13 +113,13 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
@ -129,7 +129,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.35, $height * -0.44);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
@ -275,13 +275,13 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
@ -291,7 +291,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.35, $height * -0.44);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
@ -387,19 +387,18 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
// Config
$pagerSize = 9.;
$settingHeight = 5.;
$pageMaxCount = floor(($height * 0.78) / $settingHeight);
$posY = 0;
$pageMaxCount = floor(($height - 10) / $settingHeight);
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
@ -409,20 +408,24 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.35, $height * -0.44, 1);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
$paging->setLabel($pageCountLabel);
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$pageFrame = null;
$index = 0;
foreach ($settingClasses as $settingClass) {
if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$posY = $height * 0.41;
$repositionnedFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$index = 1;
}
$classLabel = new Label_Text();
@ -436,15 +439,14 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageFrame->addChild($classLabel);
$classLabel->setHorizontalAlign($classLabel::LEFT);
$classLabel->setPosition($width * -0.45, $posY);
$classLabel->setSize($width * 0.9, $settingHeight * 0.9);
$classLabel->setPosition(2, $settingHeight * $index * -1);
$classLabel->setSize($width - 6, $settingHeight * 0.9);
$classLabel->setStyle($classLabel::STYLE_TextCardSmall);
$classLabel->setTextSize(2);
$classLabel->setText($className);
$classLabel->setTextColor('fff');
$classLabel->setAction(self::ACTION_PREFIX_SETTINGCLASS . $settingClass);
$posY -= $settingHeight;
$index++;
}

View File

@ -106,7 +106,7 @@ class StyleManager implements UsageInformationAble {
// Predefine Description Label
$descriptionLabel = new Label();
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP)->setPosition($width * -0.5 + 10, $height * -0.5 + 5)->setZ(1)->setSize($width * 0.7, 4)->setTextSize(2)->setVisible(false);
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP)->setPosition($width * -0.5 + 10, $height * -0.5 + 5)->setZ(1)->setSize($width * 0.7, 4)->setTextSize(1)->setVisible(false);
return $descriptionLabel;
}
@ -245,18 +245,27 @@ class StyleManager implements UsageInformationAble {
$pagerSize = 6.;
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT)->setPosition($width * 0.40, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(1);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(1);
if ($paging) {
$paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
$paging->addButtonControl($pagerNext);
$paging->addButtonControl($pagerPrev);
$paging->setLabel($pageCountLabel);
}
}

View File

@ -5,6 +5,7 @@ namespace ManiaControl\Maps;
use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Entry;
use FML\Controls\Labels\Label_Button;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons64x64_1;
@ -137,18 +138,31 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
$width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth();
$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
$innerWidth = $width - 2;
$innerHeigth = $height - 20;
$lineHeight = 4.;
$index = 0;
$posY = $height / 2 - 10;
$pageFrame = null;
$pageMaxCount = floor(($height * 0.78) / 4);
$pageMaxCount = floor($innerHeigth / 4);
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$navigateRootQuad = new Quad_Icons64x64_1();
$frame->addChild($navigateRootQuad);
$navigateRootQuad->setPosition($width * -0.47, $height * 0.45)->setSize(4, 4)->setSubStyle($navigateRootQuad::SUBSTYLE_ToolRoot);
$repositionnedFrame->addChild($navigateRootQuad);
$navigateRootQuad->setPosition(5, -5);
$navigateRootQuad->setSize(4, 4);
$navigateRootQuad->setSubStyle($navigateRootQuad::SUBSTYLE_ToolRoot);
$navigateUpQuad = new Quad_Icons64x64_1();
$frame->addChild($navigateUpQuad);
$navigateUpQuad->setPosition($width * -0.44, $height * 0.45)->setSize(4, 4)->setSubStyle($navigateUpQuad::SUBSTYLE_ToolUp);
$repositionnedFrame->addChild($navigateUpQuad);
$navigateUpQuad->setPosition(9, -5);
$navigateUpQuad->setSize(4, 4);
$navigateUpQuad->setSubStyle($navigateUpQuad::SUBSTYLE_ToolUp);
if (!$isInMapsFolder) {
$navigateRootQuad->setAction(self::ACTION_NAVIGATE_ROOT);
@ -156,53 +170,112 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
}
$directoryLabel = new Label_Text();
$frame->addChild($directoryLabel);
$repositionnedFrame->addChild($directoryLabel);
$dataFolder = $this->maniaControl->getServer()->getDirectory()->getUserDataFolder();
$directoryText = substr($folderPath, strlen($dataFolder));
$directoryLabel->setPosition($width * -0.41, $height * 0.45)->setSize($width * 0.85, 4)->setHorizontalAlign($directoryLabel::LEFT)->setText($directoryText)->setTextSize(2);
$directoryLabel->setPosition(12, -5);
$directoryLabel->setSize($width * 0.85, 4);
$directoryLabel->setHorizontalAlign($directoryLabel::LEFT);
$directoryLabel->setText($directoryText);
$directoryLabel->setTextSize(2);
$tooltipLabel = new Label();
$frame->addChild($tooltipLabel);
$tooltipLabel->setPosition($width * -0.48, $height * -0.44)->setSize($width * 0.8, 5)->setHorizontalAlign($tooltipLabel::LEFT)->setTextSize(1);
$repositionnedFrame->addChild($tooltipLabel);
$tooltipLabel->setPosition(3, $height + 5);
$tooltipLabel->setSize($width * 0.8, 5);
$tooltipLabel->setHorizontalAlign($tooltipLabel::LEFT);
$tooltipLabel->setTextSize(1);
// Download button
$backButton = new Label_Button();
$repositionnedFrame->addChild($backButton);
$backButton->setStyle($backButton::STYLE_CardMain_Quit);
$backButton->setHorizontalAlign($backButton::LEFT);
$backButton->setScale(0.5);
$backButton->setText('Back');
$backButton->setPosition(3, $height * -1 + 5);
$backButton->setAction(MapCommands::ACTION_OPEN_MAPLIST);
$label = new Label_Text();
$repositionnedFrame->addChild($label);
$label->setPosition(25, $height * -1 + 5);
$label->setHorizontalAlign($label::LEFT);
$label->setTextSize(1);
$label->setText('Download from URL: ');
$entry = new Entry();
$repositionnedFrame->addChild($entry);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
$entry->setHorizontalAlign($entry::LEFT);
$entry->setPosition(53, $height * -1 + 5);
$entry->setTextSize(1);
$entry->setSize($width * 0.35, 4);
$entry->setName("Value");
//Search for Map-Name
$downloadButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
'Download',
18,
5,
self::ACTION_DOWNLOAD_FILE
);
$repositionnedFrame->addChild($downloadButton);
$downloadButton->setPosition(53 + 18 / 2 + $width * 0.35, $height * -1 + 5);
$mapFiles = $this->scanMapFiles($folderPath);
if (is_array($mapFiles)) {
if (empty($mapFiles)) {
$emptyLabel = new Label();
$frame->addChild($emptyLabel);
$emptyLabel->setY(20)->setTextColor('aaa')->setText('No files found.')->setTranslate(true);
$repositionnedFrame->addChild($emptyLabel);
$emptyLabel->setPosition($innerWidth * 0.5, $innerHeigth * -0.5);
$emptyLabel->setTextColor('aaa');
$emptyLabel->setText('No files found.');
$emptyLabel->setTranslate(true);
} else {
$canAddMaps = $this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP);
$canEraseMaps = $this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP);
$pagesFrame = new Frame();
$repositionnedFrame->addChild($pagesFrame);
$pagesFrame->setPosition(1, -10);
foreach ($mapFiles as $filePath => $fileName) {
$shortFilePath = substr($filePath, strlen($folderPath));
if ($index % $pageMaxCount === 0) {
// New Page
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$posY = $height / 2 - 10;
$pagesFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$index = 1;
}
// Map Frame
$mapFrame = new Frame();
$pageFrame->addChild($mapFrame);
$mapFrame->setY($posY);
$mapFrame->setY($lineHeight * $index * -1);
if ($index % 2 === 0) {
// Striped background line
$lineQuad = new Quad_BgsPlayerCard();
$mapFrame->addChild($lineQuad);
$lineQuad->setZ(-1)->setSize($width, 4)->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
$lineQuad->setX($innerWidth / 2);
$lineQuad->setZ(-1);
$lineQuad->setSize($width, $lineHeight);
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
}
// File name Label
$nameLabel = new Label_Text();
$mapFrame->addChild($nameLabel);
$nameLabel->setX($width * -0.48)->setSize($width * 0.79, 4)->setHorizontalAlign($nameLabel::LEFT)->setStyle($nameLabel::STYLE_TextCardRaceRank)->setTextSize(1)->setText($fileName);
$nameLabel->setX(2);
$nameLabel->setSize($innerWidth - 20, $lineHeight);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setStyle($nameLabel::STYLE_TextCardRaceRank);
$nameLabel->setTextSize(1);
$nameLabel->setText($fileName);
if (substr($fileName, -1) === DIRECTORY_SEPARATOR) $nameLabel->setTextPrefix(' ');
if (is_dir($filePath)) {
// Folder
@ -215,58 +288,35 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
// 'Add' button
$addButton = new Quad_UIConstructionBullet_Buttons();
$mapFrame->addChild($addButton);
$addButton->setX($width * 0.42)->setSize(4, 4)->setSubStyle($addButton::SUBSTYLE_NewBullet)->setAction(self::ACTION_ADD_FILE . $fileName)->addTooltipLabelFeature($tooltipLabel, 'Add map ' . $fileName);
$addButton->setX($width - 5);
$addButton->setSize(4, 4);
$addButton->setSubStyle($addButton::SUBSTYLE_NewBullet);
$addButton->setAction(self::ACTION_ADD_FILE . $fileName);
$addButton->addTooltipLabelFeature($tooltipLabel, 'Add map ' . $fileName);
}
if ($canEraseMaps) {
// 'Erase' button
$eraseButton = new Quad_UIConstruction_Buttons();
$mapFrame->addChild($eraseButton);
$eraseButton->setX($width * 0.46)->setSize(4, 4)->setSubStyle($eraseButton::SUBSTYLE_Erase)->setAction(self::ACTION_ERASE_FILE . $fileName)->addTooltipLabelFeature($tooltipLabel, 'Erase file ' . $fileName);
$eraseButton->setX($width - 10);
$eraseButton->setSize(4, 4);
$eraseButton->setSubStyle($eraseButton::SUBSTYLE_Erase);
$eraseButton->setAction(self::ACTION_ERASE_FILE . $fileName);
$eraseButton->addTooltipLabelFeature($tooltipLabel, 'Erase file ' . $fileName);
}
}
$posY -= 4;
$index++;
}
}
$downloadPosX = -$width / 2 + 5;
$label = new Label_Text();
$frame->addChild($label);
$label->setPosition($downloadPosX, $height * -0.39);
$label->setHorizontalAlign($label::LEFT);
$label->setTextSize(1);
$label->setText('Download from URL: ');
$downloadPosX += 30;
$entry = new Entry();
$frame->addChild($entry);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
$entry->setHorizontalAlign($entry::LEFT);
$entry->setPosition($downloadPosX, $height * -0.39);
$entry->setTextSize(1);
$entry->setSize($width * 0.35, 4);
$entry->setName("Value");
$downloadPosX += $width * 0.35 + 10;
//Search for Map-Name
$mapNameButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
'Download',
18,
5,
self::ACTION_DOWNLOAD_FILE
);
$frame->addChild($mapNameButton);
$mapNameButton->setPosition($downloadPosX, $height * -0.39);
} else {
$errorLabel = new Label();
$frame->addChild($errorLabel);
$errorLabel->setY(20)->setTextColor('f30')->setText('No access to the directory.')->setTranslate(true);
$repositionnedFrame->addChild($errorLabel);
$errorLabel->setPosition($innerWidth * 0.5, $innerHeigth * -0.5);
$errorLabel->setTextColor('f30');
$errorLabel->setText('No access to the directory.');
$errorLabel->setTranslate(true);
}
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, self::WIDGET_NAME);
@ -302,6 +352,15 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
}
}
}
uasort($mapFiles, function ($a, $b) {
$aIsDir = (substr($a, -1) === DIRECTORY_SEPARATOR);
$bIsDir = (substr($b, -1) === DIRECTORY_SEPARATOR);
if ($aIsDir && !$bIsDir) return -1;
else if (!$aIsDir && $bIsDir) return 1;
return 0;
});
return $mapFiles;
}

View File

@ -135,7 +135,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth();
$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
$buttonY = $height * -0.39;
$buttonY = $height * -0.5 + 10;
if ($pageIndex < 0) {
$pageIndex = (int) $player->getCache($this, self::CACHE_CURRENT_PAGE);
@ -178,7 +178,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
self::ACTION_CLEAR_MAPQUEUE
);
$frame->addChild($clearMapQueueButton);
$clearMapQueueButton->setPosition($width/2 - 5 - 30/2, $buttonY);
$clearMapQueueButton->setPosition($width * 0.5 - 5 - 30/2, $buttonY);
}
if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_CHECK_UPDATE)) {
@ -190,7 +190,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_GREEN)
);
$frame->addChild($mxCheckForUpdatesButton);
$mxCheckForUpdatesButton->setPosition($width/2 - 5 - 30 - 5 - 36/2, $buttonY);
$mxCheckForUpdatesButton->setPosition($width * 0.5 - 5 - 30 - 5 - 36/2, $buttonY);
}
if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
@ -201,7 +201,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
DirectoryBrowser::ACTION_SHOW
);
$frame->addChild($browserButton);
$browserButton->setPosition(-$width/2 + 5 + 36/2, $buttonY);
$browserButton->setPosition($width * -0.5 + 36 / 2, $buttonY);
}
// Headline
@ -214,7 +214,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$labelLine->addLabelEntryText('Id', $posX + 5);
$labelLine->addLabelEntryText('Mx Id', $posX + 10);
$labelLine->addLabelEntryText('Map Name', $posX + 20);
$labelLine->addLabelEntryText('Author', $posX + 68);
$labelLine->addLabelEntryText('Author', $width / 2 - 56);
$labelLine->addLabelEntryText('Actions', $width / 2 - 16);
$labelLine->setY(-7);
$labelLine->render();
@ -284,7 +284,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$mxQuad->setSize(3, 3);
$mxQuad->setImageUrl($mxIcon);
$mxQuad->setImageFocusUrl($mxIconHover);
$mxQuad->setX($posX + 65);
$mxQuad->setX($width / 2 - 63);
$mxQuad->setUrl($map->mx->pageurl);
$mxQuad->setZ(0.01);
$description = 'View ' . $map->getEscapedName() . ' on Mania-Exchange';
@ -296,7 +296,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$mxQuad->setSize(3, 3);
$mxQuad->setImageUrl($mxIconGreen);
$mxQuad->setImageFocusUrl($mxIconGreenHover);
$mxQuad->setX($posX + 62);
$mxQuad->setX($width / 2 - 60);
$mxQuad->setUrl($map->mx->pageurl);
$mxQuad->setZ(0.01);
$description = 'Update for ' . $map->getEscapedName() . ' available on Mania-Exchange!';
@ -313,12 +313,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$labelLine = new LabelLine($mapFrame);
$labelLine->addLabelEntryText($mapListId, $posX + 5, 5);
$labelLine->addLabelEntryText($mxId, $posX + 10, 10);
$labelLine->addLabelEntryText(Formatter::stripDirtyCodes($map->name), $posX + 20, 42);
$labelLine->addLabelEntryText(Formatter::stripDirtyCodes($map->name), $posX + 20, $width - 20 - 56 - 5);
$label = new Label_Text();
$mapFrame->addChild($label);
$label->setText($map->authorNick);
$label->setX($posX + 68);
$label->setX($width / 2 - 56);
$label->setSize(47, 0);
$label->setAction(MapCommands::ACTION_SHOW_AUTHOR . $map->authorLogin);
$description = 'Click to checkout all maps by $<' . $map->authorLogin . '$>!';
@ -461,7 +461,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
*/
public function getMapPerPage() {
$pageheight = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
return floor(($pageheight - 16 - $pageheight * 0.11) / 4);
return floor(($pageheight - 26) / 4);
}
/**

View File

@ -79,8 +79,9 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
// Config
$pagerSize = 9.;
$entryHeight = 5.;
$pageMaxCount = floor(($height * 0.85) / $entryHeight);
$posY = 0.;
$innerWidth = $width - 4;
$innerHeight = $height - 16;
$pageMaxCount = floor($innerHeight / $entryHeight);
$pageFrame = null;
$url = ManiaControl::URL_WEBSERVICE . 'plugins';
@ -106,24 +107,42 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = clone $pagerPrev;
$frame->addChild($pagerNext);
$pagerNext->setX($width * 0.45);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSubStyle($pagerPrev::SUBSTYLE_ArrowNext);
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT)->setPosition($width * 0.35, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(2);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
$paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
$paging->addButtonControl($pagerNext);
$paging->addButtonControl($pagerPrev);
$paging->setLabel($pageCountLabel);
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
// Info tooltip
$infoTooltipLabel = new Label();
$frame->addChild($infoTooltipLabel);
$infoTooltipLabel->setAlign($infoTooltipLabel::LEFT, $infoTooltipLabel::TOP)->setPosition($width * -0.45, $height * -0.22)->setSize($width * 0.7, $entryHeight)->setTextSize(1)->setTranslate(true)->setVisible(false)->setAutoNewLine(true)->setMaxLines(5);
$repositionnedFrame->addChild($infoTooltipLabel);
$infoTooltipLabel->setAlign($infoTooltipLabel::LEFT, $infoTooltipLabel::TOP);
$infoTooltipLabel->setPosition(3, $height * -1 + 16);
$infoTooltipLabel->setSize($width - 30, 20);
$infoTooltipLabel->setTextSize(1);
$infoTooltipLabel->setTranslate(true);
$infoTooltipLabel->setVisible(false);
$infoTooltipLabel->setAutoNewLine(true);
$infoTooltipLabel->setMaxLines(5);
// List plugins
foreach ($pluginList as $plugin) {
if ($this->maniaControl->getPluginManager()->isPluginIdInstalled($plugin->id)) {
@ -139,18 +158,23 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
if ($index % $pageMaxCount === 0) {
// New page
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$repositionnedFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$posY = $height * 0.41;
$index = 1;
}
$pluginFrame = new Frame();
$pageFrame->addChild($pluginFrame);
$pluginFrame->setY($posY);
$pluginFrame->setY($entryHeight * $index * -1);
$nameLabel = new Label_Text();
$pluginFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT)->setX($width * -0.46)->setSize($width * 0.62, $entryHeight)->setStyle($nameLabel::STYLE_TextCardSmall)->setTextSize(2)->setText($plugin->name);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setX(2);
$nameLabel->setSize($innerWidth * 0.6, $entryHeight);
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
$nameLabel->setTextSize(2);
$nameLabel->setText($plugin->name);
$description = "Author: {$plugin->author}\nVersion: {$plugin->currentVersion->version}\nDesc: {$plugin->description}";
$infoTooltipLabel->setLineSpacing(1);
@ -160,7 +184,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
// Incompatibility label
$infoLabel = new Label_Text();
$pluginFrame->addChild($infoLabel);
$infoLabel->setHorizontalAlign($infoLabel::RIGHT)->setX($width * 0.47)->setSize($width * 0.33, $entryHeight)->setTextSize(1)->setTextColor('f30');
$infoLabel->setHorizontalAlign($infoLabel::RIGHT)->setX($innerWidth * 0.47)->setSize($innerWidth * 0.33, $entryHeight)->setTextSize(1)->setTextColor('f30');
if ($plugin->currentVersion->min_mc_version > ManiaControl::VERSION) {
$infoLabel->setText("Needs at least MC-Version '{$plugin->currentVersion->min_mc_version}'");
} else {
@ -170,17 +194,24 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
// Install button
$installButton = new Label_Button();
$pluginFrame->addChild($installButton);
$installButton->setHorizontalAlign($installButton::RIGHT)->setX($width * 0.47)->setStyle($installButton::STYLE_CardButtonSmall)->setText('Install')->setTranslate(true)->setAction(self::ACTION_PREFIX_INSTALL_PLUGIN . $plugin->id);
$installButton->setHorizontalAlign($installButton::RIGHT);
$installButton->setSize($innerWidth * 0.3, $entryHeight);
$installButton->setX($innerWidth - 4);
$installButton->setStyle($installButton::STYLE_CardButtonSmall);
$installButton->setText('Install');
$installButton->setTranslate(true);
$installButton->setAction(self::ACTION_PREFIX_INSTALL_PLUGIN . $plugin->id);
if ($plugin->currentVersion->verified > 0) {
// Suggested quad
$suggestedQuad = new Quad_Icons64x64_1();
$pluginFrame->addChild($suggestedQuad);
$suggestedQuad->setPosition($width * 0.45, $entryHeight * 0.12, 2)->setSize(4, 4)->setSubStyle($suggestedQuad::SUBSTYLE_StateSuggested);
$suggestedQuad->setPosition($innerWidth - 2, $entryHeight * 0.12, 2);
$suggestedQuad->setSize(4, 4);
$suggestedQuad->setSubStyle($suggestedQuad::SUBSTYLE_StateSuggested);
}
}
$posY -= $entryHeight;
$index++;
}
}

View File

@ -107,18 +107,18 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
// Config
$pagerSize = 9.;
$entryHeight = 5.;
$pageMaxCount = floor(($height * 0.70) / $entryHeight);
$pageMaxCount = floor(($height - 16) / $entryHeight);
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
@ -128,7 +128,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.35, $height * -0.44, 1);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
@ -161,25 +161,34 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
return strcmp($pluginClassA::getName(), $pluginClassB::getName());
});
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$pagesFrame = new Frame();
$repositionnedFrame->addChild($pagesFrame);
$pagesFrame->setY(-1);
$index = 0;
$pageFrame = null;
foreach ($pluginClasses as $index => $pluginClass) {
foreach ($pluginClasses as $pluginClass) {
/** @var Plugin $pluginClass */
if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$pagesFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$posY = $height * 0.41;
$index = 1;
}
$active = $this->maniaControl->getPluginManager()->isPluginActive($pluginClass);
$pluginFrame = new Frame();
$pageFrame->addChild($pluginFrame);
$pluginFrame->setY($posY);
$pluginFrame->setY($entryHeight * $index * -1);
$activeQuad = new Quad_Icons64x64_1();
$pluginFrame->addChild($activeQuad);
$activeQuad->setPosition($width * -0.45, -0.1, 1);
$activeQuad->setPosition(2.5, -0.1, 1);
$activeQuad->setSize($entryHeight * 0.9, $entryHeight * 0.9);
if ($active) {
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlGreen);
@ -190,18 +199,18 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$nameLabel = new Label_Text();
$pluginFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setX($width * -0.4);
$nameLabel->setSize($width * 0.5, $entryHeight);
$nameLabel->setX(5);
$nameLabel->setSize($width - 50, $entryHeight);
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
$nameLabel->setTextSize(2);
$nameLabel->setText($pluginClass::getName());
$descriptionLabel = new Label();
$pageFrame->addChild($descriptionLabel);
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::BOTTOM);
$descriptionLabel->setPosition($width * -0.45, $height * -0.45);
$descriptionLabel->setSize($width * 0.7, $entryHeight);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
$descriptionLabel->setPosition(3, $height * -1 + 16);
$descriptionLabel->setSize($width - 30, 20);
$descriptionLabel->setTextSize(1);
$descriptionLabel->setTranslate(true);
$descriptionLabel->setVisible(false);
$descriptionLabel->setMaxLines(5);
@ -212,7 +221,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$quad = new Quad_Icons128x32_1();
$pluginFrame->addChild($quad);
$quad->setSubStyle($quad::SUBSTYLE_Settings);
$quad->setX(15);
$quad->setX($width - 45);
$quad->setZ(1);
$quad->setSize(5, 5);
$quad->setAction(self::ACTION_PREFIX_SETTINGS . $pluginClass);
@ -220,14 +229,12 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$statusChangeButton = new Label_Button();
$pluginFrame->addChild($statusChangeButton);
$statusChangeButton->setHorizontalAlign($statusChangeButton::RIGHT);
$statusChangeButton->setX($width * 0.45);
$statusChangeButton->setX($width - 6);
$statusChangeButton->setStyle($statusChangeButton::STYLE_CardButtonSmall);
if ($active) {
$statusChangeButton->setTextPrefix('$f00');
$statusChangeButton->setText('Deactivate');
$statusChangeButton->setAction(self::ACTION_PREFIX_DISABLEPLUGIN . $pluginClass);
} else {
$statusChangeButton->setTextPrefix('a');
$statusChangeButton->setText('Activate');
$statusChangeButton->setAction(self::ACTION_PREFIX_ENABLEPLUGIN . $pluginClass);
}
@ -236,13 +243,13 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$quadUpdate = new Quad_Icons128x128_1();
$pluginFrame->addChild($quadUpdate);
$quadUpdate->setSubStyle($quadUpdate::SUBSTYLE_ProfileVehicle);
$quadUpdate->setX($width / 2 - 3);
$quadUpdate->setX($width - 3.5);
$quadUpdate->setZ(2);
$quadUpdate->setSize(5, 5);
$quadUpdate->setAction(self::ACTION_PREFIX_UPDATEPLUGIN . $pluginClass);
}
$posY -= $entryHeight;
$index++;
}
if ($pluginUpdates) {
@ -275,18 +282,36 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$settings = $this->maniaControl->getSettingManager()->getSettingsByClass($settingClass);
$isunlinkable = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getSettingManager(), SettingManager::SETTING_ALLOW_UNLINK_SERVER);
$posY = 0;
$index = 0;
$settingHeight = 5.;
$pageSettingsMaxCount = floor(($height * 0.70) / $settingHeight);
$pageFrame = null;
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$pagesFrame = new Frame();
$repositionnedFrame->addChild($pagesFrame);
$pagesFrame->setY(-8.);
if ($isunlinkable) {
$pagesFrame->setX(5.); // move a bit the settings to diplay the padlocks
$innerWidth = $width - 6;
} else {
$pagesFrame->setX(2.);
$innerWidth = $width - 3;
}
$innerHeight = $height - 8 - 10;
$settingHeight = 5.;
$valueWidth = $innerWidth * 0.3;
$pageSettingsMaxCount = floor($innerHeight / $settingHeight);
$index = 0;
$pageFrame = null;
//Headline Label
$headLabel = new Label_Text();
$frame->addChild($headLabel);
$repositionnedFrame->addChild($headLabel);
$headLabel->setHorizontalAlign($headLabel::LEFT);
$headLabel->setPosition($width * -0.46, $height * 0.41);
$headLabel->setSize($width * 0.6, $settingHeight);
$headLabel->setPosition(3, -6);
$headLabel->setSize($width - 6, $settingHeight);
$headLabel->setStyle($headLabel::STYLE_TextCardSmall);
$headLabel->setTextSize(3);
$headLabel->setText($settingClass);
@ -300,38 +325,37 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
foreach ($settings as $setting) {
if ($index % $pageSettingsMaxCount === 0) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$pagesFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$posY = $height * 0.41 - $settingHeight * 1.5;
$index = 1;
}
$settingFrame = new Frame();
$pageFrame->addChild($settingFrame);
$settingFrame->setY($posY);
$settingFrame->setY($settingHeight * $index * -1);
$nameLabel = new Label_Text();
$settingFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setX($width * -0.46);
$nameLabel->setSize($width * 0.6, $settingHeight);
$nameLabel->setSize($innerWidth * 0.6, $settingHeight);
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
$nameLabel->setTextSize(2);
$nameLabel->setText($setting->setting);
$nameLabel->setTextColor('fff');
$descriptionLabel = new Label_Text();
$pageFrame->addChild($descriptionLabel);
$repositionnedFrame->addChild($descriptionLabel);
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
$descriptionLabel->setPosition(-0.45 * $width, $height * -0.38);
$descriptionLabel->setSize(0.9 * $width, $settingHeight);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setPosition(3, $height * -1 + 10);
$descriptionLabel->setSize($innerWidth - 6, $settingHeight);
$descriptionLabel->setTextSize(1);
$descriptionLabel->setTranslate(true);
$nameLabel->addTooltipLabelFeature($descriptionLabel, $setting->description);
if ($isunlinkable) {
$quadlink = new Quad();
$settingFrame->addChild($quadlink);
$quadlink->setPosition(-0.48 * $width, 0.2, -0.01);
$quadlink->setPosition(-2, 0.2);
$quadlink->setSize(4, 4);
$quadlink->setColorize("ccccccaa");
$quadlink->setStyle("UICommon64_1");
@ -342,15 +366,15 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
if ($setting->type === Setting::TYPE_BOOL) {
// Boolean checkbox
$quad = new Quad();
$quad->setPosition($width * 0.33, 0, -0.01);
$quad->setPosition($innerWidth - $valueWidth / 2, 0);
$quad->setSize(4, 4);
$checkBox = new CheckBox(self::ACTION_PREFIX_SETTING . $setting->index, $setting->value, $quad);
$settingFrame->addChild($checkBox);
} else if ($setting->type === Setting::TYPE_SET) {
// SET value picker
$label = new Label_Text();
$label->setX($width * 0.33);
$label->setSize($width * 0.3, $settingHeight * 0.9);
$label->setPosition($innerWidth - $valueWidth / 2, 0);
$label->setSize($valueWidth, $settingHeight * 0.9);
$label->setStyle($label::STYLE_TextValueSmall);
$label->setTextSize(1);
$valuePicker = new ValuePicker(self::ACTION_PREFIX_SETTING . $setting->index, $setting->set, $setting->value, $label);
@ -359,8 +383,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
// Value entry
$entry = new Entry();
$settingFrame->addChild($entry);
$entry->setX($width * 0.33);
$entry->setSize($width * 0.3, $settingHeight * 0.9);
$entry->setPosition($innerWidth - $valueWidth / 2, 0);
$entry->setSize($valueWidth, $settingHeight * 0.9);
$entry->setTextSize(1);
$entry->setMaxLength(1000);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
@ -368,18 +392,16 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$entry->setDefault($setting->value);
}
$posY -= $settingHeight;
$index++;
}
$backButton = new Label_Button();
$frame->addChild($backButton);
$repositionnedFrame->addChild($backButton);
$backButton->setStyle($backButton::STYLE_CardMain_Quit);
$backButton->setHorizontalAlign($backButton::LEFT);
$backButton->setScale(0.5);
$backButton->setText('Back');
$backButton->setPosition(-$width / 2 + 5, -$height / 2 + 5);
$backButton->setPosition(5 , $height * -1 + 5);
$backButton->setAction(self::ACTION_BACK_TO_PLUGINS);
if ($isunlinkable) {
@ -389,8 +411,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
5,
self::ACTION_PREFIX_MANAGE_SETTING_LINK . $settingClass
);
$frame->addChild($mapNameButton);
$mapNameButton->setPosition(-$width / 2 + 60, $height * -0.45);
$repositionnedFrame->addChild($mapNameButton);
$mapNameButton->setPosition(60, $height * -1 + 5);
}
return $frame;
@ -410,10 +432,21 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
public function getManageSettingsLink(Frame $frame, $width, $height, Paging $paging, Player $player, $settingClass) {
$settings = $this->maniaControl->getSettingManager()->getSettingsByClass($settingClass);
$posY = 0;
$index = 0;
$settingHeight = 5.;
$pageSettingsMaxCount = floor(($height * 0.78) / $settingHeight);
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$pagesFrame = new Frame();
$repositionnedFrame->addChild($pagesFrame);
$pagesFrame->setY(-8.);
$pagesFrame->setX(5.);
$innerWidth = $width - 6;
$innerHeight = $height - 8 - 10;
$settingHeight = 5.;
$pageSettingsMaxCount = floor($innerHeight / $settingHeight);
$index = 0;
$pageFrame = null;
if (count($settings) > 64) {
@ -423,10 +456,10 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
//Headline Label
$headLabel = new Label_Text();
$frame->addChild($headLabel);
$repositionnedFrame->addChild($headLabel);
$headLabel->setHorizontalAlign($headLabel::LEFT);
$headLabel->setPosition($width * -0.46, $height * 0.41);
$headLabel->setSize($width * 0.6, $settingHeight);
$headLabel->setPosition(3, -6);
$headLabel->setSize($width - 6, $settingHeight);
$headLabel->setStyle($headLabel::STYLE_TextCardSmall);
$headLabel->setTextSize(3);
$headLabel->setText($settingClass);
@ -435,54 +468,51 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
foreach ($settings as $setting) {
if ($index % $pageSettingsMaxCount === 0) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$pagesFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$posY = $height * 0.41 - $settingHeight * 1.5;
$index = 1;
}
$settingFrame = new Frame();
$pageFrame->addChild($settingFrame);
$settingFrame->setY($posY);
$settingFrame->setY($settingHeight * $index * -1);
$nameLabel = new Label_Text();
$settingFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setX($width * -0.46);
$nameLabel->setSize($width * 0.6, $settingHeight);
$nameLabel->setSize($innerWidth * 0.6, $settingHeight);
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
$nameLabel->setTextSize(2);
$nameLabel->setText($setting->setting);
$nameLabel->setTextColor('fff');
$descriptionLabel = new Label_Text();
$pageFrame->addChild($descriptionLabel);
$repositionnedFrame->addChild($descriptionLabel);
$descriptionLabel->setHorizontalAlign($descriptionLabel::LEFT);
$descriptionLabel->setPosition(-0.45 * $width, $height * -0.40);
$descriptionLabel->setSize(0.9 * $width, $settingHeight);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setPosition(3, $height * -1 + 10);
$descriptionLabel->setSize($innerWidth - 6, $settingHeight);
$descriptionLabel->setTextSize(1);
$descriptionLabel->setTranslate(true);
$nameLabel->addTooltipLabelFeature($descriptionLabel, $setting->description);
$quad = new Quad();
$quad->setPosition($width * 0.33, 0.2, -0.01);
$quad->setPosition($innerWidth - $innerWidth * 0.3 / 2, 0.2);
$quad->setSize(4, 4);
$checkBox = new CheckBox(self::ACTION_PREFIX_SETTING_LINK . $setting->index, $setting->linked, $quad);
$checkBox->setEnabledDesign("UICommon64_1", "Padlock_light");
$checkBox->setDisabledDesign("UICommon64_1", "Padlock_light");
$settingFrame->addChild($checkBox);
$posY -= $settingHeight;
$index++;
}
$backButton = new Label_Button();
$frame->addChild($backButton);
$repositionnedFrame->addChild($backButton);
$backButton->setStyle($backButton::STYLE_CardMain_Quit);
$backButton->setHorizontalAlign($backButton::LEFT);
$backButton->setScale(0.5);
$backButton->setText('Back');
$backButton->setPosition(-$width / 2 + 5, -$height / 2 + 5);
$backButton->setPosition(5 , $height * -1 + 5);
$backButton->setAction(self::ACTION_PREFIX_SETTINGS . $settingClass);
return $frame;

View File

@ -275,23 +275,40 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT)->setPosition($width * 0.35, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(2);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
$paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
$paging->addButtonControl($pagerNext);
$paging->addButtonControl($pagerPrev);
$paging->setLabel($pageCountLabel);
$repositionnedFrame = new Frame();
$frame->addChild($repositionnedFrame);
$repositionnedFrame->setPosition($width * -0.5, $height * 0.5);
$pagesFrame = new Frame();
$repositionnedFrame->addChild($pagesFrame);
$pagesFrame->setY(-8.);
// Pages
$posY = 0.;
$index = 0;
$pageFrame = null;
$pageMaxCount = floor(($height * 0.8) / $optionHeight);
$pageMaxCount = floor(($height - 16) / $optionHeight);
foreach ($serverOptionsArray as $name => $value) {
// Continue on CurrentMaxPlayers...
@ -299,9 +316,9 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame();
$frame->addChild($pageFrame);
$posY = $height * 0.41;
$pagesFrame->addChild($pageFrame);
$paging->addPageControl($pageFrame);
$posY = 0.;
}
$optionsFrame = new Frame();
@ -310,22 +327,36 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
$nameLabel = new Label_Text();
$optionsFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT)->setX($width * -0.46)->setSize($width * 0.4, $optionHeight)->setStyle($nameLabel::STYLE_TextCardSmall)->setTextSize($labelTextSize)->setText($name)->setTextColor('fff');
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setX(2);
$nameLabel->setSize($width * 0.6, $optionHeight);
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
$nameLabel->setTextSize($labelTextSize)->setText($name);
$nameLabel->setTextColor('fff');
if (is_bool($value)) {
// Boolean checkbox
$quad = new Quad();
$quad->setPosition($width * 0.23, 0, -0.01)->setSize(4, 4);
$quad->setPosition($width - $width * 0.3 / 2 - 2, 0, -0.01);
$quad->setSize(4, 4);
$checkBox = new CheckBox(self::ACTION_PREFIX_OPTION . $name, $value, $quad);
$optionsFrame->addChild($checkBox);
} else {
// Other
$entry = new Entry();
$optionsFrame->addChild($entry);
$entry->setStyle(Label_Text::STYLE_TextValueSmall)->setX($width * 0.23)->setTextSize(1)->setSize($width * 0.48, $optionHeight * 0.9)->setName(self::ACTION_PREFIX_OPTION . $name)->setDefault($value);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
$entry->setX($width - $width * 0.3 / 2 - 2);
$entry->setTextSize(1);
$entry->setSize($width * 0.3, $optionHeight * 0.9);
$entry->setName(self::ACTION_PREFIX_OPTION . $name);
$entry->setDefault($value);
if ($name === 'Comment') {
$entry->setSize($width * 0.48, $optionHeight * 3. + $optionHeight * 0.9)->setAutoNewLine(true)->setVerticalAlign($entry::TOP)->setY($optionHeight * 1.5 + 2.5);
$entry->setSize($width * 0.3, $optionHeight * 3. + $optionHeight * 0.9);
$entry->setAutoNewLine(true);
$entry->setVerticalAlign($entry::TOP);
$entry->setY($optionHeight * 1.5 + 2.5);
$optionsFrame->setY($posY - $optionHeight * 1.5);
$posY -= $optionHeight * 3.;
$index += 3;
@ -334,7 +365,8 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
$entry->setId($name);
$quad = new Quad();
$quad->setPosition(-4, 0, -0.01)->setSize(4, 4);
$quad->setPosition($width - $width * 0.3 - 4, 0, -0.01);
$quad->setSize(4, 4);
$checkBox = new CheckBox(null, false, $quad);
$checkBox->setEnabledDesign("UICommon64_1", "Eye_light");
$checkBox->setDisabledDesign("UICommon64_1", "Eye_light");

View File

@ -166,13 +166,13 @@ class ServerUIPropertiesMenu implements ConfiguratorMenu, CallbackListener, Time
// Pagers
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.39, $height * -0.44, 2);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
@ -182,7 +182,7 @@ class ServerUIPropertiesMenu implements ConfiguratorMenu, CallbackListener, Time
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.35, $height * -0.44, 1);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);

View File

@ -71,11 +71,20 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene
$nameLabel = new Label_Text();
$voteRatioFrame->addChild($nameLabel);
$nameLabel->setHorizontalAlign($nameLabel::LEFT)->setX($width * -0.46)->setSize($width * 0.7, $lineHeight)->setTextSize(2)->setTranslate(true)->setText($voteRatioDescription);
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
$nameLabel->setX($width * -0.5 + 4);
$nameLabel->setSize($width * 0.7, $lineHeight);
$nameLabel->setTextSize(2);
$nameLabel->setTranslate(true);
$nameLabel->setText($voteRatioDescription);
$entry = new Entry();
$voteRatioFrame->addChild($entry);
$entry->setX($width * 0.35)->setSize($width * 0.14, $lineHeight * 0.9)->setStyle(Label_Text::STYLE_TextValueSmall)->setTextSize($index === 0 ? 2 : 1)->setName(self::ACTION_PREFIX_VOTE_RATIO . $voteRatioCommand);
$entry->setX($width * 0.5 - $width * 0.14 / 2 - 4);
$entry->setSize($width * 0.14, $lineHeight * 0.9);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
$entry->setTextSize($index === 0 ? 2 : 1);
$entry->setName(self::ACTION_PREFIX_VOTE_RATIO . $voteRatioCommand);
$voteRatio = $this->getVoteRatioForCommand($voteRatios, $voteRatioCommand);
if ($voteRatio) {

View File

@ -314,17 +314,26 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$pagerSize = 6.;
$pagerPrev = new Quad_Icons64x64_1();
$frame->addChild($pagerPrev);
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerPrev->setPosition($width * 0.5 - 12, $height * -0.5 + 5, 2);
$pagerPrev->setSize($pagerSize, $pagerSize);
$pagerPrev->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
$pagerNext = new Quad_Icons64x64_1();
$frame->addChild($pagerNext);
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2)->setSize($pagerSize, $pagerSize)->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$pagerNext->setPosition($width * 0.5 - 5, $height * -0.5 + 5, 2);
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$pageCountLabel = new Label_Text();
$frame->addChild($pageCountLabel);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT)->setPosition($width * 0.40, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(1);
$pageCountLabel->setHorizontalAlign($pageCountLabel::RIGHT);
$pageCountLabel->setPosition($width * 0.5 - 16, $height * -0.5 + 5, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(1);
$paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
$paging->addButtonControl($pagerNext);
$paging->addButtonControl($pagerPrev);
$paging->setLabel($pageCountLabel);
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'SimpleStatsList');
}