Fixed https://github.com/ManiaControl/ManiaControl/issues/99
ActionsMenu::SETTING_MENU_POSY is split up to ActionsMenu::SETTING_MENU_POSY_SHOOTMANIA and ActionsMenu::SETTING_MENU_POSY_TRACKMANIA
This commit is contained in:
Jocy 2017-05-08 12:31:14 +02:00
parent f0adaed999
commit a3ecf3267f
5 changed files with 34 additions and 45 deletions

View File

@ -36,7 +36,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
*/
const MLID_MENU = 'ActionsMenu.MLID';
const SETTING_MENU_POSX = 'Menu Position: X';
const SETTING_MENU_POSY = 'Menu Position: Y';
const SETTING_MENU_POSY_SHOOTMANIA = 'Shootmania Menu Position: Y';
const SETTING_MENU_POSY_TRACKMANIA = 'Trackmania Menu Position: Y';
const SETTING_MENU_ITEMSIZE = 'Menu Item Size';
const ACTION_OPEN_ADMIN_MENU = 'ActionsMenu.OpenAdminMenu';
const ACTION_OPEN_PLAYER_MENU = 'ActionsMenu.OpenPlayerMenu';
@ -60,7 +61,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
// Settings
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSX, 156.);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSY, -17.);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSY_SHOOTMANIA, -37.);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSY_TRACKMANIA, -17.);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6.);
// Callbacks
@ -129,18 +131,13 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
*/
private function buildMenuIconsManialink(Player $player) {
$posX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSX);
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSY);
$itemSize = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_ITEMSIZE);
$shootManiaOffset = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultIconOffsetSM();
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
$itemMarginFactorX = 1.3;
$itemMarginFactorY = 1.2;
// If game is shootmania lower the icons position by 20
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
$posY -= $shootManiaOffset;
}
$posY = $this->getActionsMenuY();
$maniaLink = new ManiaLink(self::MLID_MENU);
$frame = new Frame();
@ -346,4 +343,18 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
$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;
}
}

View File

@ -41,7 +41,6 @@ class StyleManager implements UsageInformationAble {
const SETTING_LIST_WIDGETS_WIDTH = 'List Widgets Width';
const SETTING_LIST_WIDGETS_HEIGHT = 'List Widgets Height';
const SETTING_ICON_DEFAULT_OFFSET_SM = 'Default Icon Offset in ShootMania';
/*
* Private properties
@ -67,16 +66,6 @@ class StyleManager implements UsageInformationAble {
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LIST_WIDGETS_WIDTH, 150.);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT, 80.);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM, 20.);
}
/**
* Get the default Icon Offset for shootmania
*
* @return float
*/
public function getDefaultIconOffsetSM() {
return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_ICON_DEFAULT_OFFSET_SM);
}
/**

View File

@ -151,7 +151,6 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
$installButton = new Label_Button();
$pluginFrame->addChild($installButton);
$installButton->setHorizontalAlign($installButton::RIGHT)->setX($width * 0.47)->setStyle($installButton::STYLE_CardButtonSmall)->setText('Install')->setTranslate(true)->setAction(self::ACTION_PREFIX_INSTALL_PLUGIN . $plugin->id);
}
if ($plugin->currentVersion->verified > 0) {
// Suggested quad
@ -159,6 +158,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
$pluginFrame->addChild($suggestedQuad);
$suggestedQuad->setPosition($width * 0.45, $entryHeight * 0.12, 2)->setSize(4, 4)->setSubStyle($suggestedQuad::SUBSTYLE_StateSuggested);
}
}
$posY -= $entryHeight;
$index++;

View File

@ -154,7 +154,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$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->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSY);
$actionsPosY = $this->maniaControl->getActionsMenu()->getActionsMenuY();
$iconSize = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_ITEMSIZE);
$itemMarginFactorY = 1.2;
@ -286,17 +286,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_POSY);
$width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_WIDTH);
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_HEIGHT);
$shootManiaOffset = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultIconOffsetSM();
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
$itemMarginFactorX = 1.3;
$itemMarginFactorY = 1.2;
//If game is shootmania lower the icons position by 20
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
$posY -= $shootManiaOffset;
}
$itemSize = $width;
$maniaLink = new ManiaLink(self::MLID_ICON);

View File

@ -118,7 +118,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_DONATIONS);
$actionsPosX = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSX);
$actionsPosY = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSY);
$actionsPosY = $this->maniaControl->getActionsMenu()->getActionsMenuY();
$iconSize = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_ITEMSIZE);
$itemMarginFactorY = 1.2;
@ -159,16 +159,11 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$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);
$shootManiaOffset = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultIconOffsetSM();
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
$itemMarginFactorX = 1.3;
$itemMarginFactorY = 1.2;
//If game is shootmania lower the icons position by 20
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
$posY -= $shootManiaOffset;
}
$itemSize = $width;