some design changes

This commit is contained in:
kremsy 2014-01-05 01:29:49 +01:00
parent 4674392336
commit 376dc77701
4 changed files with 63 additions and 31 deletions

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Admin;
use FML\Controls\Control;
use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink;
@ -37,6 +38,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
private $adminMenuItems = array();
private $playerMenuItems = array();
private $initCompleted = false;
/**
* Create a new Actions Menu
*
@ -84,7 +86,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
if(!isset($this->playerMenuItems[$order])) {
$this->playerMenuItems[$order] = array();
}
array_push($this->playerMenuItems[$order], $control);
array_push($this->playerMenuItems[$order], $control, $description);
//TODO handle description
}
@ -98,7 +100,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
if(!isset($this->adminMenuItems[$order])) {
$this->adminMenuItems[$order] = array();
}
array_push($this->adminMenuItems[$order], $control);
array_push($this->adminMenuItems[$order], $control, $description);
//TODO handle description
}
@ -122,7 +124,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
* Build and show the menus to everyone (if a menu get made after the init)
*/
public function rebuildAndShowMenu() {
if($this->initCompleted){
if($this->initCompleted) {
$players = $this->maniaControl->playerManager->getPlayers();
foreach($players as $player) {
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
@ -199,6 +201,20 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$itemQuad->setSize($itemSize, $itemSize);
$iconFrame->add($itemQuad);
//Description Label
$descriptionFrame = new Frame();
$manialink->add($descriptionFrame);
$descriptionFrame->setPosition($posX - count($this->adminMenuItems) * $itemSize * 1.15 - 6, $posY);
$descriptionFrame->setAlign(Control::RIGHT, Control::CENTER2);
$descriptionLabel = new Label();
$descriptionFrame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
$descriptionLabel->setSize(40, 4);
$descriptionLabel->setTextSize(1.4);
$descriptionLabel->setVisible(true);
$descriptionLabel->setTextColor("FFF");
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
//Admin Menu
$popoutFrame = new Frame();
@ -220,16 +236,30 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
// Add items
$x = -1;
foreach(array_reverse($this->adminMenuItems) as $menuItems) {
foreach($menuItems as $menuItem) {
/** @var Quad $menuItem */
$menuItem->setSize($itemSize, $itemSize);
$popoutFrame->add($menuItem);
$menuItem->setX($x);
$menuItem->setHAlign(Control::RIGHT);
$x -= $itemSize * 1.05;
}
$menuItem = $menuItems[0];
/** @var Quad $menuItem */
$menuItem->setSize($itemSize, $itemSize);
$popoutFrame->add($menuItem);
$menuItem->setX($x);
$menuItem->setHAlign(Control::RIGHT);
$x -= $itemSize * 1.05;
$script->addTooltip($menuItem, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$s' . $menuItems[1]));
}
}
// Player Menu Descrition Frame / LabelLabel
$descriptionFrame = new Frame(); //TODO not working yet
$manialink->add($descriptionFrame);
$descriptionFrame->setPosition($posX - count($this->playerMenuItems) * $itemSize * 1.15 - 6, $posY - $itemSize * $itemMarginFactorY);
$descriptionFrame->setAlign(Control::RIGHT, Control::CENTER2);
$descriptionLabel = clone $descriptionLabel;
$descriptionFrame->add($descriptionLabel);
// Player Menu Icon Frame
$frame = new Frame();
$manialink->add($frame);
@ -271,14 +301,15 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
// Add items
$x = -1;
foreach(array_reverse($this->playerMenuItems) as $menuItems) {
foreach($menuItems as $menuItem) {
/** @var Quad $menuItem */
$menuItem->setSize($itemSize, $itemSize);
$popoutFrame->add($menuItem);
$menuItem->setX($x);
$menuItem->setHAlign(Control::RIGHT);
$x -= $itemSize * 1.05;
}
$menuItem = $menuItems[0];
/** @var Quad $menuItem */
$menuItem->setSize($itemSize, $itemSize);
$popoutFrame->add($menuItem);
$menuItem->setX($x);
$menuItem->setHAlign(Control::RIGHT);
$x -= $itemSize * 1.05;
$script->addTooltip($menuItem, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$s' . $menuItems[1]));
}
return $manialink;

View File

@ -2,6 +2,7 @@
namespace ManiaControl\Configurators;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use ManiaControl\ManiaControl;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
@ -309,9 +310,9 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
* Add Menu Item to the Actions Menu
*/
private function addActionsMenuItem() {
$itemQuad = new Quad();
$itemQuad->setStyles('Icons128x32_1', 'Settings');
$itemQuad = new Quad_UIConstruction_Buttons();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Tools);
$itemQuad->setAction(self::ACTION_TOGGLEMENU);
$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 20);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 20, 'Settings');//TODO index not really working (this should be the last)
}
}

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Maps;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
@ -73,17 +74,17 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener,Callba
$itemQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON));
$itemQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER)); //TODO move the button to the image manager
$itemQuad->setAction(self::ACTION_OPEN_XLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 3, 'Open MX List');
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 5, 'Open MX List');
//Menu Open List
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser);
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ToolRoot);
$itemQuad->setAction(self::ACTION_OPEN_MAPLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 4,'Open MapList');
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 10,'Open MapList');
//Menu RestartMap
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastPrev);
$itemQuad = new Quad_UIConstruction_Buttons();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Reload);
$itemQuad->setAction(self::ACTION_RESTART_MAP);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 0, 'Restart Map');
@ -93,7 +94,6 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener,Callba
$itemQuad->setAction(self::ACTION_SKIP_MAP);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 1, 'Skip Map');
}
/**
* Handle removemap command

View File

@ -64,21 +64,21 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
$itemQuad = new Quad_Icons128x32_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team);
$itemQuad->setAction(self::ACTION_BALANCE_TEAMS);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 9);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 9, 'Balance Teams');
//Action cancel Vote
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CANCEL_VOTE, $this, 'command_cancelVote');
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowRed);
$itemQuad->setAction(self::ACTION_CANCEL_VOTE);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 6);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 6, 'Cancel Vote');
//Action Open Playerlist
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
$itemQuad = new Quad_UIConstruction_Buttons();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 9);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 15, 'Open Playerlist');
}
/**