This commit is contained in:
kremsy 2014-01-28 19:28:17 +01:00 committed by Steffen Schröder
parent 769147e7c7
commit fc91133f77
4 changed files with 62 additions and 135 deletions

View File

@ -114,48 +114,21 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
return; 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 // Start offsets
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
$x = -$width / 2; $x = -$width / 2;
$y = $height / 2; $y = $height / 2;
// Pagers //Create ManiaLink
// Config $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$pagerSize = 6.; $script = $maniaLink->getScript();
$pagesId = 'MxListPages'; $pagesId = 'MxListPages';
$pagerPrev = new Quad_Icons64x64_1(); // Main frame
$frame->add($pagerPrev); $frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2); $maniaLink->add($frame);
$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);
// Predefine Description Label // Predefine Description Label
$descriptionLabel = new Label(); $descriptionLabel = new Label();

View File

@ -2,10 +2,13 @@
namespace ManiaControl\Manialinks; namespace ManiaControl\Manialinks;
use FML\Controls\Control;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgRaceScore2; use FML\Controls\Quads\Quad_BgRaceScore2;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Script;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -132,7 +135,7 @@ class StyleManager {
* *
* @return Frame $frame * @return Frame $frame
*/ */
public function defaultListFrame() { public function defaultListFrame(Script $script = null, $pagesId = '') {
$width = $this->getListWidgetsWidth(); $width = $this->getListWidgetsWidth();
$height = $this->getListWidgetsHeight(); $height = $this->getListWidgetsHeight();
$quadStyle = $this->getDefaultMainWindowStyle(); $quadStyle = $this->getDefaultMainWindowStyle();
@ -141,7 +144,7 @@ class StyleManager {
// mainframe // mainframe
$frame = new Frame(); $frame = new Frame();
$frame->setSize($width, $height); $frame->setSize($width, $height);
$frame->setPosition(0, 0); $frame->setPosition(0, 0, 10);
// Background Quad // Background Quad
$backgroundQuad = new Quad(); $backgroundQuad = new Quad();
@ -157,6 +160,32 @@ class StyleManager {
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace); $closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET); $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; return $frame;
} }
} }

View File

@ -103,53 +103,27 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
// Get Maplist
$mapList = $this->maniaControl->mapManager->getMaps();
$this->mapListShown[$player->login] = true; $this->mapListShown[$player->login] = true;
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); // Get Maps
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame(); $mapList = $this->maniaControl->mapManager->getMaps();
$maniaLink->add($frame);
$frame->setZ(10);
// Create script and features
$script = new Script();
$maniaLink->setScript($script);
// Pagers
// Config
$pagerSize = 6.;
$pagesId = 'MapListPages';
$pagesId = '';
if (count($mapList) > self::MAX_MAPS_PER_PAGE) { if (count($mapList) > self::MAX_MAPS_PER_PAGE) {
$pagerPrev = new Quad_Icons64x64_1(); $pagesId = 'MapListPages';
$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);
} }
//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 //Admin Buttons
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
//Clear Jukebox //Clear Map-Queue
$label = new Label_Button(); $label = new Label_Button();
$frame->add($label); $frame->add($label);
$label->setText("Clear Map-Queue"); $label->setText("Clear Map-Queue");

View File

@ -89,69 +89,21 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
public function showPlayerList(Player $player) { public function showPlayerList(Player $player) {
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); $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); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript(); $script = $maniaLink->getScript();
// Main frame // Main frame
$frame = new Frame(); $frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
$maniaLink->add($frame); $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 // Start offsets
$x = -$width / 2; $x = -$width / 2;
@ -170,7 +122,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$headFrame = new Frame(); $headFrame = new Frame();
$frame->add($headFrame); $frame->add($headFrame);
$headFrame->setY($y - 5); $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)) { 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); $array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101, "Actions" => $x + 135);
} else { } else {