/// <summary> /// Glam Menu On Click. /// </summary> /// <param name="x">X position of the mouse</param> /// <param name="y">Y position of the mouse</param> private void OnClickGlamMenuTab(int x, int y) { if (GlamMenuTab.containsPoint(x, y)) { // If there wasn't a favorite applied then restore the player if (!WasFavoriteApplied) { Menu.RestoreSnapshot(); } // Set the menu back to the glam menu Game1.activeClickableMenu = Menu; } }
/// <summary>Override to handle recieving a left click on a specific element</summary> /// <param name="x">The x position of the click</param> /// <param name="y">The y position of the click</param> /// <param name="playSound">Whether to play sound when clicked</param> public override void receiveLeftClick(int x, int y, bool playSound = true) { //Loop through to see if the star buttons were clicked for (int i = 0; i < StarComponents.Count; i++) { if (StarComponents[i].containsPoint(x, y)) { //Set the buttons to visible SetButton.visible = true; DeleteButton.visible = true; //Set the index and load the favorite to the player CurrentIndex = i; PlayerLoader.LoadFavorite(CurrentIndex, Menu, false); if (StarComponents[i].scale != 0f) { StarComponents[i].scale -= 0.25f; StarComponents[i].scale = Math.Max(0.75f, StarComponents[i].scale); } Game1.playSound("coin"); } } //Check if the glam menu tab was clicked if (GlamMenuTab.containsPoint(x, y)) { //If there wasn't a favorite applied then restore the player if (!WasFavoriteApplied) { Menu.RestoreSnapshot(); } //Set the menu back to the glam menu Game1.activeClickableMenu = Menu; } //Check if the set button was clicked if (SetButton.containsPoint(x, y)) { //A favorite was applied and change the player WasFavoriteApplied = true; PlayerLoader.LoadFavorite(CurrentIndex, Menu, true); if (SetButton.scale != 0f) { SetButton.scale -= 0.25f; SetButton.scale = Math.Max(0.75f, SetButton.scale); } Game1.playSound("coin"); } //Check if the delete button was clicked if (DeleteButton.containsPoint(x, y)) { //Set the slot to a default model and update the star buttons PlayerLoader.Favorites[CurrentIndex] = new FavoriteModel(); UpdateStarButtons(); if (DeleteButton.scale != 0f) { DeleteButton.scale -= 0.25f; DeleteButton.scale = Math.Max(0.75f, DeleteButton.scale); } Game1.playSound("coin"); } //Check if the left direction button was clicked and change player direction if (LeftDirectionButton.containsPoint(x, y)) { Game1.player.faceDirection((Game1.player.facingDirection + 5) % 4); Game1.player.FarmerSprite.StopAnimation(); Game1.player.completelyStopAnimatingOrDoingAction(); if (LeftDirectionButton.scale != 0f) { LeftDirectionButton.scale -= 0.25f; LeftDirectionButton.scale = Math.Max(0.75f, LeftDirectionButton.scale); } Game1.playSound("pickUpItem"); } //Check if the right direction button was clicked and change player direction if (RightDirectionButton.containsPoint(x, y)) { Game1.player.faceDirection((Game1.player.facingDirection - 1 + 4) % 4); Game1.player.FarmerSprite.StopAnimation(); Game1.player.completelyStopAnimatingOrDoingAction(); if (RightDirectionButton.scale != 0f) { RightDirectionButton.scale -= 0.25f; RightDirectionButton.scale = Math.Max(0.75f, LeftDirectionButton.scale); } Game1.playSound("pickUpItem"); } }