design improvements
This commit is contained in:
parent
91185378b8
commit
4674392336
@ -36,7 +36,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
private $adminMenuItems = array();
|
private $adminMenuItems = array();
|
||||||
private $playerMenuItems = array();
|
private $playerMenuItems = array();
|
||||||
|
private $initCompleted = false;
|
||||||
/**
|
/**
|
||||||
* Create a new Actions Menu
|
* Create a new Actions Menu
|
||||||
*
|
*
|
||||||
@ -68,8 +68,10 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
if($playerAction) {
|
if($playerAction) {
|
||||||
$this->addPlayerMenuItem($control, $order, $description);
|
$this->addPlayerMenuItem($control, $order, $description);
|
||||||
} else {
|
} else {
|
||||||
$this->addAdminMenuItem($control, $order,$description);
|
$this->addAdminMenuItem($control, $order, $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->rebuildAndShowMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,6 +114,21 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
|
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +26,7 @@ class IconManager implements CallbackListener {
|
|||||||
* Some Default icons
|
* Some Default icons
|
||||||
*/
|
*/
|
||||||
const MX_ICON = 'ManiaExchange.png';
|
const MX_ICON = 'ManiaExchange.png';
|
||||||
|
const MX_ICON_MOVER = 'ManiaExchange_logo_press.png';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Properties
|
* Private Properties
|
||||||
|
@ -2,19 +2,24 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Maps;
|
namespace ManiaControl\Maps;
|
||||||
|
|
||||||
|
use FML\Controls\Quad;
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Manialinks\IconManager;
|
||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
|
use WidgetPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class offering commands to manage maps
|
* Class offering commands to manage maps
|
||||||
*
|
*
|
||||||
* @author steeffeen & kremsy
|
* @author steeffeen & kremsy
|
||||||
*/
|
*/
|
||||||
class MapCommands implements CommandListener, ManialinkPageAnswerListener {
|
class MapCommands implements CommandListener, ManialinkPageAnswerListener,CallbackListener {
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -50,35 +55,46 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
$this->mapList = new MapList($this->maniaControl);
|
$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');
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList');
|
||||||
$itemQuad = new Quad_Icons64x64_1();
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List');
|
||||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Browser);
|
$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);
|
$itemQuad->setAction(self::ACTION_OPEN_XLIST);
|
||||||
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 3, 'Open MX List');
|
$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');
|
|
||||||
$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,'Open MapList');
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 4,'Open MapList');
|
||||||
|
|
||||||
//Menu RestartMap
|
//Menu 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, 'Restart Map');
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 0, 'Restart Map');
|
||||||
|
|
||||||
//Menu NextMap
|
//Menu 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, 'Skip Map');
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 1, 'Skip Map');
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Handle removemap command
|
* Handle removemap command
|
||||||
*
|
*
|
||||||
|
@ -5,6 +5,7 @@ namespace ManiaControl\Players;
|
|||||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
use FML\Controls\Quads\Quad_Icons128x128_1;
|
||||||
use FML\Controls\Quads\Quad_Icons128x32_1;
|
use FML\Controls\Quads\Quad_Icons128x32_1;
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
|
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
@ -72,10 +73,10 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
|
|||||||
$itemQuad->setAction(self::ACTION_CANCEL_VOTE);
|
$itemQuad->setAction(self::ACTION_CANCEL_VOTE);
|
||||||
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 6);
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 6);
|
||||||
|
|
||||||
//Action Balance Teams
|
//Action Open Playerlist
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
||||||
$itemQuad = new Quad_Icons128x128_1();
|
$itemQuad = new Quad_UIConstruction_Buttons();
|
||||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Buddies);
|
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
|
||||||
$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST);
|
$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST);
|
||||||
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 9);
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 9);
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
const ACTION_ADD_AS_MOD = 'PlayerList.PlayerAddAsModerator';
|
const ACTION_ADD_AS_MOD = 'PlayerList.PlayerAddAsModerator';
|
||||||
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
|
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
|
||||||
const ACTION_OPEN_PLAYER_DETAILED = 'PlayerList.OpenPlayerDetailed';
|
const ACTION_OPEN_PLAYER_DETAILED = 'PlayerList.OpenPlayerDetailed';
|
||||||
|
const ACTION_SPECTATE_PLAYER = 'PlayerList.SpectatePlayer';
|
||||||
const SHOWN_MAIN_WINDOW = -1;
|
const SHOWN_MAIN_WINDOW = -1;
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
@ -252,8 +253,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
|
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
|
||||||
$playerQuad->setSize(3.8, 3.8);
|
$playerQuad->setSize(3.8, 3.8);
|
||||||
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Spectate " . $listPlayer->nickname));
|
$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
|
// Player Profile Quad
|
||||||
$playerQuad = new Quad_UIConstruction_Buttons();
|
$playerQuad = new Quad_UIConstruction_Buttons();
|
||||||
@ -585,6 +585,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$targetLogin = $actionArray[2];
|
$targetLogin = $actionArray[2];
|
||||||
|
|
||||||
switch($action) {
|
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:
|
case self::ACTION_OPEN_PLAYER_DETAILED:
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
$player = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||||
$this->maniaControl->playerManager->playerDetailed->showPlayerDetailed($player, $targetLogin);
|
$this->maniaControl->playerManager->playerDetailed->showPlayerDetailed($player, $targetLogin);
|
||||||
|
@ -118,6 +118,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_HEIGHT, 5.5);
|
$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);
|
||||||
|
$this->maniaControl->manialinkManager->iconManager->addIcon(IconManager::MX_ICON_MOVER, "http://www.pictures.esc-clan.net/upload"); //TODO to mc website, icon manager
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +205,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
if(isset($map->mx->pageurl)) {
|
if(isset($map->mx->pageurl)) {
|
||||||
$quad = new Quad();
|
$quad = new Quad();
|
||||||
$frame->add($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->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON));
|
||||||
$quad->setPosition(-$width / 2 + 4, -1.5, -0.5);
|
$quad->setPosition(-$width / 2 + 4, -1.5, -0.5);
|
||||||
$quad->setSize(4, 4);
|
$quad->setSize(4, 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user