design improvements

This commit is contained in:
kremsy 2014-01-05 00:43:46 +01:00
parent 91185378b8
commit 4674392336
6 changed files with 56 additions and 15 deletions

View File

@ -36,7 +36,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
private $maniaControl = null;
private $adminMenuItems = array();
private $playerMenuItems = array();
private $initCompleted = false;
/**
* Create a new Actions Menu
*
@ -70,6 +70,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
} else {
$this->addAdminMenuItem($control, $order, $description);
}
$this->rebuildAndShowMenu();
}
/**
@ -112,6 +114,21 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
}
$this->initCompleted = true;
}
/**
* Build and show the menus to everyone (if a menu get made after the init)
*/
public function rebuildAndShowMenu() {
if($this->initCompleted){
$players = $this->maniaControl->playerManager->getPlayers();
foreach($players as $player) {
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
}
}
}
/**

View File

@ -26,6 +26,7 @@ class IconManager implements CallbackListener {
* Some Default icons
*/
const MX_ICON = 'ManiaExchange.png';
const MX_ICON_MOVER = 'ManiaExchange_logo_press.png';
/**
* Private Properties

View File

@ -2,19 +2,24 @@
namespace ManiaControl\Maps;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\IconManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use WidgetPlugin;
/**
* Class offering commands to manage maps
*
* @author steeffeen & kremsy
*/
class MapCommands implements CommandListener, ManialinkPageAnswerListener {
class MapCommands implements CommandListener, ManialinkPageAnswerListener,CallbackListener {
/**
* Constants
*/
@ -50,35 +55,46 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener {
$this->mapList = new MapList($this->maniaControl);
//Menu Open xList
//Menus Buttons
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList');
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser);
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List');
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_RESTART_MAP, $this, 'command_RestartMap');
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SKIP_MAP, $this, 'command_NextMap');
}
/**
* Handle on Init
* @param array $callback
*/
public function handleOnInit(array $callback){
//Menu Open xList
$itemQuad = new Quad();
$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');
//Menu Open List
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List');
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser);
$itemQuad->setAction(self::ACTION_OPEN_MAPLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 4,'Open MapList');
//Menu RestartMap
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_RESTART_MAP, $this, 'command_RestartMap');
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastPrev);
$itemQuad->setAction(self::ACTION_RESTART_MAP);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 0, 'Restart Map');
//Menu NextMap
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SKIP_MAP, $this, 'command_NextMap');
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext);
$itemQuad->setAction(self::ACTION_SKIP_MAP);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 1, 'Skip Map');
}
}
/**
* Handle removemap command
*

View File

@ -5,6 +5,7 @@ namespace ManiaControl\Players;
use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl;
@ -72,10 +73,10 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
$itemQuad->setAction(self::ACTION_CANCEL_VOTE);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 6);
//Action Balance Teams
//Action Open Playerlist
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
$itemQuad = new Quad_Icons128x128_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Buddies);
$itemQuad = new Quad_UIConstruction_Buttons();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 9);
}

View File

@ -48,6 +48,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
const ACTION_ADD_AS_MOD = 'PlayerList.PlayerAddAsModerator';
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
const ACTION_OPEN_PLAYER_DETAILED = 'PlayerList.OpenPlayerDetailed';
const ACTION_SPECTATE_PLAYER = 'PlayerList.SpectatePlayer';
const SHOWN_MAIN_WINDOW = -1;
/**
* Private properties
@ -252,8 +253,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
$playerQuad->setSize(3.8, 3.8);
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Spectate " . $listPlayer->nickname));
$script->addProfileButton($playerQuad, $listPlayer->login); //TODO real action
$playerQuad->setAction(self::ACTION_SPECTATE_PLAYER);
// Player Profile Quad
$playerQuad = new Quad_UIConstruction_Buttons();
@ -585,6 +585,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$targetLogin = $actionArray[2];
switch($action) {
case self::ACTION_SPECTATE_PLAYER: //TODO not working yet
$this->maniaControl->client->query('ForceSpectator', $adminLogin, PlayerActions::SPECTATOR_SPECTATOR);
$this->maniaControl->client->query('ForceSpectatorTarget', $adminLogin, $targetLogin, 1);
break;
case self::ACTION_OPEN_PLAYER_DETAILED:
$player = $this->maniaControl->playerManager->getPlayer($adminLogin);
$this->maniaControl->playerManager->playerDetailed->showPlayerDetailed($player, $targetLogin);

View File

@ -118,6 +118,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_HEIGHT, 5.5);
$this->maniaControl->manialinkManager->iconManager->addIcon(IconManager::MX_ICON);
$this->maniaControl->manialinkManager->iconManager->addIcon(IconManager::MX_ICON_MOVER, "http://www.pictures.esc-clan.net/upload"); //TODO to mc website, icon manager
return true;
}
@ -204,6 +205,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
if(isset($map->mx->pageurl)) {
$quad = new Quad();
$frame->add($quad);
$quad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER));
$quad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON));
$quad->setPosition(-$width / 2 + 4, -1.5, -0.5);
$quad->setSize(4, 4);