示例#1
0
        public static void SendBirthdayMessageToOtherPlayers()
        {
            string str = BirthdayMessages.GetTranslatedString("Happy Birthday: Farmhand Birthday Message");

            str.Replace("@", Game1.player.name);
            HUDMessage message = new HUDMessage(str, 1);

            foreach (KeyValuePair <long, Farmer> f in Game1.otherFarmers)
            {
                HappyBirthday.ModHelper.Multiplayer.SendMessage <string>(message.message, FSTRING_SendBirthdayMessageToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key });
            }
        }
示例#2
0
        /// <summary>The method invoked when the player left-clicks on the menu.</summary>
        /// <param name="x">The X-position of the cursor.</param>
        /// <param name="y">The Y-position of the cursor.</param>
        /// <param name="playSound">Whether to enable sound.</param>
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            //If the season is not selected then the day buttons can't be clicked. Thanks to @Potato#5266 on the SDV discord for this tip.
            if (string.IsNullOrEmpty(this.seasonName) == false)
            {
                foreach (ClickableTextureComponent button in this.DayButtons)
                {
                    if (button.containsPoint(x, y))
                    {
                        this.handleButtonClick(button.name);
                        button.scale -= 0.5f;
                        button.scale  = Math.Max(3.5f, button.scale);
                    }
                }
            }

            foreach (ClickableTextureComponent button in this.SeasonButtons)
            {
                if (button.containsPoint(x, y))
                {
                    this.handleButtonClick(button.name);
                    button.scale -= 0.5f;
                    button.scale  = Math.Max(3.5f, button.scale);
                }
            }

            if (this.OkButton.containsPoint(x, y))
            {
                if (this.isFestivalDay())
                {
                    if (string.IsNullOrEmpty(BirthdayMessages.GetTranslatedString("BirthdayError_FestivalDay")) == false)
                    {
                        Game1.addHUDMessage(new HUDMessage(BirthdayMessages.GetTranslatedString("BirthdayError_FestivalDay")));
                    }
                    else
                    {
                        Game1.addHUDMessage(new HUDMessage("You can't have a birthday on this day. Sorry!"));
                    }
                    return;
                }
                if (this.seasonName == "" || this.BirthdayDay == 0)
                {
                    return;
                }
                this.handleButtonClick(this.OkButton.name);
                this.OkButton.scale -= 0.25f;
                this.OkButton.scale  = Math.Max(0.75f, this.OkButton.scale);
            }
        }