public void initMenu() { Rect OptionsButtonRect = new Rect(Screen.width - SizeMaster.IconButtonSize, 0, SizeMaster.IconButtonSize, SizeMaster.IconButtonSize); menuIcon = new DynamicButton(assets, new Rect(0, 0, Screen.width * .05f, Screen.width * .05f), "menu", DyanimcButtonStyle.standard, 1, bringUpMenu, assets.menuIconTexture, assets.redButtonTexture); PopupBackground = new DynamicTexture(assets, menuClosedPosition, assets.situationCardTexture); MenuTitleImage = new DynamicTexture(assets, new Rect(PopupBackground.getRect().x, PopupBackground.getRect().y, PopupBackground.getRect().width, PopupBackground.getRect().height * 0.7f), assets.menuTexture); OptionsTitleImage = new DynamicTexture(assets, new Rect(PopupBackground.getRect().x, PopupBackground.getRect().y, PopupBackground.getRect().width, PopupBackground.getRect().height * 0.3f), assets.optionsTexture); OptionsIconButton = new DynamicButton(assets, OptionsButtonRect, "", DyanimcButtonStyle.standard, 0, OpenOptionsPopup, assets.OptionsIcon, assets.OptionsIcon); Rect temp = menuClosedPosition; temp.y += Screen.height * .25f; temp.x += Screen.width * .05f; temp.height = Screen.height * .15f; temp.width = Screen.width * .35f; toMainMenu = new DynamicButton(assets, temp, "Main Menu", DyanimcButtonStyle.standard, smallTextSize, toMainMenuCallback, assets.playCardIdle, assets.redButtonTexture); temp.y = menuClosedPosition.y + Screen.height * .25f * 1.75f; ExitGame = new DynamicButton(assets, temp, "Exit Game", DyanimcButtonStyle.standard, smallTextSize, quiteGame, assets.playCardIdle, assets.redButtonTexture); temp.y = menuClosedPosition.y + Screen.height * .25f * 2.5f; closeMenu = new DynamicButton(assets, temp, "Close Menu", DyanimcButtonStyle.standard, smallTextSize, closeUpMenu, assets.playCardIdle, assets.redButtonTexture); MusicVolumeButton = new DynamicButton(assets, new Rect(menuClosedPosition.x, menuClosedPosition.y + Screen.height * .25f, menuClosedPosition.width * 0.65f, Screen.height * .15f), "Music", DyanimcButtonStyle.standard, smallTextSize, changeMusicVolume, assets.playCardIdle, assets.redButtonTexture); MusicVolumeIcon = new DynamicTexture(assets, new Rect(MusicVolumeButton.getRect().xMax, MusicVolumeButton.getRect().y, menuClosedPosition.width * 0.25f, Screen.height * .15f), assets.VolumeMax); EffectVolumeButton = new DynamicButton(assets, new Rect(menuClosedPosition.x, menuClosedPosition.y + Screen.height * .45f, menuClosedPosition.width * 0.65f, Screen.height * .15f), "Effects", DyanimcButtonStyle.standard, smallTextSize, changeEffectsVolume, assets.playCardIdle, assets.redButtonTexture); EffectVolumeIcon = new DynamicTexture(assets, new Rect(EffectVolumeButton.getRect().xMax, EffectVolumeButton.getRect().y, menuClosedPosition.width * 0.25f, Screen.height * .15f), assets.VolumeMax); CloseOptionsPopupButton = new DynamicButton(assets, new Rect(Screen.width / 2 - Screen.width * .35f / 2, menuClosedPosition.y + Screen.height * .65f, Screen.width * .35f, Screen.height * .15f), "Close", DyanimcButtonStyle.standard, smallTextSize, CloseOptionsPopup, assets.playCardIdle, assets.redButtonTexture); }
public void draw() { if (menuUp || isOptionsOpen) { GUI.enabled = false; } menuIcon.draw(); OptionsIconButton.draw(); GUI.depth = 1; drawButtons(); drawCustom(); PopupBackground.draw(); Rect temp = PopupBackground.getRect(); temp.y = temp.y * .8f; GUI.DrawTexture(temp, assets.menuTexture); GUI.enabled = true; toMainMenu.draw(); ExitGame.draw(); closeMenu.draw(); CloseOptionsPopupButton.draw(); }
public void OpenOptionsPopup() { isOptionsOpen = true; PopupBackground.setTargetPosition(new Vector2(menuOpenPosition.x, menuOpenPosition.y)); PopupBackground.setPositionToValue(15f); OptionsTitleImage.setTargetPosition(new Vector2(menuOpenPosition.x, menuOpenPosition.y)); OptionsTitleImage.setPositionToValue(15f); MusicVolumeButton.setTargetPosition(new Vector2(menuOpenPosition.x, menuOpenPosition.y + Screen.height * .25f)); MusicVolumeButton.setPositionToValue(15f); MusicVolumeIcon.setTargetPosition(new Vector2(MusicVolumeIcon.getRect().x, menuOpenPosition.y + Screen.height * .25f)); MusicVolumeIcon.setPositionToValue(15f); EffectVolumeButton.setTargetPosition(new Vector2(menuOpenPosition.x, menuOpenPosition.y + Screen.height * .25f * 1.75f)); EffectVolumeButton.setPositionToValue(15f); EffectVolumeIcon.setTargetPosition(new Vector2(EffectVolumeIcon.getRect().x, menuOpenPosition.y + Screen.height * .25f * 1.75f)); EffectVolumeIcon.setPositionToValue(15f); CloseOptionsPopupButton.setTargetPosition(new Vector2(menuOpenPosition.x + Screen.width * .05f, menuOpenPosition.y + Screen.height * .25f * 2.5f)); CloseOptionsPopupButton.setPositionToValue(15f); }