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:
		@@ -34,12 +34,13 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
 | 
			
		||||
	/*
 | 
			
		||||
	 * Constants
 | 
			
		||||
	 */
 | 
			
		||||
	const MLID_MENU               = 'ActionsMenu.MLID';
 | 
			
		||||
	const SETTING_MENU_POSX       = 'Menu Position: X';
 | 
			
		||||
	const SETTING_MENU_POSY       = 'Menu Position: Y';
 | 
			
		||||
	const SETTING_MENU_ITEMSIZE   = 'Menu Item Size';
 | 
			
		||||
	const ACTION_OPEN_ADMIN_MENU  = 'ActionsMenu.OpenAdminMenu';
 | 
			
		||||
	const ACTION_OPEN_PLAYER_MENU = 'ActionsMenu.OpenPlayerMenu';
 | 
			
		||||
	const MLID_MENU                    = 'ActionsMenu.MLID';
 | 
			
		||||
	const SETTING_MENU_POSX            = 'Menu Position: X';
 | 
			
		||||
	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';
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Private properties
 | 
			
		||||
@@ -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,21 +131,16 @@ 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();
 | 
			
		||||
		$frame     = new Frame();
 | 
			
		||||
		$maniaLink->addChild($frame);
 | 
			
		||||
		$frame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
 | 
			
		||||
 | 
			
		||||
@@ -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;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
 
 | 
			
		||||
@@ -151,13 +151,13 @@ 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
 | 
			
		||||
					$suggestedQuad = new Quad_Icons64x64_1();
 | 
			
		||||
					$pluginFrame->addChild($suggestedQuad);
 | 
			
		||||
					$suggestedQuad->setPosition($width * 0.45, $entryHeight * 0.12, 2)->setSize(4, 4)->setSubStyle($suggestedQuad::SUBSTYLE_StateSuggested);
 | 
			
		||||
					if ($plugin->currentVersion->verified > 0) {
 | 
			
		||||
						// Suggested quad
 | 
			
		||||
						$suggestedQuad = new Quad_Icons64x64_1();
 | 
			
		||||
						$pluginFrame->addChild($suggestedQuad);
 | 
			
		||||
						$suggestedQuad->setPosition($width * 0.45, $entryHeight * 0.12, 2)->setSize(4, 4)->setSubStyle($suggestedQuad::SUBSTYLE_StateSuggested);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				$posY -= $entryHeight;
 | 
			
		||||
 
 | 
			
		||||
@@ -154,11 +154,11 @@ 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;
 | 
			
		||||
		$posY = $actionsPosY - 2 * ($iconSize * $itemMarginFactorY);
 | 
			
		||||
		$posY              = $actionsPosY - 2 * ($iconSize * $itemMarginFactorY);
 | 
			
		||||
 | 
			
		||||
		// Settings
 | 
			
		||||
		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSX, $actionsPosX);
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user