actions menu fix

This commit is contained in:
Steffen Schröder 2014-04-27 19:22:20 +02:00
parent ca5b30d9e1
commit 26ad7c927e
2 changed files with 24 additions and 17 deletions

View File

@ -201,13 +201,10 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconServers);
$itemQuad->setSize($itemSize, $itemSize);
// Admin Menu Description Label
$descriptionFrame = new Frame();
$manialink->add($descriptionFrame);
$descriptionFrame->setPosition($posX - count($this->adminMenuItems) * $itemSize * 1.15 - 6, $posY);
// Admin Menu Description
$descriptionLabel = new Label();
$descriptionFrame->add($descriptionLabel);
$manialink->add($descriptionLabel);
$descriptionLabel->setPosition($posX - count($this->adminMenuItems) * $itemSize * 1.15 - 6, $posY);
$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
$descriptionLabel->setSize(40, 4);
$descriptionLabel->setTextSize(1.4);
@ -234,7 +231,9 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
foreach ($this->adminMenuItems as $menuItems) {
foreach ($menuItems as $menuItem) {
$menuQuad = $menuItem[0];
/** @var Quad $menuQuad */
/**
* @var Quad $menuQuad
*/
$popoutFrame->add($menuQuad);
$menuQuad->setSize($itemSize, $itemSize);
$menuQuad->setX($x);
@ -242,6 +241,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$x -= $itemSize * 1.05;
if ($menuItem[1]) {
$menuQuad->removeScriptFeatures();
$description = '$s' . $menuItem[1];
$menuQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
@ -267,13 +267,10 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconPlayers);
$itemQuad->setSize($itemSize, $itemSize);
// Player Menu Description Frame
$descriptionFrame = new Frame();
$manialink->add($descriptionFrame);
$descriptionFrame->setPosition($posX - count($this->playerMenuItems) * $itemSize * 1.15 - 6, $posY - $itemSize * $itemMarginFactorY);
// Player Menu Description
$descriptionLabel = new Label();
$descriptionFrame->add($descriptionLabel);
$manialink->add($descriptionLabel);
$descriptionLabel->setPosition($posX - count($this->playerMenuItems) * $itemSize * 1.15 - 6, $posY - $itemSize * $itemMarginFactorY);
$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
$descriptionLabel->setSize(40, 4);
$descriptionLabel->setTextSize(1.4);
@ -300,7 +297,9 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
foreach ($this->playerMenuItems as $menuItems) {
foreach ($menuItems as $menuItem) {
$menuQuad = $menuItem[0];
/** @var Quad $menuQuad */
/**
* @var Quad $menuQuad
*/
$popoutFrame->add($menuQuad);
$menuQuad->setSize($itemSize, $itemSize);
$menuQuad->setX($x);
@ -308,14 +307,13 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$x -= $itemSize * 1.05;
if ($menuItem[1]) {
$menuQuad->removeScriptFeatures();
$description = '$s' . $menuItem[1];
$menuQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
}
}
//if ($player->login === 'steeffeen') var_dump((string)$manialink);
return $manialink;
}
}

View File

@ -5,7 +5,6 @@ namespace FML\Controls;
use FML\Types\Renderable;
use FML\Script\Features\ActionTrigger;
use FML\Script\ScriptLabel;
use FML\Types\ScriptFeatureable;
use FML\Script\Features\MapInfo;
use FML\Script\Features\PlayerProfile;
@ -369,6 +368,16 @@ abstract class Control implements Renderable, ScriptFeatureable {
return $this;
}
/**
* Remove all Script Features
*
* @return \FML\Controls\Control
*/
public function removeScriptFeatures() {
$this->scriptFeatures = array();
return $this;
}
/**
*
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()