actions menu improvements and fixes
This commit is contained in:
		@@ -55,8 +55,6 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
		// Register for callbacks
 | 
							// Register for callbacks
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_ONINIT, $this, 'handleOnInit');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_ONINIT, $this, 'handleOnInit');
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerJoined');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerJoined');
 | 
				
			||||||
		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMIN_MENU, $this, 'openAdminMenu');
 | 
					 | 
				
			||||||
		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYER_MENU, $this, 'openPlayerMenu');
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -66,14 +64,13 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
	 * @param bool $playerAction
 | 
						 * @param bool $playerAction
 | 
				
			||||||
	 * @param int $order
 | 
						 * @param int $order
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function addMenuItem(Control $control, $playerAction = true, $order = 0, $description = '') {
 | 
						public function addMenuItem(Control $control, $playerAction = true, $order = 0, $description = null) {
 | 
				
			||||||
		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();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -82,12 +79,12 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
	 * @param Control $control
 | 
						 * @param Control $control
 | 
				
			||||||
	 * @param int $order
 | 
						 * @param int $order
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function addPlayerMenuItem(Control $control, $order = 0, $description = '') {
 | 
						public function addPlayerMenuItem(Control $control, $order = 0, $description = null) {
 | 
				
			||||||
		if (!isset($this->playerMenuItems[$order])) {
 | 
							if (!isset($this->playerMenuItems[$order])) {
 | 
				
			||||||
			$this->playerMenuItems[$order] = array();
 | 
								$this->playerMenuItems[$order] = array();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		array_push($this->playerMenuItems[$order], $control, $description);
 | 
							array_push($this->playerMenuItems[$order], array($control, $description));
 | 
				
			||||||
		//TODO handle description
 | 
							$this->rebuildAndShowMenu();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -96,12 +93,12 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
	 * @param Control $control
 | 
						 * @param Control $control
 | 
				
			||||||
	 * @param int $order
 | 
						 * @param int $order
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function addAdminMenuItem(Control $control, $order = 0, $description = '') {
 | 
						public function addAdminMenuItem(Control $control, $order = 0, $description = null) {
 | 
				
			||||||
		if (!isset($this->adminMenuItems[$order])) {
 | 
							if (!isset($this->adminMenuItems[$order])) {
 | 
				
			||||||
			$this->adminMenuItems[$order] = array();
 | 
								$this->adminMenuItems[$order] = array();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		array_push($this->adminMenuItems[$order], $control, $description);
 | 
							array_push($this->adminMenuItems[$order], array($control, $description));
 | 
				
			||||||
		//TODO handle description
 | 
							$this->rebuildAndShowMenu();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -109,14 +106,14 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param array $callback
 | 
						 * @param array $callback
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function handleOnInit(array $callback) { //TODO render only once, but howtodo admin check then?
 | 
						public function handleOnInit(array $callback) {
 | 
				
			||||||
		//$manialinkText = $this->buildMenuIconsManialink()->render()->saveXML();
 | 
							// TODO: Render only once
 | 
				
			||||||
		$players = $this->maniaControl->playerManager->getPlayers();
 | 
							$players = $this->maniaControl->playerManager->getPlayers();
 | 
				
			||||||
		foreach ($players as $player) {
 | 
							foreach ($players as $player) {
 | 
				
			||||||
			$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
 | 
								$manialink = $this->buildMenuIconsManialink($player);
 | 
				
			||||||
 | 
								$manialinkText = $manialink->render()->saveXML();
 | 
				
			||||||
			$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
 | 
								$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					 | 
				
			||||||
		$this->initCompleted = true;
 | 
							$this->initCompleted = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -124,14 +121,13 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
	 * Build and show the menus to everyone (if a menu get made after the init)
 | 
						 * Build and show the menus to everyone (if a menu get made after the init)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function rebuildAndShowMenu() {
 | 
						public function rebuildAndShowMenu() {
 | 
				
			||||||
		if($this->initCompleted) {
 | 
							if (!$this->initCompleted) return;
 | 
				
			||||||
		$players = $this->maniaControl->playerManager->getPlayers();
 | 
							$players = $this->maniaControl->playerManager->getPlayers();
 | 
				
			||||||
		foreach ($players as $player) {
 | 
							foreach ($players as $player) {
 | 
				
			||||||
			$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);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Handle PlayerJoined callback
 | 
						 * Handle PlayerJoined callback
 | 
				
			||||||
@@ -144,29 +140,14 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
		$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
 | 
							$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Handle OpenAdminMenu Action
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * @param array $callback
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	public function openAdminMenu(array $callback, Player $player) {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Handle OpenPlayerMenu Action
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * @param array $callback
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	public function openPlayerMenu(array $callback, Player $player) {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Builds the Manialink
 | 
						 * Builds the Manialink
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param Player $player
 | 
						 * @param Player $player
 | 
				
			||||||
	 * @return ManiaLink
 | 
						 * @return ManiaLink
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function buildMenuIconsManialink(Player $player) { //TODO Description Labels, close tooltip on click
 | 
						private function buildMenuIconsManialink(Player $player) {
 | 
				
			||||||
 | 
							// TODO: close popoutframe on click
 | 
				
			||||||
		$posX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSX);
 | 
							$posX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSX);
 | 
				
			||||||
		$posY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSY);
 | 
							$posY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSY);
 | 
				
			||||||
		$itemSize = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_ITEMSIZE);
 | 
							$itemSize = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_ITEMSIZE);
 | 
				
			||||||
@@ -176,46 +157,40 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
		$itemMarginFactorY = 1.2;
 | 
							$itemMarginFactorY = 1.2;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$manialink = new ManiaLink(self::MLID_MENU);
 | 
							$manialink = new ManiaLink(self::MLID_MENU);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Admin Menu Icon Frame
 | 
					 | 
				
			||||||
		$frame = new Frame();
 | 
					 | 
				
			||||||
		$manialink->add($frame);
 | 
					 | 
				
			||||||
		$frame->setPosition($posX, $posY);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$backgroundQuad = new Quad();
 | 
					 | 
				
			||||||
		$frame->add($backgroundQuad);
 | 
					 | 
				
			||||||
		$backgroundQuad->setSize($itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
					 | 
				
			||||||
		$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$iconFrame = new Frame();
 | 
					 | 
				
			||||||
		$frame->add($iconFrame);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Create script and features
 | 
					 | 
				
			||||||
		$script = new Script();
 | 
							$script = new Script();
 | 
				
			||||||
		$manialink->setScript($script);
 | 
							$manialink->setScript($script);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$iconFrame->setSize($itemSize, $itemSize);
 | 
							/*
 | 
				
			||||||
 | 
							 * Admin Menu
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
 | 
				
			||||||
 | 
								// Admin Menu Icon Frame
 | 
				
			||||||
 | 
								$iconFrame = new Frame();
 | 
				
			||||||
 | 
								$manialink->add($iconFrame);
 | 
				
			||||||
 | 
								$iconFrame->setPosition($posX, $posY);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								$backgroundQuad = new Quad();
 | 
				
			||||||
 | 
								$iconFrame->add($backgroundQuad);
 | 
				
			||||||
 | 
								$backgroundQuad->setSize($itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
				
			||||||
 | 
								$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			$itemQuad = new Quad_Icons64x64_1();
 | 
								$itemQuad = new Quad_Icons64x64_1();
 | 
				
			||||||
 | 
								$iconFrame->add($itemQuad);
 | 
				
			||||||
			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconServers);
 | 
								$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconServers);
 | 
				
			||||||
			$itemQuad->setSize($itemSize, $itemSize);
 | 
								$itemQuad->setSize($itemSize, $itemSize);
 | 
				
			||||||
		$iconFrame->add($itemQuad);
 | 
					 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		//Description Label
 | 
								// Admin Menu Description Label
 | 
				
			||||||
			$descriptionFrame = new Frame();
 | 
								$descriptionFrame = new Frame();
 | 
				
			||||||
			$manialink->add($descriptionFrame);
 | 
								$manialink->add($descriptionFrame);
 | 
				
			||||||
			$descriptionFrame->setPosition($posX - count($this->adminMenuItems) * $itemSize * 1.15 - 6, $posY);
 | 
								$descriptionFrame->setPosition($posX - count($this->adminMenuItems) * $itemSize * 1.15 - 6, $posY);
 | 
				
			||||||
		$descriptionFrame->setAlign(Control::RIGHT, Control::CENTER2);
 | 
					 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			$descriptionLabel = new Label();
 | 
								$descriptionLabel = new Label();
 | 
				
			||||||
			$descriptionFrame->add($descriptionLabel);
 | 
								$descriptionFrame->add($descriptionLabel);
 | 
				
			||||||
			$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
 | 
								$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
 | 
				
			||||||
			$descriptionLabel->setSize(40, 4);
 | 
								$descriptionLabel->setSize(40, 4);
 | 
				
			||||||
			$descriptionLabel->setTextSize(1.4);
 | 
								$descriptionLabel->setTextSize(1.4);
 | 
				
			||||||
		$descriptionLabel->setVisible(true);
 | 
								$descriptionLabel->setTextColor('fff');
 | 
				
			||||||
		$descriptionLabel->setTextColor("FFF");
 | 
					 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
 | 
					 | 
				
			||||||
			// Admin Menu
 | 
								// Admin Menu
 | 
				
			||||||
			$popoutFrame = new Frame();
 | 
								$popoutFrame = new Frame();
 | 
				
			||||||
			$manialink->add($popoutFrame);
 | 
								$manialink->add($popoutFrame);
 | 
				
			||||||
@@ -223,62 +198,66 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
			$popoutFrame->setHAlign(Control::RIGHT);
 | 
								$popoutFrame->setHAlign(Control::RIGHT);
 | 
				
			||||||
			$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
								$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			$quad = new Quad();
 | 
								$backgroundQuad = new Quad();
 | 
				
			||||||
			$popoutFrame->add($quad);
 | 
								$popoutFrame->add($backgroundQuad);
 | 
				
			||||||
			$quad->setHAlign(Control::RIGHT);
 | 
								$backgroundQuad->setHAlign(Control::RIGHT);
 | 
				
			||||||
			$quad->setStyles($quadStyle, $quadSubstyle);
 | 
								$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
 | 
				
			||||||
			$quad->setSize(count($this->adminMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
 | 
								$backgroundQuad->setSize(count($this->adminMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
 | 
				
			||||||
 | 
					 | 
				
			||||||
			$popoutFrame->add($quad);
 | 
					 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
 | 
								$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			// Add items
 | 
								// Add items
 | 
				
			||||||
			$x = -1;
 | 
								$x = -1;
 | 
				
			||||||
			foreach(array_reverse($this->adminMenuItems) as $menuItems) {
 | 
								foreach ($this->adminMenuItems as $menuItems) {
 | 
				
			||||||
				$menuItem = $menuItems[0];
 | 
									foreach ($menuItems as $menuItem) {
 | 
				
			||||||
				/** @var Quad $menuItem */
 | 
										$menuQuad = $menuItem[0];
 | 
				
			||||||
				$menuItem->setSize($itemSize, $itemSize);
 | 
										/**
 | 
				
			||||||
				$popoutFrame->add($menuItem);
 | 
										 *
 | 
				
			||||||
				$menuItem->setX($x);
 | 
										 * @var Quad $menuQuad
 | 
				
			||||||
				$menuItem->setHAlign(Control::RIGHT);
 | 
										 */
 | 
				
			||||||
 | 
										$popoutFrame->add($menuQuad);
 | 
				
			||||||
 | 
										$menuQuad->setSize($itemSize, $itemSize);
 | 
				
			||||||
 | 
										$menuQuad->setX($x);
 | 
				
			||||||
 | 
										$menuQuad->setHAlign(Control::RIGHT);
 | 
				
			||||||
					$x -= $itemSize * 1.05;
 | 
										$x -= $itemSize * 1.05;
 | 
				
			||||||
					
 | 
										
 | 
				
			||||||
				$script->addTooltip($menuItem, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$s' . $menuItems[1]));
 | 
										if ($menuItem[1]) {
 | 
				
			||||||
 | 
											$description = '$s' . $menuItem[1];
 | 
				
			||||||
 | 
											$script->addTooltip($menuQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $description));
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Player Menu Descrition Frame / LabelLabel
 | 
							/*
 | 
				
			||||||
		$descriptionFrame = new Frame(); //TODO not working yet
 | 
							 * Player Menu
 | 
				
			||||||
		$manialink->add($descriptionFrame);
 | 
							 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
		$descriptionFrame->setPosition($posX - count($this->playerMenuItems) * $itemSize * 1.15 - 6, $posY - $itemSize * $itemMarginFactorY);
 | 
					 | 
				
			||||||
		$descriptionFrame->setAlign(Control::RIGHT, Control::CENTER2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$descriptionLabel = clone $descriptionLabel;
 | 
					 | 
				
			||||||
		$descriptionFrame->add($descriptionLabel);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Player Menu Icon Frame
 | 
							// Player Menu Icon Frame
 | 
				
			||||||
		$frame = new Frame();
 | 
							$iconFrame = new Frame();
 | 
				
			||||||
		$manialink->add($frame);
 | 
							$manialink->add($iconFrame);
 | 
				
			||||||
		$frame->setPosition($posX, $posY - $itemSize * $itemMarginFactorY);
 | 
							$iconFrame->setPosition($posX, $posY - $itemSize * $itemMarginFactorY);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$backgroundQuad = new Quad();
 | 
							$backgroundQuad = new Quad();
 | 
				
			||||||
		$frame->add($backgroundQuad);
 | 
							$iconFrame->add($backgroundQuad);
 | 
				
			||||||
		$backgroundQuad->setSize($itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
							$backgroundQuad->setSize($itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
				
			||||||
		$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
 | 
							$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$iconFrame = new Frame();
 | 
					 | 
				
			||||||
		$frame->add($iconFrame);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$iconFrame->setSize($itemSize, $itemSize);
 | 
					 | 
				
			||||||
		$itemQuad = new Quad_Icons64x64_1();
 | 
							$itemQuad = new Quad_Icons64x64_1();
 | 
				
			||||||
 | 
							$iconFrame->add($itemQuad);
 | 
				
			||||||
		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconPlayers);
 | 
							$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconPlayers);
 | 
				
			||||||
		$itemQuad->setSize($itemSize, $itemSize);
 | 
							$itemQuad->setSize($itemSize, $itemSize);
 | 
				
			||||||
		$iconFrame->add($itemQuad);
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							// Player Menu Description Frame
 | 
				
			||||||
 | 
							$descriptionFrame = new Frame();
 | 
				
			||||||
 | 
							$manialink->add($descriptionFrame);
 | 
				
			||||||
 | 
							$descriptionFrame->setPosition($posX - count($this->playerMenuItems) * $itemSize * 1.15 - 6, $posY - $itemSize * $itemMarginFactorY);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							$descriptionLabel = new Label();
 | 
				
			||||||
 | 
							$descriptionFrame->add($descriptionLabel);
 | 
				
			||||||
 | 
							$descriptionLabel->setAlign(Control::RIGHT, Control::TOP);
 | 
				
			||||||
 | 
							$descriptionLabel->setSize(40, 4);
 | 
				
			||||||
 | 
							$descriptionLabel->setTextSize(1.4);
 | 
				
			||||||
 | 
							$descriptionLabel->setTextColor('fff');
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Player Menu
 | 
							// Player Menu
 | 
				
			||||||
		$popoutFrame = new Frame();
 | 
							$popoutFrame = new Frame();
 | 
				
			||||||
@@ -287,29 +266,34 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
 | 
				
			|||||||
		$popoutFrame->setHAlign(Control::RIGHT);
 | 
							$popoutFrame->setHAlign(Control::RIGHT);
 | 
				
			||||||
		$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
							$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$quad = new Quad();
 | 
							$backgroundQuad = new Quad();
 | 
				
			||||||
		$popoutFrame->add($quad);
 | 
							$popoutFrame->add($backgroundQuad);
 | 
				
			||||||
		$quad->setHAlign(Control::RIGHT);
 | 
							$backgroundQuad->setHAlign(Control::RIGHT);
 | 
				
			||||||
		$quad->setStyles($quadStyle, $quadSubstyle);
 | 
							$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
 | 
				
			||||||
		$quad->setSize(count($this->playerMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
 | 
							$backgroundQuad->setSize(count($this->playerMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$popoutFrame->add($quad);
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
 | 
							$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Add items
 | 
							// Add items
 | 
				
			||||||
		$x = -1;
 | 
							$x = -1;
 | 
				
			||||||
		foreach(array_reverse($this->playerMenuItems) as $menuItems) {
 | 
							foreach ($this->playerMenuItems as $menuItems) {
 | 
				
			||||||
			$menuItem = $menuItems[0];
 | 
								foreach ($menuItems as $menuItem) {
 | 
				
			||||||
			/** @var Quad $menuItem */
 | 
									$menuQuad = $menuItem[0];
 | 
				
			||||||
			$menuItem->setSize($itemSize, $itemSize);
 | 
									/**
 | 
				
			||||||
			$popoutFrame->add($menuItem);
 | 
									 *
 | 
				
			||||||
			$menuItem->setX($x);
 | 
									 * @var Quad $menuQuad
 | 
				
			||||||
			$menuItem->setHAlign(Control::RIGHT);
 | 
									 */
 | 
				
			||||||
 | 
									$popoutFrame->add($menuQuad);
 | 
				
			||||||
 | 
									$menuQuad->setSize($itemSize, $itemSize);
 | 
				
			||||||
 | 
									$menuQuad->setX($x);
 | 
				
			||||||
 | 
									$menuQuad->setHAlign(Control::RIGHT);
 | 
				
			||||||
				$x -= $itemSize * 1.05;
 | 
									$x -= $itemSize * 1.05;
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
			$script->addTooltip($menuItem, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$s' . $menuItems[1]));
 | 
									if ($menuItem[1]) {
 | 
				
			||||||
 | 
										$description = '$s' . $menuItem[1];
 | 
				
			||||||
 | 
										$script->addTooltip($menuQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $description));
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		return $manialink;
 | 
							return $manialink;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user