Beispiel #1
0
        /// <summary>Handle a button click.</summary>
        /// <param name="name">The button name that was clicked.</param>
        private void handleButtonClick(string name)
        {
            if (name == null)
            {
                return;
            }

            switch (name)
            {
            // OK button
            case "OK":
                HappyBirthday.Instance.PlayerData.favoriteBirthdayGift = this.selectedGift;
                MultiplayerSupport.SendBirthdayInfoToOtherPlayers();
                this.allFinished = true;
                Game1.exitActiveMenu();
                break;

            case "LeftButton":
                if (this.currentPageNumber == 0)
                {
                    break;
                }
                else
                {
                    this.currentPageNumber--;
                    this.setUpPositions();
                }
                break;

            case "RightButton":
                List <Item> ids   = Gifts.GiftIDS.RegisteredGifts.Values.ToList();
                int         value = ((this.currentPageNumber + 1) * this._maxRowsToDisplay * this._maxColumnsToDisplay);
                if (value >= ids.Count)
                {
                    break;
                }
                else
                {
                    this.currentPageNumber++;
                    this.setUpPositions();
                }

                break;

            default:
                break;
            }
            Game1.playSound("coin");
        }
        /// <summary>Handle a button click.</summary>
        /// <param name="name">The button name that was clicked.</param>
        private void HandleButtonClick(string name)
        {
            if (name == null)
            {
                return;
            }

            switch (name)
            {
            // season button
            case "Spring":
            case "Summer":
            case "Fall":
            case "Winter":
                this.BirthdaySeason = name.ToLower();
                this.OnChanged(this.BirthdaySeason, this.BirthdayDay);
                Game1.activeClickableMenu = new BirthdayMenu(this.BirthdaySeason, this.BirthdayDay, this.OnChanged);
                break;

            // OK button
            case "OK":
                if (this.BirthdayDay >= 1 || this.BirthdayDay <= 28)
                {
                    MultiplayerSupport.SendBirthdayInfoToOtherPlayers();     //Send updated info to others.
                }
                Game1.exitActiveMenu();
                break;

            default:
                this.BirthdayDay = Convert.ToInt32(name);
                this.OnChanged(this.BirthdaySeason, this.BirthdayDay);
                Game1.activeClickableMenu = new BirthdayMenu(this.BirthdaySeason, this.BirthdayDay, this.OnChanged);
                break;
            }
            Game1.playSound("coin");
        }