minor things

This commit is contained in:
kremsy 2014-01-04 21:54:40 +01:00
parent acd4e504dd
commit c644550eff
3 changed files with 28 additions and 9 deletions

View File

@ -64,11 +64,11 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
* @param bool $playerAction * @param bool $playerAction
* @param int $order * @param int $order
*/ */
public function addMenuItem(Control $control, $playerAction = true, $order = 0) { public function addMenuItem(Control $control, $playerAction = true, $order = 0, $description = '') {
if($playerAction) { if($playerAction) {
$this->addPlayerMenuItem($control, $order); $this->addPlayerMenuItem($control, $order, $description);
} else { } else {
$this->addAdminMenuItem($control, $order); $this->addAdminMenuItem($control, $order,$description);
} }
} }
@ -78,11 +78,12 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
* @param Control $control * @param Control $control
* @param int $order * @param int $order
*/ */
public function addPlayerMenuItem(Control $control, $order = 0) { public function addPlayerMenuItem(Control $control, $order = 0, $description = '') {
if(!isset($this->playerMenuItems[$order])) { if(!isset($this->playerMenuItems[$order])) {
$this->playerMenuItems[$order] = array(); $this->playerMenuItems[$order] = array();
} }
array_push($this->playerMenuItems[$order], $control); array_push($this->playerMenuItems[$order], $control);
//TODO handle description
} }
/** /**
@ -91,11 +92,12 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
* @param Control $control * @param Control $control
* @param int $order * @param int $order
*/ */
public function addAdminMenuItem(Control $control, $order = 0) { public function addAdminMenuItem(Control $control, $order = 0, $description = '') {
if(!isset($this->adminMenuItems[$order])) { if(!isset($this->adminMenuItems[$order])) {
$this->adminMenuItems[$order] = array(); $this->adminMenuItems[$order] = array();
} }
array_push($this->adminMenuItems[$order], $control); array_push($this->adminMenuItems[$order], $control);
//TODO handle description
} }
/** /**

View File

@ -55,28 +55,28 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener {
$itemQuad = new Quad_Icons64x64_1(); $itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser);
$itemQuad->setAction(self::ACTION_OPEN_XLIST); $itemQuad->setAction(self::ACTION_OPEN_XLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 3); $this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 3, 'Open MX List');
//Menu Open List //Menu Open List
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List');
$itemQuad = new Quad_Icons64x64_1(); $itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser);
$itemQuad->setAction(self::ACTION_OPEN_MAPLIST); $itemQuad->setAction(self::ACTION_OPEN_MAPLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 4); $this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 4,'Open MapList');
//Menu RestartMap //Menu RestartMap
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_RESTART_MAP, $this, 'command_RestartMap'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_RESTART_MAP, $this, 'command_RestartMap');
$itemQuad = new Quad_Icons64x64_1(); $itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastPrev); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastPrev);
$itemQuad->setAction(self::ACTION_RESTART_MAP); $itemQuad->setAction(self::ACTION_RESTART_MAP);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 0); $this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 0, 'Restart Map');
//Menu NextMap //Menu NextMap
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SKIP_MAP, $this, 'command_NextMap'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SKIP_MAP, $this, 'command_NextMap');
$itemQuad = new Quad_Icons64x64_1(); $itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext);
$itemQuad->setAction(self::ACTION_SKIP_MAP); $itemQuad->setAction(self::ACTION_SKIP_MAP);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 1); $this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 1, 'Skip Map');
} }
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
use FML\Controls\Control; use FML\Controls\Control;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Labels\Label_Button; use FML\Controls\Labels\Label_Button;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons128x128_1; use FML\Controls\Quads\Quad_Icons128x128_1;
@ -235,6 +236,20 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK); $script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
//Description Label
$descriptionFrame = new Frame();
$maniaLink->add($descriptionFrame);
$descriptionFrame->setPosition($posX - 50, $posY - 15);
$descriptionFrame->setHAlign(Control::RIGHT);
$descriptionLabel = new Label();
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
$descriptionLabel->setSize(40, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(true);
// Add items // Add items
$x = -2; $x = -2;
foreach(array_reverse($valueArray) as $value) { foreach(array_reverse($valueArray) as $value) {
@ -246,6 +261,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$label->setTextSize(1.2); $label->setTextSize(1.2);
$label->setAction(self::ACTION_DONATE_VALUE . "." . $value); $label->setAction(self::ACTION_DONATE_VALUE . "." . $value);
$script->addTooltip($label, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Donate " . $value . " Planets"));
$x -= strlen($value) * 2 + 1.7; $x -= strlen($value) * 2 + 1.7;
} }