Added SidebarMenuManager Fixed https://github.com/ManiaControl/ManiaControl/issues/97
This commit is contained in:
parent
d7348fd412
commit
b90a769723
@ -15,6 +15,7 @@ use ManiaControl\General\UsageInformationTrait;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
|
use ManiaControl\Manialinks\SidebarMenuManager;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Settings\Setting;
|
use ManiaControl\Settings\Setting;
|
||||||
@ -41,6 +42,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
const SETTING_MENU_ITEMSIZE = 'Menu Item Size';
|
const SETTING_MENU_ITEMSIZE = 'Menu Item Size';
|
||||||
const ACTION_OPEN_ADMIN_MENU = 'ActionsMenu.OpenAdminMenu';
|
const ACTION_OPEN_ADMIN_MENU = 'ActionsMenu.OpenAdminMenu';
|
||||||
const ACTION_OPEN_PLAYER_MENU = 'ActionsMenu.OpenPlayerMenu';
|
const ACTION_OPEN_PLAYER_MENU = 'ActionsMenu.OpenPlayerMenu';
|
||||||
|
const ADMIN_MENU_ID = 'ActionsMenu.AdminMenu';
|
||||||
|
const PLAYER_MENU_ID = 'ActionsMenu.PlayerMenu';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private properties
|
* Private properties
|
||||||
@ -71,6 +74,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged');
|
||||||
|
|
||||||
|
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry(SidebarMenuManager::ORDER_ADMIN_MENU, self::ADMIN_MENU_ID);
|
||||||
|
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry(SidebarMenuManager::ORDER_PLAYER_MENU, self::PLAYER_MENU_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,19 +140,18 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
/**
|
/**
|
||||||
* Builds the Manialink
|
* Builds the Manialink
|
||||||
*
|
*
|
||||||
* @param $admin
|
* @param Player $player
|
||||||
* @return ManiaLink
|
* @return ManiaLink
|
||||||
*/
|
*/
|
||||||
private function buildMenuIconsManialink($admin = false) {
|
private function buildMenuIconsManialink($admin = false) {
|
||||||
$posX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSX);
|
$adminPos = $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->getEntryPosition(self::ADMIN_MENU_ID);
|
||||||
|
$playerPos = $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->getEntryPosition(self::PLAYER_MENU_ID);
|
||||||
$itemSize = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_ITEMSIZE);
|
$itemSize = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_ITEMSIZE);
|
||||||
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
||||||
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
||||||
$itemMarginFactorX = 1.3;
|
$itemMarginFactorX = 1.3;
|
||||||
$itemMarginFactorY = 1.2;
|
$itemMarginFactorY = 1.2;
|
||||||
|
|
||||||
$posY = $this->getActionsMenuY();
|
|
||||||
|
|
||||||
$maniaLink = new ManiaLink(self::MLID_MENU);
|
$maniaLink = new ManiaLink(self::MLID_MENU);
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->addChild($frame);
|
$maniaLink->addChild($frame);
|
||||||
@ -160,7 +164,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
// Admin Menu Icon Frame
|
// Admin Menu Icon Frame
|
||||||
$iconFrame = new Frame();
|
$iconFrame = new Frame();
|
||||||
$frame->addChild($iconFrame);
|
$frame->addChild($iconFrame);
|
||||||
$iconFrame->setPosition($posX, $posY);
|
$iconFrame->setPosition($adminPos['x'], $adminPos['y']);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$iconFrame->addChild($backgroundQuad);
|
$iconFrame->addChild($backgroundQuad);
|
||||||
@ -175,7 +179,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
// Admin Menu Description
|
// Admin Menu Description
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->addChild($descriptionLabel);
|
$frame->addChild($descriptionLabel);
|
||||||
$descriptionLabel->setPosition($posX - count($this->adminMenuItems) * $itemSize * 1.05 - 5, $posY);
|
$descriptionLabel->setPosition($adminPos['x'] - count($this->adminMenuItems) * $itemSize * 1.05 - 5, $adminPos['y']);
|
||||||
$descriptionLabel->setAlign($descriptionLabel::RIGHT, $descriptionLabel::TOP);
|
$descriptionLabel->setAlign($descriptionLabel::RIGHT, $descriptionLabel::TOP);
|
||||||
$descriptionLabel->setSize(40, 4);
|
$descriptionLabel->setSize(40, 4);
|
||||||
$descriptionLabel->setTextSize(1.4);
|
$descriptionLabel->setTextSize(1.4);
|
||||||
@ -184,7 +188,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
// Admin Menu
|
// Admin Menu
|
||||||
$popoutFrame = new Frame();
|
$popoutFrame = new Frame();
|
||||||
$frame->addChild($popoutFrame);
|
$frame->addChild($popoutFrame);
|
||||||
$popoutFrame->setPosition($posX - $itemSize * 0.5, $posY);
|
$popoutFrame->setPosition($adminPos['x'] - $itemSize * 0.5, $adminPos['y']);
|
||||||
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
||||||
$popoutFrame->setVisible(false);
|
$popoutFrame->setVisible(false);
|
||||||
|
|
||||||
@ -223,7 +227,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
// Player Menu Icon Frame
|
// Player Menu Icon Frame
|
||||||
$iconFrame = new Frame();
|
$iconFrame = new Frame();
|
||||||
$frame->addChild($iconFrame);
|
$frame->addChild($iconFrame);
|
||||||
$iconFrame->setPosition($posX, $posY - $itemSize * $itemMarginFactorY);
|
$iconFrame->setPosition($playerPos['x'], $playerPos['y']);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$iconFrame->addChild($backgroundQuad);
|
$iconFrame->addChild($backgroundQuad);
|
||||||
@ -238,7 +242,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
// Player Menu Description
|
// Player Menu Description
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->addChild($descriptionLabel);
|
$frame->addChild($descriptionLabel);
|
||||||
$descriptionLabel->setPosition($posX - count($this->playerMenuItems) * $itemSize * 1.05 - 5, $posY - $itemSize * $itemMarginFactorY);
|
$descriptionLabel->setPosition($playerPos['x'] - count($this->playerMenuItems) * $itemSize * 1.05 - 5, $playerPos['y']);
|
||||||
$descriptionLabel->setAlign($descriptionLabel::RIGHT, $descriptionLabel::TOP);
|
$descriptionLabel->setAlign($descriptionLabel::RIGHT, $descriptionLabel::TOP);
|
||||||
$descriptionLabel->setSize(40, 4);
|
$descriptionLabel->setSize(40, 4);
|
||||||
$descriptionLabel->setTextSize(1.4);
|
$descriptionLabel->setTextSize(1.4);
|
||||||
@ -247,7 +251,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
// Player Menu
|
// Player Menu
|
||||||
$popoutFrame = new Frame();
|
$popoutFrame = new Frame();
|
||||||
$frame->addChild($popoutFrame);
|
$frame->addChild($popoutFrame);
|
||||||
$popoutFrame->setPosition($posX - $itemSize * 0.5, $posY - $itemSize * $itemMarginFactorY);
|
$popoutFrame->setPosition($playerPos['x'] - $itemSize * 0.5, $playerPos['y']);
|
||||||
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
||||||
$popoutFrame->setVisible(false);
|
$popoutFrame->setVisible(false);
|
||||||
|
|
||||||
@ -336,12 +340,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerJoined(Player $player) {
|
public function handlePlayerJoined(Player $player) {
|
||||||
if ($this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
$maniaLink = $this->buildMenuIconsManialink($player);
|
||||||
$maniaLink = $this->buildMenuIconsManialink(true);
|
|
||||||
} else {
|
|
||||||
$maniaLink = $this->buildMenuIconsManialink(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player);
|
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,18 +356,4 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
|
|
||||||
$this->rebuildAndShowMenu();
|
$this->rebuildAndShowMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Y value of the Actionsmenu (dependent on game)
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getActionsMenuY() {
|
|
||||||
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
|
|
||||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSY_SHOOTMANIA);
|
|
||||||
} else {
|
|
||||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSY_TRACKMANIA);
|
|
||||||
}
|
|
||||||
return $posY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,6 @@ class CallbackManager implements UsageInformationAble {
|
|||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
$callbacks = $this->maniaControl->getClient()->executeCallbacks();
|
$callbacks = $this->maniaControl->getClient()->executeCallbacks();
|
||||||
$timings["executeCallbacks"] = microtime(true) - $startTime;
|
$timings["executeCallbacks"] = microtime(true) - $startTime;
|
||||||
|
|
||||||
foreach ($callbacks as $key => $callback) {
|
foreach ($callbacks as $key => $callback) {
|
||||||
$time1 = microtime(true);
|
$time1 = microtime(true);
|
||||||
$this->handleCallback($callback);
|
$this->handleCallback($callback);
|
||||||
|
@ -52,6 +52,9 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
/** @var IconManager $iconManager */
|
/** @var IconManager $iconManager */
|
||||||
private $iconManager = null;
|
private $iconManager = null;
|
||||||
|
|
||||||
|
/** @var SidebarMenuManager $sidebarMenuManager */
|
||||||
|
private $sidebarMenuManager = null;
|
||||||
|
|
||||||
// TODO: use listening class
|
// TODO: use listening class
|
||||||
private $pageAnswerListeners = array();
|
private $pageAnswerListeners = array();
|
||||||
private $pageAnswerRegexListener = array();
|
private $pageAnswerRegexListener = array();
|
||||||
@ -68,6 +71,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
$this->styleManager = new StyleManager($maniaControl);
|
$this->styleManager = new StyleManager($maniaControl);
|
||||||
$this->customUIManager = new CustomUIManager($maniaControl);
|
$this->customUIManager = new CustomUIManager($maniaControl);
|
||||||
$this->iconManager = new IconManager($maniaControl);
|
$this->iconManager = new IconManager($maniaControl);
|
||||||
|
$this->sidebarMenuManager = new SidebarMenuManager($maniaControl);
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
$this->registerManialinkPageAnswerListener(self::ACTION_CLOSEWIDGET, $this, 'closeWidgetCallback');
|
$this->registerManialinkPageAnswerListener(self::ACTION_CLOSEWIDGET, $this, 'closeWidgetCallback');
|
||||||
@ -212,7 +216,6 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
$this->sendManialink($maniaLink, $player);
|
$this->sendManialink($maniaLink, $player);
|
||||||
|
|
||||||
if ($widgetName) {
|
if ($widgetName) {
|
||||||
// TODO make check by manialinkId, getter is needed to avoid uses on non main widgets
|
|
||||||
$this->disableAltMenu($player);
|
$this->disableAltMenu($player);
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$player = $this->maniaControl->getPlayerManager()->getPlayer($player);
|
$player = $this->maniaControl->getPlayerManager()->getPlayer($player);
|
||||||
@ -249,9 +252,9 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
if (is_array($logins)) {
|
if (is_array($logins)) {
|
||||||
$loginList = array();
|
$loginList = array();
|
||||||
foreach ($logins as $login) {
|
foreach ($logins as $login) {
|
||||||
if($login instanceof Player){
|
if ($login instanceof Player) {
|
||||||
$loginList[] = $login->login;
|
$loginList[] = $login->login;
|
||||||
}else{
|
} else {
|
||||||
$loginList[] = $login;
|
$loginList[] = $login;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,4 +391,11 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
|
|
||||||
return $labelLine->getEntries();
|
return $labelLine->getEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SidebarMenuManager
|
||||||
|
*/
|
||||||
|
public function getSidebarMenuManager() {
|
||||||
|
return $this->sidebarMenuManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace ManiaControl\Manialinks\SidebarMenu;
|
namespace ManiaControl\Manialinks;
|
||||||
|
|
||||||
use FML\Controls\Frame;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use FML\Controls\Quad;
|
|
||||||
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
|
||||||
use FML\ManiaLink;
|
|
||||||
use ManiaControl\General\UsageInformationAble;
|
use ManiaControl\General\UsageInformationAble;
|
||||||
use ManiaControl\General\UsageInformationTrait;
|
use ManiaControl\General\UsageInformationTrait;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
|
||||||
|
|
||||||
|
|
||||||
class SidebarMenuManager implements UsageInformationAble {
|
class SidebarMenuManager implements UsageInformationAble, CallbackListener {
|
||||||
use UsageInformationTrait;
|
use UsageInformationTrait;
|
||||||
|
|
||||||
const SIDEBAR_MANIALINK_ID = 'SidebarMenuManager.SidebarMenu';
|
|
||||||
const ADMIN_MENU_ORDER = 10;
|
|
||||||
const PLAYER_MENU_ORDER = 20;
|
|
||||||
|
|
||||||
/* Settings */
|
/* Settings */
|
||||||
const SETTING_SIDEBAR_POSX = 'Sidebar X Position';
|
const SETTING_SIDEBAR_POSX = 'Sidebar X Position';
|
||||||
const SETTING_SIDEBAR_POSY_SHOOTMANIA = 'Sidebar Y Position (Shootmania)';
|
const SETTING_SIDEBAR_POSY_SHOOTMANIA = 'Sidebar Y Position (Shootmania)';
|
||||||
const SETTING_SIDEBAR_POSY_TRACKMANIA = 'Sidebar Y Position (Trackmania)';
|
const SETTING_SIDEBAR_POSY_TRACKMANIA = 'Sidebar Y Position (Trackmania)';
|
||||||
const SETTING_MENU_ITEMSIZE = 'Size of menu items';
|
const SETTING_MENU_ITEMSIZE = 'Size of menu items';
|
||||||
|
|
||||||
|
const ORDER_ADMIN_MENU = 10;
|
||||||
|
const ORDER_PLAYER_MENU = 20;
|
||||||
|
|
||||||
/* @var $maniaControl ManiaControl */
|
/* @var $maniaControl ManiaControl */
|
||||||
private $maniaControl;
|
private $maniaControl;
|
||||||
private $menuEntries = array();
|
private $menuEntries = array();
|
||||||
|
private $yPositions = array();
|
||||||
|
|
||||||
function __construct(ManiaControl $maniaControl) {
|
function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
@ -35,72 +31,86 @@ class SidebarMenuManager implements UsageInformationAble {
|
|||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SIDEBAR_POSY_SHOOTMANIA, -37);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SIDEBAR_POSY_SHOOTMANIA, -37);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA, 17);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA, 17);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addMenuEntry(SidebarMenuEntry $entry, $order) {
|
/**
|
||||||
if (isset($this->menuEntries[$order])) {
|
* Returns array('x' => xPosition, 'y' => yPosition) of the Sidebar
|
||||||
$this->addMenuEntry($entry, $order + 1);
|
*
|
||||||
}
|
* @return array
|
||||||
array_push($menuEntries, $entry);
|
* @api
|
||||||
ksort($this->menuEntries);
|
*/
|
||||||
$this->updateManiaLink();
|
public function getSidebarPosition() {
|
||||||
}
|
|
||||||
|
|
||||||
private function itemsBeforeAdmin() {
|
|
||||||
$count = 0;
|
|
||||||
foreach ($this->menuEntries as $key => $entry) {
|
|
||||||
if ($key < self::ADMIN_MENU_ORDER) {
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function updateManiaLink() {
|
|
||||||
$itemSize = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_ITEMSIZE);
|
|
||||||
$posX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSX);
|
$posX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSX);
|
||||||
|
|
||||||
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
|
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
|
||||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_SHOOTMANIA);
|
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_SHOOTMANIA);
|
||||||
} else {
|
} else {
|
||||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA);
|
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA);
|
||||||
}
|
}
|
||||||
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
|
||||||
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
|
||||||
$itemMarginFactorX = 1.3;
|
|
||||||
$itemMarginFactorY = 1.2;
|
|
||||||
|
|
||||||
//Calculate X relative to AdminMenu
|
return array('x' => $posX, 'y' => $posY);
|
||||||
$posX -= $itemSize * 1.05 * $this->itemsBeforeAdmin();
|
}
|
||||||
|
|
||||||
$maniaLink = new ManiaLink(self::SIDEBAR_MANIALINK_ID);
|
/**
|
||||||
$frame = new Frame();
|
* Returns array('x' => xPosition, 'y' => yPosition) of a menu item of the sidebar
|
||||||
$maniaLink->addChild($frame);
|
*
|
||||||
$frame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
|
* @param string $id
|
||||||
$frame->setPosition($posX, $posY);
|
* @return array|null
|
||||||
|
*/
|
||||||
|
public function getEntryPosition($id) {
|
||||||
|
$itemSize = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_ITEMSIZE);
|
||||||
|
$pos = $this->getSidebarPosition();
|
||||||
|
$posX = $pos['x'];
|
||||||
|
$posY = $pos['y'];
|
||||||
|
|
||||||
|
if (isset($this->yPositions[$id])) {
|
||||||
|
return array('x' => $posX, 'y' => $this->yPositions[$id]);
|
||||||
|
}
|
||||||
|
|
||||||
$posX = 0;
|
|
||||||
/** @var SidebarMenuEntry $entry */
|
|
||||||
foreach ($this->menuEntries as $entry) {
|
foreach ($this->menuEntries as $entry) {
|
||||||
$iconFrame = new Frame();
|
if ($entry == $id) {
|
||||||
$frame->addChild($iconFrame);
|
$this->yPositions[$id] = $posY;
|
||||||
$iconFrame->setX($posX);
|
return array('x' => $posX, 'y' => $posY);
|
||||||
|
|
||||||
$background = new Quad();
|
|
||||||
$frame->addChild($background);
|
|
||||||
$background->setStyles($quadStyle, $quadSubstyle);
|
|
||||||
$background->setSize($itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
|
||||||
|
|
||||||
$icon = $entry->getIcon();
|
|
||||||
$frame->addChild($icon);
|
|
||||||
if($entry->getDescription()){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$posY -= $itemSize * 1.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getErrorHandler()->triggerDebugNotice('SidebarMenuEntry id:' . $id . ' not found');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an Entry to the SidebarMenu
|
||||||
|
* Get the associated position with getEntryPosition($id)
|
||||||
|
*
|
||||||
|
* @param int $order
|
||||||
|
* @param string $id
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function addMenuEntry($order, $id) {
|
||||||
|
if (isset($this->menuEntries[$order])) {
|
||||||
|
if ($this->menuEntries[$order] != $id) {
|
||||||
|
$this->addMenuEntry($order + 1, $id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->menuEntries[$order] = $id;
|
||||||
|
ksort($this->menuEntries);
|
||||||
|
$this->yPositions = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink);
|
/**
|
||||||
|
* Deletes an Entry from the SidebarMenu
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
*/
|
||||||
|
public function deleteMenuEntry($id) {
|
||||||
|
foreach ($this->menuEntries as $k => $entry) {
|
||||||
|
if ($entry == $id) {
|
||||||
|
array_splice($this->menuEntries, $k, 1);
|
||||||
|
$this->yPositions = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ use ManiaControl\Commands\CommandListener;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
|
use ManiaControl\Manialinks\SidebarMenuManager;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
@ -54,11 +55,6 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
const PLUGIN_NAME = 'CustomVotesPlugin';
|
const PLUGIN_NAME = 'CustomVotesPlugin';
|
||||||
const PLUGIN_AUTHOR = 'kremsy';
|
const PLUGIN_AUTHOR = 'kremsy';
|
||||||
|
|
||||||
const SETTING_VOTE_ICON_POSX = 'Vote-Icon-Position: X';
|
|
||||||
const SETTING_VOTE_ICON_POSY = 'Vote-Icon-Position: Y';
|
|
||||||
const SETTING_VOTE_ICON_WIDTH = 'Vote-Icon-Size: Width';
|
|
||||||
const SETTING_VOTE_ICON_HEIGHT = 'Vote-Icon-Size: Height';
|
|
||||||
|
|
||||||
const SETTING_WIDGET_POSX = 'Widget-Position: X';
|
const SETTING_WIDGET_POSX = 'Widget-Position: X';
|
||||||
const SETTING_WIDGET_POSY = 'Widget-Position: Y';
|
const SETTING_WIDGET_POSY = 'Widget-Position: Y';
|
||||||
const SETTING_WIDGET_WIDTH = 'Widget-Size: Width';
|
const SETTING_WIDGET_WIDTH = 'Widget-Size: Width';
|
||||||
@ -71,7 +67,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
|
|
||||||
const MLID_WIDGET = 'CustomVotesPlugin.WidgetId';
|
const MLID_WIDGET = 'CustomVotesPlugin.WidgetId';
|
||||||
const MLID_ICON = 'CustomVotesPlugin.IconWidgetId';
|
const MLID_ICON = 'CustomVotesPlugin.IconWidgetId';
|
||||||
|
const CUSTOMVOTES_MENU_ID = 'CustomVotesPlugin.MenuId';
|
||||||
|
|
||||||
const ACTION_POSITIVE_VOTE = 'CustomVotesPlugin.PositiveVote';
|
const ACTION_POSITIVE_VOTE = 'CustomVotesPlugin.PositiveVote';
|
||||||
const ACTION_NEGATIVE_VOTE = 'CustomVotesPlugin.NegativeVote';
|
const ACTION_NEGATIVE_VOTE = 'CustomVotesPlugin.NegativeVote';
|
||||||
@ -153,19 +149,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(ScriptManager::CB_PAUSE_STATUS_CHANGED, $this, 'constructMenu');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(ScriptManager::CB_PAUSE_STATUS_CHANGED, $this, 'constructMenu');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged');
|
||||||
|
|
||||||
$actionsPosX = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSX);
|
|
||||||
$actionsPosY = $this->maniaControl->getActionsMenu()->getActionsMenuY();
|
|
||||||
$iconSize = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_ITEMSIZE);
|
|
||||||
|
|
||||||
$itemMarginFactorY = 1.2;
|
|
||||||
$posY = $actionsPosY - 2 * ($iconSize * $itemMarginFactorY);
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSX, $actionsPosX);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSY, $posY);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_WIDTH, 6);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_HEIGHT, 6);
|
|
||||||
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSX, -80); //160 -15
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSX, -80); //160 -15
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSY, 80); //-15
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSY, 80); //-15
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 50); //30
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 50); //30
|
||||||
@ -177,6 +161,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_TIME, 40);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_TIME, 40);
|
||||||
|
|
||||||
|
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry(SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID);
|
||||||
|
|
||||||
//Define Votes
|
//Define Votes
|
||||||
$this->defineVote("teambalance", "Vote for Team Balance");
|
$this->defineVote("teambalance", "Vote for Team Balance");
|
||||||
$this->defineVote("skipmap", "Vote for Skip Map")->setStopCallback(Callbacks::ENDMAP);
|
$this->defineVote("skipmap", "Vote for Skip Map")->setStopCallback(Callbacks::ENDMAP);
|
||||||
@ -282,10 +268,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
* @param bool $login
|
* @param bool $login
|
||||||
*/
|
*/
|
||||||
private function showIcon($login = false) {
|
private function showIcon($login = false) {
|
||||||
$posX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_POSX);
|
$pos = $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->getEntryPosition(self::CUSTOMVOTES_MENU_ID);
|
||||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_POSY);
|
$width = $this->maniaControl->getSettingManager()->getSettingValue(SidebarMenuManager::class, SidebarMenuManager::SETTING_MENU_ITEMSIZE);
|
||||||
$width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_WIDTH);
|
|
||||||
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_HEIGHT);
|
|
||||||
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
||||||
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
||||||
$itemMarginFactorX = 1.3;
|
$itemMarginFactorX = 1.3;
|
||||||
@ -298,12 +282,12 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
//Custom Vote Menu Iconsframe
|
//Custom Vote Menu Iconsframe
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->addChild($frame);
|
$maniaLink->addChild($frame);
|
||||||
$frame->setPosition($posX, $posY);
|
$frame->setPosition($pos['x'], $pos['y']);
|
||||||
$frame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
|
$frame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->addChild($backgroundQuad);
|
$frame->addChild($backgroundQuad);
|
||||||
$backgroundQuad->setSize($width * $itemMarginFactorX, $height * $itemMarginFactorY);
|
$backgroundQuad->setSize($width * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
$iconFrame = new Frame();
|
$iconFrame = new Frame();
|
||||||
@ -319,7 +303,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$menuEntries = count($this->voteMenuItems);
|
$menuEntries = count($this->voteMenuItems);
|
||||||
$descriptionFrame = new Frame();
|
$descriptionFrame = new Frame();
|
||||||
$maniaLink->addChild($descriptionFrame);
|
$maniaLink->addChild($descriptionFrame);
|
||||||
$descriptionFrame->setPosition($posX - $menuEntries * $itemSize * 1.05 - 5, $posY);
|
$descriptionFrame->setPosition($pos['x'] - $menuEntries * $itemSize * 1.05 - 5, $pos['y']);
|
||||||
|
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$descriptionFrame->addChild($descriptionLabel);
|
$descriptionFrame->addChild($descriptionLabel);
|
||||||
@ -331,7 +315,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
//Popout Frame
|
//Popout Frame
|
||||||
$popoutFrame = new Frame();
|
$popoutFrame = new Frame();
|
||||||
$maniaLink->addChild($popoutFrame);
|
$maniaLink->addChild($popoutFrame);
|
||||||
$popoutFrame->setPosition($posX - $itemSize * 0.5, $posY);
|
$popoutFrame->setPosition($pos['x'] - $itemSize * 0.5, $pos['y']);
|
||||||
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
||||||
$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||||
$popoutFrame->setVisible(false);
|
$popoutFrame->setVisible(false);
|
||||||
|
@ -19,6 +19,7 @@ use ManiaControl\Commands\CommandListener;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\LabelLine;
|
use ManiaControl\Manialinks\LabelLine;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
|
use ManiaControl\Manialinks\SidebarMenuManager;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
@ -41,14 +42,11 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
const SETTING_ANNOUNCE_SERVER_DONATION = 'Enable Server-Donation Announcements';
|
const SETTING_ANNOUNCE_SERVER_DONATION = 'Enable Server-Donation Announcements';
|
||||||
const STAT_PLAYER_DONATIONS = 'Donated Planets';
|
const STAT_PLAYER_DONATIONS = 'Donated Planets';
|
||||||
const ACTION_DONATE_VALUE = 'Donate.DonateValue';
|
const ACTION_DONATE_VALUE = 'Donate.DonateValue';
|
||||||
|
const DONATIONPLUGIN_MENU_ID = 'DonationPlugin.MenuId';
|
||||||
|
|
||||||
// DonateWidget Properties
|
// DonateWidget Properties
|
||||||
const MLID_DONATE_WIDGET = 'DonationPlugin.DonateWidget';
|
const MLID_DONATE_WIDGET = 'DonationPlugin.DonateWidget';
|
||||||
const SETTING_DONATE_WIDGET_ACTIVATED = 'Donate-Widget Activated';
|
const SETTING_DONATE_WIDGET_ACTIVATED = 'Donate-Widget Activated';
|
||||||
const SETTING_DONATE_WIDGET_POSX = 'Donate-Widget-Position: X';
|
|
||||||
const SETTING_DONATE_WIDGET_POSY = 'Donate-Widget-Position: Y';
|
|
||||||
const SETTING_DONATE_WIDGET_WIDTH = 'Donate-Widget-Size: Width';
|
|
||||||
const SETTING_DONATE_WIDGET_HEIGHT = 'Donate-Widget-Size: Height';
|
|
||||||
const SETTING_DONATION_VALUES = 'Donation Values';
|
const SETTING_DONATION_VALUES = 'Donation Values';
|
||||||
const SETTING_MIN_AMOUNT_SHOWN = 'Minimum Donation amount to get shown';
|
const SETTING_MIN_AMOUNT_SHOWN = 'Minimum Donation amount to get shown';
|
||||||
|
|
||||||
@ -118,18 +116,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
// Define player stats
|
// Define player stats
|
||||||
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_DONATIONS);
|
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_DONATIONS);
|
||||||
|
|
||||||
$actionsPosX = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSX);
|
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry(SidebarMenuManager::ORDER_PLAYER_MENU + 10, self::DONATIONPLUGIN_MENU_ID);
|
||||||
$actionsPosY = $this->maniaControl->getActionsMenu()->getActionsMenuY();
|
|
||||||
$iconSize = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_ITEMSIZE);
|
|
||||||
|
|
||||||
$itemMarginFactorY = 1.2;
|
|
||||||
$posY = $actionsPosY - 3 * ($iconSize * $itemMarginFactorY);
|
|
||||||
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED, true);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED, true);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSX, $actionsPosX);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSY, $posY);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_WIDTH, 6);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_HEIGHT, 6);
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATION_VALUES, "20,50,100,500,1000,2000");
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATION_VALUES, "20,50,100,500,1000,2000");
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MIN_AMOUNT_SHOWN, 100);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MIN_AMOUNT_SHOWN, 100);
|
||||||
|
|
||||||
@ -155,10 +144,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
* @param string $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
public function displayDonateWidget($login = null) {
|
public function displayDonateWidget($login = null) {
|
||||||
$posX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_POSX);
|
$pos = $this->maniaControl->getManialinkManager()->getSidebarMenuManager()->getEntryPosition(self::DONATIONPLUGIN_MENU_ID);
|
||||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_POSY);
|
$itemSize = $this->maniaControl->getSettingManager()->getSettingValue(SidebarMenuManager::class, SidebarMenuManager::SETTING_MENU_ITEMSIZE);
|
||||||
$width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_WIDTH);
|
|
||||||
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_HEIGHT);
|
|
||||||
$values = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATION_VALUES);
|
$values = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATION_VALUES);
|
||||||
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
||||||
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
||||||
@ -166,19 +153,17 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$itemMarginFactorY = 1.2;
|
$itemMarginFactorY = 1.2;
|
||||||
|
|
||||||
|
|
||||||
$itemSize = $width;
|
|
||||||
|
|
||||||
$maniaLink = new ManiaLink(self::MLID_DONATE_WIDGET);
|
$maniaLink = new ManiaLink(self::MLID_DONATE_WIDGET);
|
||||||
|
|
||||||
// Donate Menu Icon Frame
|
// Donate Menu Icon Frame
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->addChild($frame);
|
$maniaLink->addChild($frame);
|
||||||
$frame->setPosition($posX, $posY);
|
$frame->setPosition($pos['x'], $pos['y']);
|
||||||
$frame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
|
$frame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->addChild($backgroundQuad);
|
$frame->addChild($backgroundQuad);
|
||||||
$backgroundQuad->setSize($width * $itemMarginFactorX, $height * $itemMarginFactorY);
|
$backgroundQuad->setSize($itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
$iconFrame = new Frame();
|
$iconFrame = new Frame();
|
||||||
@ -230,7 +215,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$posX -= strlen($value) * 1.6 + 2.5;
|
$posX -= strlen($value) * 1.6 + 2.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
$descriptionFrame->setPosition($posX - $width + $itemMarginFactorX, 0);
|
$descriptionFrame->setPosition($posX - $itemSize + $itemMarginFactorX, 0);
|
||||||
|
|
||||||
//Popout background
|
//Popout background
|
||||||
$quad = new Quad();
|
$quad = new Quad();
|
||||||
@ -494,9 +479,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
|
|
||||||
$labelLine = new LabelLine($headFrame);
|
$labelLine = new LabelLine($headFrame);
|
||||||
$labelLine->setPrefix('$o');
|
$labelLine->setPrefix('$o');
|
||||||
$labelLine->addLabelEntryText('Id',$posX + 5);
|
$labelLine->addLabelEntryText('Id', $posX + 5);
|
||||||
$labelLine->addLabelEntryText('Nickname', $posX + 18);
|
$labelLine->addLabelEntryText('Nickname', $posX + 18);
|
||||||
$labelLine->addLabelEntryText('Login',$posX + 70);
|
$labelLine->addLabelEntryText('Login', $posX + 70);
|
||||||
$labelLine->addLabelEntryText('Donated planets', $posX + 110);
|
$labelLine->addLabelEntryText('Donated planets', $posX + 110);
|
||||||
$labelLine->render();
|
$labelLine->render();
|
||||||
|
|
||||||
@ -528,9 +513,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
|
|
||||||
$labelLine = new LabelLine($playerFrame);
|
$labelLine = new LabelLine($playerFrame);
|
||||||
$labelLine->addLabelEntryText($index, $posX + 5, 13);
|
$labelLine->addLabelEntryText($index, $posX + 5, 13);
|
||||||
$labelLine->addLabelEntryText($donatingPlayer->nickname,$posX + 18, 52);
|
$labelLine->addLabelEntryText($donatingPlayer->nickname, $posX + 18, 52);
|
||||||
$labelLine->addLabelEntryText($donatingPlayer->login,$posX + 70, 40);
|
$labelLine->addLabelEntryText($donatingPlayer->login, $posX + 70, 40);
|
||||||
$labelLine->addLabelEntryText($donations,$posX + 110, $width / 2 - ($posX + 110));
|
$labelLine->addLabelEntryText($donations, $posX + 110, $width / 2 - ($posX + 110));
|
||||||
$labelLine->render();
|
$labelLine->render();
|
||||||
|
|
||||||
$posY -= 4;
|
$posY -= 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user