description label clone maplist

This commit is contained in:
kremsy 2014-01-02 13:51:50 +01:00
parent 18fd95dcd4
commit 9efe8f1ffa
2 changed files with 18 additions and 28 deletions

View File

@ -231,6 +231,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
return $frame;
}
@ -247,9 +248,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$frame = $this->buildMainFrame();
$maniaLink->add($frame);
// Create script and features
$script = new Script();
$maniaLink->setScript($script);
@ -262,6 +260,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$array = array("Id" => $x + 5, "Mx ID" => $x + 10, "MapName" => $x + 20, "Author" => $x + 68, "Karma" => $x + 115, "Actions" => $this->width / 2 - 15);
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
//Predefine Description Label
$preDefinedDescriptionLabel = new Label();
$preDefinedDescriptionLabel->setAlign(Control::LEFT, Control::TOP);
$preDefinedDescriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$preDefinedDescriptionLabel->setSize($this->width * 0.7, 4);
$preDefinedDescriptionLabel->setTextSize(2);
$preDefinedDescriptionLabel->setVisible(false);
//Get Maplist
$mapList = $this->maniaControl->mapManager->getMapList();
@ -313,13 +319,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
//MapQueue Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
//Map-Queue-Map-Label
if(isset($queuedMaps[$map->uid])) {
@ -364,13 +365,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$eraseQuad->setAction(self::ACTION_CONFIRM_ERASE_MAP . "." . ($id));
//Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Remove Map: {$map->name}");
$script->addTooltip($eraseQuad, $descriptionLabel);
}
@ -389,13 +385,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$switchToQuad->setAction(self::ACTION_CONFIRM_SWITCHTO_MAP . "." . ($id));
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Switch Directly to Map: {$map->name}");
$script->addTooltip($switchToQuad, $descriptionLabel);
}

View File

@ -15,7 +15,6 @@ use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Script;
use FML\Script\Tooltips;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;