From 5d8470cb1c0d8f7f39aa37e42d66416cc8133c27 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 12 Jan 2014 00:28:06 +0100 Subject: [PATCH] update available in maplist und mxicon --- application/core/Manialinks/IconManager.php | 6 ++ application/core/Maps/MapList.php | 68 +++++++++++++-------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/application/core/Manialinks/IconManager.php b/application/core/Manialinks/IconManager.php index bc85c81a..92d367af 100644 --- a/application/core/Manialinks/IconManager.php +++ b/application/core/Manialinks/IconManager.php @@ -27,6 +27,9 @@ class IconManager implements CallbackListener { const MX_ICON = 'ManiaExchange.png'; const MX_ICON_MOVER = 'ManiaExchange_logo_press.png'; + const MX_ICON_GREEN = 'ManiaExchangeGreen.png'; + const MX_ICON_GREEN_MOVER = 'ManiaExchange_logo_pressGreen.png'; + /** * Private Properties */ @@ -53,6 +56,9 @@ class IconManager implements CallbackListener { private function addDefaultIcons() { $this->addIcon(self::MX_ICON); $this->addIcon(self::MX_ICON_MOVER); + $this->addIcon(self::MX_ICON_GREEN, "http://www.pictures.esc-clan.net/upload/"); //TODO mc website + $this->addIcon(self::MX_ICON_GREEN_MOVER , " http://www.pictures.esc-clan.net/upload/"); + } /** diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 4fa55e9b..40e749c9 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -217,7 +217,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $mapFrame->setY($y); - $mxQuad = new Quad(); $mapFrame->add($mxQuad); $mxQuad->setSize(3, 3); @@ -409,12 +408,13 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $this->maniaControl->manialinkManager->labelLine($headFrame, $array); // Predefine Description Label - $preDefinedDescriptionLabel = new Label(); - $preDefinedDescriptionLabel->setAlign(Control::LEFT, Control::TOP); - $preDefinedDescriptionLabel->setPosition($x + 10, -$height / 2 + 5); - $preDefinedDescriptionLabel->setSize($width * 0.7, 4); - $preDefinedDescriptionLabel->setTextSize(2); - $preDefinedDescriptionLabel->setVisible(false); + $descriptionLabel = new Label(); + $frame->add($descriptionLabel); + $descriptionLabel->setAlign(Control::LEFT, Control::TOP); + $descriptionLabel->setPosition($x + 10, -$height / 2 + 5); + $descriptionLabel->setSize($width * 0.7, 4); + $descriptionLabel->setTextSize(2); + $descriptionLabel->setVisible(false); $queuedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking(); /** @@ -431,7 +431,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { * @var Map $map */ foreach($mapList as $map) { - var_dump($map->updateAvailable()); if(!isset($pageFrame)) { $pageFrame = new Frame(); $frame->add($pageFrame); @@ -469,6 +468,29 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $mxId = '-'; if(isset($map->mx->id)) { $mxId = $map->mx->id; + + $mxQuad = new Quad(); + $mapFrame->add($mxQuad); + $mxQuad->setSize(3, 3); + $mxQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON)); + $mxQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER)); + $mxQuad->setX($x + 65); + $mxQuad->setUrl($map->mx->pageurl); + $mxQuad->setZ(0.01); + $script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View $<" . $map->name . "$> on Mania-Exchange")); + + if($map->updateAvailable()) { + $mxQuad = new Quad(); + $mapFrame->add($mxQuad); + $mxQuad->setSize(3, 3); + $mxQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN)); + $mxQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN_MOVER)); + $mxQuad->setX($x + 62); + $mxQuad->setUrl($map->mx->pageurl); + $mxQuad->setZ(0.01); + $script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Update of $<" . $map->name . "$> available on Mania-Exchange")); + } + } // Display Maps @@ -476,10 +498,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $this->maniaControl->manialinkManager->labelLine($mapFrame, $array); // TODO action detailed map info including mx info - // MapQueue Description Label - $descriptionLabel = clone $preDefinedDescriptionLabel; - $frame->add($descriptionLabel); - // Map-Queue-Map-Label if(isset($queuedMaps[$map->uid])) { $label = new Label_Text(); @@ -490,7 +508,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $label->setTextSize(1.5); $label->setText($queuedMaps[$map->uid]); $label->setTextColor('fff'); - $descriptionLabel->setText('$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid]); + $script->addTooltip($label, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid])); } else { // Map-Queue-Map-Button $queueLabel = new Label_Button(); @@ -502,8 +520,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $queueLabel->setText('+'); $queueLabel->setTextColor('09f'); - $descriptionLabel->setText('Add Map to the Map Queue: $<' . $map->name . '$>'); - $script->addTooltip($queueLabel, $descriptionLabel); + $script->addTooltip($queueLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Add Map to the Map Queue: $<' . $map->name . '$>')); } if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) { @@ -521,11 +538,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { //$script->addToggle($eraseLabel, $confirmFrame); //TODO $script->addTooltip($eraseLabel, $confirmFrame, Script::OPTION_TOOLTIP_STAYONCLICK); - // Description Label - $descriptionLabel = clone $preDefinedDescriptionLabel; - $frame->add($descriptionLabel); - $descriptionLabel->setText('Remove Map: $<' . $map->name . '$>'); - $script->addTooltip($eraseLabel, $descriptionLabel); + $script->addTooltip($eraseLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Remove Map: $<' . $map->name . '$>')); + } if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { @@ -543,10 +557,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $script->addTooltip($switchLabel, $confirmFrame, Script::OPTION_TOOLTIP_STAYONCLICK); //TODO //$script->addToggle($switchLabel, $confirmFrame); - $descriptionLabel = clone $preDefinedDescriptionLabel; - $frame->add($descriptionLabel); - $descriptionLabel->setText('Switch Directly to Map: $<' . $map->name . '$>'); - $script->addTooltip($switchLabel, $descriptionLabel); + $script->addTooltip($switchLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Switch Directly to Map: $<' . $map->name . '$>')); + } // Display Karma bar @@ -644,16 +656,18 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { /** * Unset the player if he opened another Main Widget + * * @param array $callback */ - public function handleWidgetOpened(array $callback){ - $player = $callback[1]; + public function handleWidgetOpened(array $callback) { + $player = $callback[1]; $openedWidget = $callback[2]; //unset when another main widget got opened - if($openedWidget != 'MapList' && $openedWidget != 'MxList'){ + if($openedWidget != 'MapList' && $openedWidget != 'MxList') { unset($this->mapListShown[$player->login]); } } + /** * Closes the widget *