cleanup
This commit is contained in:
parent
769147e7c7
commit
fc91133f77
@ -114,48 +114,21 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
||||
return;
|
||||
}
|
||||
|
||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame();
|
||||
$maniaLink->add($frame);
|
||||
$frame->setZ(10);
|
||||
|
||||
// Create script and features
|
||||
$script = new Script();
|
||||
$maniaLink->setScript($script);
|
||||
|
||||
// Start offsets
|
||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||
$x = -$width / 2;
|
||||
$y = $height / 2;
|
||||
|
||||
// Pagers
|
||||
// Config
|
||||
$pagerSize = 6.;
|
||||
//Create ManiaLink
|
||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||
$script = $maniaLink->getScript();
|
||||
|
||||
$pagesId = 'MxListPages';
|
||||
|
||||
$pagerPrev = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerPrev);
|
||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||
$pagerPrev->setSize($pagerSize, $pagerSize);
|
||||
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
|
||||
|
||||
$pagerNext = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerNext);
|
||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||
|
||||
$script->addPager($pagerPrev, -1, $pagesId);
|
||||
$script->addPager($pagerNext, 1, $pagesId);
|
||||
|
||||
$pageCountLabel = new Label_Text();
|
||||
$frame->add($pageCountLabel);
|
||||
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
|
||||
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
||||
$pageCountLabel->setTextSize(1.3);
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
// Main frame
|
||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
|
||||
$maniaLink->add($frame);
|
||||
|
||||
// Predefine Description Label
|
||||
$descriptionLabel = new Label();
|
||||
|
@ -2,10 +2,13 @@
|
||||
|
||||
namespace ManiaControl\Manialinks;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Controls\Frame;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -132,7 +135,7 @@ class StyleManager {
|
||||
*
|
||||
* @return Frame $frame
|
||||
*/
|
||||
public function defaultListFrame() {
|
||||
public function defaultListFrame(Script $script = null, $pagesId = '') {
|
||||
$width = $this->getListWidgetsWidth();
|
||||
$height = $this->getListWidgetsHeight();
|
||||
$quadStyle = $this->getDefaultMainWindowStyle();
|
||||
@ -141,7 +144,7 @@ class StyleManager {
|
||||
// mainframe
|
||||
$frame = new Frame();
|
||||
$frame->setSize($width, $height);
|
||||
$frame->setPosition(0, 0);
|
||||
$frame->setPosition(0, 0, 10);
|
||||
|
||||
// Background Quad
|
||||
$backgroundQuad = new Quad();
|
||||
@ -157,6 +160,32 @@ class StyleManager {
|
||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
||||
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
||||
|
||||
if ($pagesId && isset($script)) {
|
||||
$pagerSize = 6.;
|
||||
$pagerPrev = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerPrev);
|
||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||
$pagerPrev->setSize($pagerSize, $pagerSize);
|
||||
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
|
||||
|
||||
$pagerNext = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerNext);
|
||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||
|
||||
$script->addPager($pagerPrev, -1, $pagesId);
|
||||
$script->addPager($pagerNext, 1, $pagesId);
|
||||
|
||||
$pageCountLabel = new Label_Text();
|
||||
$frame->add($pageCountLabel);
|
||||
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
|
||||
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
||||
$pageCountLabel->setTextSize(1.3);
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
}
|
||||
|
||||
return $frame;
|
||||
}
|
||||
}
|
||||
|
@ -103,53 +103,27 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||
|
||||
// Get Maplist
|
||||
$mapList = $this->maniaControl->mapManager->getMaps();
|
||||
|
||||
$this->mapListShown[$player->login] = true;
|
||||
|
||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame();
|
||||
$maniaLink->add($frame);
|
||||
$frame->setZ(10);
|
||||
|
||||
// Create script and features
|
||||
$script = new Script();
|
||||
$maniaLink->setScript($script);
|
||||
|
||||
// Pagers
|
||||
// Config
|
||||
$pagerSize = 6.;
|
||||
$pagesId = 'MapListPages';
|
||||
// Get Maps
|
||||
$mapList = $this->maniaControl->mapManager->getMaps();
|
||||
|
||||
$pagesId = '';
|
||||
if (count($mapList) > self::MAX_MAPS_PER_PAGE) {
|
||||
$pagerPrev = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerPrev);
|
||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||
$pagerPrev->setSize($pagerSize, $pagerSize);
|
||||
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
|
||||
|
||||
$pagerNext = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerNext);
|
||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||
|
||||
$script->addPager($pagerPrev, -1, $pagesId);
|
||||
$script->addPager($pagerNext, 1, $pagesId);
|
||||
|
||||
$pageCountLabel = new Label_Text();
|
||||
$frame->add($pageCountLabel);
|
||||
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
|
||||
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
||||
$pageCountLabel->setTextSize(1.3);
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
$pagesId = 'MapListPages';
|
||||
}
|
||||
|
||||
//Create ManiaLink
|
||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||
$script = $maniaLink->getScript();
|
||||
|
||||
// Main frame
|
||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
|
||||
$maniaLink->add($frame);
|
||||
|
||||
//Admin Buttons
|
||||
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||
//Clear Jukebox
|
||||
//Clear Map-Queue
|
||||
$label = new Label_Button();
|
||||
$frame->add($label);
|
||||
$label->setText("Clear Map-Queue");
|
||||
|
@ -89,69 +89,21 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
public function showPlayerList(Player $player) {
|
||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
||||
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
||||
|
||||
// get PlayerList
|
||||
$players = $this->maniaControl->playerManager->getPlayers();
|
||||
$pagesId = '';
|
||||
if (count($players) > self::MAX_PLAYERS_PER_PAGE) {
|
||||
$pagesId = 'PlayerListPages';
|
||||
}
|
||||
|
||||
//create manialink
|
||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||
$script = $maniaLink->getScript();
|
||||
|
||||
// Main frame
|
||||
$frame = new Frame();
|
||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
|
||||
$maniaLink->add($frame);
|
||||
$frame->setSize($width, $height);
|
||||
$frame->setPosition(0, 0, 10);
|
||||
|
||||
// Background
|
||||
$backgroundQuad = new Quad();
|
||||
$frame->add($backgroundQuad);
|
||||
$backgroundQuad->setSize($width, $height);
|
||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||
|
||||
/*$backgroundQuad = new Quad();
|
||||
$frame->add($backgroundQuad);
|
||||
$backgroundQuad->setSize($width* 1.3, $height* 1.3);
|
||||
//$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||
$backgroundQuad->setImage("http://www.imgdumper.nl/uploads7/52d991addf7a1/52d991add72ef-border-playerstats.png");
|
||||
$backgroundQuad->setZ(-0.5);*/
|
||||
|
||||
// Close Quad (X)
|
||||
$closeQuad = new Quad_Icons64x64_1();
|
||||
$frame->add($closeQuad);
|
||||
$closeQuad->setPosition($width * 0.483, $height * 0.467, 3);
|
||||
$closeQuad->setSize(6, 6);
|
||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
||||
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
||||
|
||||
$pagerSize = 6.;
|
||||
$pagesId = 'PlayerListPages';
|
||||
|
||||
// get PlayerList
|
||||
$players = $this->maniaControl->playerManager->getPlayers();
|
||||
|
||||
if (count($players) > self::MAX_PLAYERS_PER_PAGE) {
|
||||
$pagerPrev = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerPrev);
|
||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||
$pagerPrev->setSize($pagerSize, $pagerSize);
|
||||
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
|
||||
|
||||
$pagerNext = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerNext);
|
||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||
|
||||
$script->addPager($pagerPrev, -1, $pagesId);
|
||||
$script->addPager($pagerNext, 1, $pagesId);
|
||||
|
||||
$pageCountLabel = new Label_Text();
|
||||
$frame->add($pageCountLabel);
|
||||
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
|
||||
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
||||
$pageCountLabel->setTextSize(1.3);
|
||||
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||
}
|
||||
|
||||
// Start offsets
|
||||
$x = -$width / 2;
|
||||
@ -170,7 +122,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$headFrame = new Frame();
|
||||
$frame->add($headFrame);
|
||||
$headFrame->setY($y - 5);
|
||||
// $array = array("Id" => $x + 5, "Nickname" => $x + 10, "Login" => $x + 40, "Ladder" => $x + 60,"Zone" => $x + 85);
|
||||
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101, "Actions" => $x + 135);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user