コード例 #1
0
        /// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            if (OurMoon.GetMoonRiseTime() <= 0600 || OurMoon.GetMoonRiseTime() >= 2600 && ModConfig.ShowMoonPhase)
            {
                Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("moon-text.moonriseBefore6", new { moonPhase = OurMoon.DescribeMoonPhase(), riseTime = OurMoon.GetMoonRiseDisplayTime() })));
            }

            if (OurMoon == null)
            {
                Monitor.Log("OurMoon is null");
                return;
            }

            if (Dice.NextDouble() < ModConfig.EclipseChance && ModConfig.EclipseOn && OurMoon.CurrentPhase == MoonPhase.FullMoon &&
                SDate.Now().DaysSinceStart > 2)
            {
                IsEclipse = true;
                var n = new HUDMessage(Helper.Translation.Get("moon-text.solareclipse"))
                {
                    color    = Color.SeaGreen,
                    fadeIn   = true,
                    timeLeft = 4000,
                    noIcon   = true
                };
                Game1.addHUDMessage(n);

                Monitor.Log("There's a solar eclipse today!", LogLevel.Info);
            }

            OurMoon.OnNewDay();
            OurMoon.HandleMoonAfterWake();
        }
コード例 #2
0
ファイル: LunarDisturbances.cs プロジェクト: Sakorona/SDVMods
        /// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            Helper.Content.InvalidateCache("LooseSprites/Cursors");
            if (OurMoon.GetMoonRiseTime() <= 0600 || OurMoon.GetMoonRiseTime() >= 2600 && ModConfig.ShowMoonPhase)
            {
                Game1.addHUDMessage(new TCHUDMessage(
                                        Helper.Translation.Get("moon-text.moonriseBefore6",
                                                               new { moonPhase = OurMoon.DescribeMoonPhase(), riseTime = OurMoon.GetMoonRiseDisplayTime() }),
                                        OurMoon.CurrentPhase()));
            }

            if (OurMoon == null)
            {
                Monitor.Log("OurMoon is null");
                return;
            }

            if (queuedMsg != null)
            {
                Game1.addHUDMessage(queuedMsg);
                queuedMsg = null;
            }

            if (Context.IsMainPlayer)
            {
                if (OurMoon.MoonTracker.CurrentSeason != Game1.currentSeason)
                {
                    OurMoon.MoonTracker.CurrentSeason      = Game1.currentSeason;
                    OurMoon.MoonTracker.FullMoonThisSeason = false;
                }
            }

            if (ModConfig.EclipseOn && OurMoon.MoonTracker.IsEclipseTomorrow)
            {
                OurMoon.IsEclipse = true;
                var n = new HUDMessage(Helper.Translation.Get("moon-text.solareclipse"))
                {
                    color    = Color.SeaGreen,
                    fadeIn   = true,
                    timeLeft = 4000,
                    noIcon   = true
                };
                Game1.addHUDMessage(n);
                MoonMessage message = GenerateLunarSync();
                MPHandler.SendMessage <MoonMessage>(message, "MoonMessage", new[] { "KoihimeNakamura.LunarDisturbances" });
                Monitor.Log("There's a solar eclipse today!", LogLevel.Info);
                OurMoon.MoonTracker.IsEclipseTomorrow = false;
            }


            OurMoon.UpdateForBloodMoon();
            OurMoon.OnNewDay();
            OurMoon.HandleMoonAfterWake();
        }