Пример #1
0
        /// <summary>Perform the action associated with a component.</summary>
        /// <param name="cpt">The component.</param>
        /// <return>whether the component action is processed</return>
        public override bool handleLeftClick(IAutoComponent cpt)
        {
            switch (cpt.m_name)
            {
            case "Save":
                if (m_currentFav > -1)
                {
                    m_farmerMakeup.SaveFavorite(m_currentFav + 1);
                    m_extraFavButtons[m_currentFav - 6].sourceRect.Y = 26;
                    m_alerts.Add(new Alert(Game1.mouseCursors, new Rectangle(310, 392, 16, 16), Game1.viewport.Width / 2 - (700 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (500 + IClickableMenu.borderWidth * 2) / 2, "Favorite Saved To Slot " + (m_currentFav + 1) + " .", 1200, false));
                    Game1.playSound("purchase");
                }
                return(true);

            case "Load":
                if (m_currentFav > -1)
                {
                    if (m_farmerMakeup.LoadFavorite(m_currentFav + 1))
                    {
                        Game1.playSound("yoba");
                    }
                    else
                    {
                        m_alerts.Add(new Alert(Game1.mouseCursors, new Rectangle(268, 470, 16, 16), Game1.viewport.Width / 2 - (700 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (500 + IClickableMenu.borderWidth * 2) / 2, "Uh oh! No Favorite is Set!", 1000, false));
                    }
                }
                return(true);

            case "Fav":
                ClickableTextureButton btn = (ClickableTextureButton)cpt;
                int i = btn.m_par;
                if (m_currentFav == -1)
                {
                    m_selectFavLabel.visible = false;
                    m_saveLabel.visible      = true;
                    m_loadLabel.visible      = true;
                    m_saveFavButton.visible  = true;
                    m_loadFavButton.visible  = true;
                }
                else
                {
                    m_extraFavButtons[m_currentFav - 6].drawShadow = false;
                }
                m_extraFavButtons[i].drawShadow = true;
                m_currentFav      = i + 6;
                m_saveLabel.label = "Currently selected: " + (m_currentFav + 1) + ".";
                return(true);

            default:
                return(false);
            }
        }
        /// <summary>Perform the action associated with a component.</summary>
        /// <param name="cpt">The component.</param>
        /// <return>whether the component action is processed</return>
        public override bool handleLeftClick(IAutoComponent cpt)
        {
            AutoColorPicker        p   = null;
            ClickableTextureButton btn = null;

            if (cpt is ClickableTextureButton)
            {
                btn = (ClickableTextureButton)cpt;
            }
            else if (cpt is AutoColorPicker)
            {
                p = (AutoColorPicker)cpt;
            }
            switch (cpt.m_name)
            {
            case "Male":
                m_farmerMakeup.ChangeGender(true);
                m_farmerMakeup.ChangeHairStyle(0);
                m_maleOutlineButton.m_visible   = true;
                m_femaleOutlineButton.m_visible = false;
                refreshLabelAttrs();
                break;

            case "Female":
                m_farmerMakeup.ChangeGender(false);
                m_farmerMakeup.ChangeHairStyle(16);
                m_maleOutlineButton.m_visible   = false;
                m_femaleOutlineButton.m_visible = true;
                refreshLabelAttrs();
                break;

            case "Direction":
                Game1.player.faceDirection((Game1.player.facingDirection - btn.m_par + 4) % 4);
                Game1.player.FarmerSprite.StopAnimation();
                Game1.player.completelyStopAnimatingOrDoingAction();
                Game1.playSound("pickUpItem");
                btn.scale = Math.Max(0.75f, btn.scale - 0.25f);
                return(true);

            case "OK":
                if (m_parent != null)
                {
                    m_parent.exitThisMenuNoSound();
                }
                else
                {
                    exitThisMenuNoSound();
                }
                break;

            case "Random":
                this.randomiseCharacter();
                btn.scale = Game1.pixelZoom - 0.5f;
                this.m_eyeColorPicker.setColor(Game1.player.newEyeColor);
                this.m_hairColorPicker.setColor(Game1.player.hairstyleColor);
                this.m_pantsColorPicker.setColor(Game1.player.pantsColor);
                refreshLabelAttrs();
                return(true);

            case "MultiplayerFix":
                m_farmerMakeup.TougleMultiplayerFix();
                btn.sourceRect.X = btn.sourceRect.X == 227 ? 236 : 227;
                Game1.playSound("drumkit6");
                return(true);

            case "EyeColorPicker":
                m_farmerMakeup.ChangeEyeColor(p.click(Game1.getOldMouseX(), Game1.getOldMouseY()));
                m_lastHeldColorPicker = p;
                return(true);

            case "HairColorPicker":
                m_farmerMakeup.ChangeHairColor(p.click(Game1.getOldMouseX(), Game1.getOldMouseY()));
                m_lastHeldColorPicker = p;
                return(true);

            case "PantsColorPicker":
                m_farmerMakeup.ChangeBottomsColor(p.click(Game1.getOldMouseX(), Game1.getOldMouseY()));
                m_lastHeldColorPicker = p;
                return(true);

            case "Fav":
                int i = btn.m_par;
                if (m_farmerMakeup.LoadFavorite(i + 1))
                {
                    Game1.playSound("yoba");
                    this.m_eyeColorPicker.setColor(Game1.player.newEyeColor);
                    this.m_hairColorPicker.setColor(Game1.player.hairstyleColor);
                    this.m_pantsColorPicker.setColor(Game1.player.pantsColor);
                    refreshLabelAttrs();
                }
                else
                {
                    m_alerts.Add(new Alert(Game1.mouseCursors, new Rectangle(268, 470, 16, 16), Game1.viewport.Width / 2 - (700 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (500 + IClickableMenu.borderWidth * 2) / 2, "Uh oh! No Favorite is Set!", 1000, false));
                    if (m_parent is MenuFarmerMakeup mk)
                    {
                        mk.ShowFavTabArrow = true;
                    }
                }
                return(true);

            default:
                if (btn != null)
                {
                    btn.scale = Math.Max(0.75f, btn.scale - 2.5f);
                    return(this.handleSelectorChange(btn.name, btn.m_par));
                }
                return(false);
            }
            Game1.playSound("coin");
            return(true);
        }