some cleanup

This commit is contained in:
kremsy 2013-12-30 16:58:35 +01:00
parent 98c69af28d
commit d5f68bb8dc

View File

@ -10,6 +10,7 @@ use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons; use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\Script\Script; use FML\Script\Script;
use FML\Script\Tooltips; use FML\Script\Tooltips;
use KarmaPlugin;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
@ -259,16 +260,40 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
//TODO add pages //TODO add pages
$jukedMaps = $this->maniaControl->mapManager->jukebox->getJukeBoxRanking(); $jukedMaps = $this->maniaControl->mapManager->jukebox->getJukeBoxRanking();
/** @var KarmaPlugin $karmaPlugin */
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN); $karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN);
$id = 1; $id = 1;
$y = $this->height / 2 - 10; $y = $this->height / 2 - 10;
/** @var Map $map */
foreach($mapList as $map){ foreach($mapList as $map){
//Map Frame
$mapFrame = new Frame(); $mapFrame = new Frame();
$frame->add($mapFrame); $frame->add($mapFrame);
$this->displayMap($id, $map, $mapFrame, $tooltips); $mapFrame->setZ(0.1);
$mapFrame->setY($y); $mapFrame->setY($y);
if($this->maniaControl->mapManager->getCurrentMap() === $map){
$currentQuad = new Quad_Icons64x64_1();
$frame->add($currentQuad);
$currentQuad->setX($x + 3.5);
$currentQuad->setZ(0.2);
$currentQuad->setSize(4, 4);
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
}
$mxId = '-';
if(isset($map->mx->id))
$mxId = $map->mx->id;
//Display Maps
$array = array($id => $x + 5, $mxId => $x + 10, $map->name => $x + 20, $map->authorNick => $x + 73);
$this->maniaControl->manialinkManager->labelLine($mapFrame,$array);
//TODO detailed mx info page with link to mxo
//TODO action detailed map info
//TODO side switch
//Jukebox Description Label //Jukebox Description Label
$descriptionLabel = new Label(); $descriptionLabel = new Label();
@ -348,7 +373,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$tooltips->add($switchToQuad, $descriptionLabel); $tooltips->add($switchToQuad, $descriptionLabel);
} }
//Display Karma bar //Display Karma bar
if($karmaPlugin != null){ if($karmaPlugin != null){
$karma = $karmaPlugin->getMapKarma($map); $karma = $karmaPlugin->getMapKarma($map);
@ -388,39 +412,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player); $this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
} }
/**
* Displays a single Map in the Maplist
* @param $id
* @param Map $map
* @param Frame $frame
*/
private function displayMap($id, Map $map, Frame $frame, Tooltips $tooltips){
$frame->setZ(0.1);
//set starting x-value
$x = -$this->width / 2;
if($this->maniaControl->mapManager->getCurrentMap() === $map){
$currentQuad = new Quad_Icons64x64_1();
$frame->add($currentQuad);
$currentQuad->setX($x + 3.5);
$currentQuad->setZ(0.2);
$currentQuad->setSize(4, 4);
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
}
$mxId = '-';
if(isset($map->mx->id))
$mxId = $map->mx->id;
//Display Maps
$array = array($id => $x + 5, $mxId => $x + 10, $map->name => $x + 20, $map->authorNick => $x + 73);
$this->maniaControl->manialinkManager->labelLine($frame,$array);
//TODO detailed mx info page with link to mxo
//TODO action detailed map info
//TODO side switch
}
/** /**
* Closes the widget * Closes the widget