actions menu first version working
This commit is contained in:
parent
f34fa20f36
commit
97f371fd03
@ -177,7 +177,37 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconServers);
|
||||
$itemQuad->setSize($itemSize, $itemSize);
|
||||
$iconFrame->add($itemQuad);
|
||||
$itemQuad->setAction(self::ACTION_OPEN_ADMIN_MENU);
|
||||
|
||||
//Admin Menu
|
||||
$popoutFrame = new Frame();
|
||||
$manialink->add($popoutFrame);
|
||||
$popoutFrame->setPosition($posX - $itemSize * 0.5, $posY);
|
||||
$popoutFrame->setHAlign(Control::RIGHT);
|
||||
$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$quad = new Quad();
|
||||
$popoutFrame->add($quad);
|
||||
$quad->setHAlign(Control::RIGHT);
|
||||
$quad->setStyles($quadStyle, $quadSubstyle);
|
||||
$quad->setSize(count($this->adminMenuItems) * $itemSize * $itemMarginFactorX * 1.4, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$popoutFrame->add($quad);
|
||||
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
|
||||
|
||||
// Add items
|
||||
$x = -1;
|
||||
foreach($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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Player Menu Icon Frame
|
||||
$frame = new Frame();
|
||||
@ -197,30 +227,29 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconPlayers);
|
||||
$itemQuad->setSize($itemSize, $itemSize);
|
||||
$iconFrame->add($itemQuad);
|
||||
// $itemQuad->setAction(self::ACTION_OPEN_PLAYER_MENU);
|
||||
|
||||
|
||||
/** TEST TOOLTIP */
|
||||
//Player Menu
|
||||
$popoutFrame = new Frame();
|
||||
$manialink->add($popoutFrame);
|
||||
$popoutFrame->setPosition($posX - $itemSize * 0.5, $posY - $itemSize * $itemMarginFactorY);
|
||||
$popoutFrame->setHAlign(Control::RIGHT);
|
||||
$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$testq = new Quad();
|
||||
$popoutFrame->add($testq);
|
||||
//$testq->setPosition($posX - $itemSize * $itemMarginFactorX, $posY - $itemSize * $itemMarginFactorY);
|
||||
$testq->setHAlign(Control::RIGHT);
|
||||
$testq->setStyles($quadStyle, $quadSubstyle);
|
||||
$testq->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
$quad = new Quad();
|
||||
$popoutFrame->add($quad);
|
||||
$quad->setHAlign(Control::RIGHT);
|
||||
$quad->setStyles($quadStyle, $quadSubstyle);
|
||||
$quad->setSize(count($this->playerMenuItems) * $itemSize * $itemMarginFactorX * 1.4, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$popoutFrame->add($testq);
|
||||
|
||||
$popoutFrame->add($quad);
|
||||
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
|
||||
|
||||
// Add items
|
||||
$x = 0.05;
|
||||
foreach($this->adminMenuItems as $menuItems) {
|
||||
$x = -1;
|
||||
foreach($this->playerMenuItems as $menuItems) {
|
||||
foreach($menuItems as $menuItem) {
|
||||
/** @var Quad $menuItem */
|
||||
$menuItem->setSize($itemSize, $itemSize);
|
||||
@ -231,48 +260,6 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
}
|
||||
}
|
||||
|
||||
/** TEST TOOLTIP */
|
||||
|
||||
|
||||
return $manialink;
|
||||
}
|
||||
|
||||
private function buildMenuIconsManialink2() {
|
||||
$posX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSX);
|
||||
$posY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSY);
|
||||
$itemSize = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_ITEMSIZE);
|
||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
||||
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
|
||||
|
||||
$itemCount = count($this->menuItems);
|
||||
$itemMarginFactorX = 1.3;
|
||||
$itemMarginFactorY = 1.2;
|
||||
|
||||
$manialink = new ManiaLink(self::MLID_MENU);
|
||||
|
||||
$frame = new Frame();
|
||||
$manialink->add($frame);
|
||||
$frame->setPosition($posX, $posY);
|
||||
|
||||
$backgroundQuad = new Quad();
|
||||
$frame->add($backgroundQuad);
|
||||
$backgroundQuad->setSize($itemCount * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||
|
||||
$itemsFrame = new Frame();
|
||||
$frame->add($itemsFrame);
|
||||
|
||||
// Add items
|
||||
$x = 0.5 * $itemSize * $itemMarginFactorX;
|
||||
foreach($this->menuItems as $menuItems) {
|
||||
foreach($menuItems as $menuItem) {
|
||||
$menuItem->setSize($itemSize, $itemSize);
|
||||
$itemsFrame->add($menuItem);
|
||||
|
||||
$x += $itemSize * $itemMarginFactorX;
|
||||
}
|
||||
}
|
||||
|
||||
$this->manialink = $manialink;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,13 @@
|
||||
|
||||
namespace ManiaControl\Maps;
|
||||
|
||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Commands\CommandListener;
|
||||
use ManiaControl\FileUtil;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Players\PlayerManager;
|
||||
|
||||
@ -14,7 +17,12 @@ use ManiaControl\Players\PlayerManager;
|
||||
*
|
||||
* @author steeffeen & kremsy
|
||||
*/
|
||||
class MapCommands implements CommandListener {
|
||||
class MapCommands implements CommandListener, ManialinkPageAnswerListener {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const ACTION_OPEN_MAPLIST = 'MapList.OpenMapList';
|
||||
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
@ -41,6 +49,13 @@ class MapCommands implements CommandListener {
|
||||
$this->maniaControl->commandManager->registerCommandListener('maps', $this, 'command_List');
|
||||
|
||||
$this->mapList = new MapList($this->maniaControl);
|
||||
|
||||
//Action Balance Teams
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,6 @@ use FML\Controls\Labels\Label_Button;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\ManiaLink;
|
||||
use FML\Script\Script;
|
||||
@ -41,6 +40,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
||||
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
||||
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
|
||||
|
||||
const MAX_MAPS_PER_PAGE = 15;
|
||||
const SHOW_MX_LIST = 1;
|
||||
const SHOW_MAP_LIST = 2;
|
||||
@ -79,16 +79,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
||||
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
||||
|
||||
// @var just a test $itemQuad
|
||||
$itemQuad = new Quad();
|
||||
$itemQuad->setStyles('Icons128x32_1', Quad_Icons128x128_1::SUBSTYLE_Create);
|
||||
$itemQuad->setAction(self::ACTION_ADD_MAP);
|
||||
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 4);
|
||||
|
||||
$itemQuad = new Quad();
|
||||
$itemQuad->setStyles('Icons128x32_1', Quad_Icons128x128_1::SUBSTYLE_Challenge);
|
||||
$itemQuad->setAction(self::ACTION_ADD_MAP);
|
||||
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 4);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,16 +3,24 @@
|
||||
namespace ManiaControl\Players;
|
||||
|
||||
use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Commands\CommandListener;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
|
||||
/**
|
||||
* Class offering various admin commands related to players
|
||||
*
|
||||
* @author steeffeen & kremsy
|
||||
*/
|
||||
class PlayerCommands implements CommandListener {
|
||||
class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const ACTION_BALANCE_TEAMS = 'PlayerCommands.BalanceTeams';
|
||||
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
@ -27,6 +35,7 @@ class PlayerCommands implements CommandListener {
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
// Register for admin commands
|
||||
$this->maniaControl->commandManager->registerCommandListener('balance', $this, 'command_TeamBalance',true);
|
||||
$this->maniaControl->commandManager->registerCommandListener('teambalance', $this, 'command_TeamBalance',true);
|
||||
$this->maniaControl->commandManager->registerCommandListener('autoteambalance', $this, 'command_TeamBalance',true);
|
||||
$this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick',true);
|
||||
@ -45,6 +54,12 @@ class PlayerCommands implements CommandListener {
|
||||
|
||||
$this->playerList = new PlayerList($this->maniaControl);
|
||||
|
||||
//Action Balance Teams
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance');
|
||||
$itemQuad = new Quad_Icons128x128_1();
|
||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ProfileVehicle);
|
||||
$itemQuad->setAction(self::ACTION_BALANCE_TEAMS);
|
||||
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user