Beispiel #1
0
        /*********
        ** Public methods
        *********/
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            // read config
            Config = helper.ReadConfig <TimeSpeedConfig>();

            // add time events
            this.TimeHelper.WhenTickProgressChanged(this.ReceiveTickProgress);
            ControlEvents.KeyPressed += this.ReceiveKeyPressed;
            LocationEvents.CurrentLocationChanged += this.ReceiveCurrentLocationChanged;
            TimeEvents.TimeOfDayChanged           += this.ReceiveTimeOfDayChanged;
            TimeEvents.DayOfMonthChanged          += this.ReceiveDayChanged;

            // add time freeze/unfreeze notification
            {
                bool wasPaused = false;
                GraphicsEvents.OnPreRenderHudEvent += (sender, args) =>
                {
                    wasPaused = Game1.paused;
                    if (this.Frozen)
                    {
                        Game1.paused = true;
                    }
                };

                GraphicsEvents.OnPostRenderHudEvent += (sender, args) =>
                {
                    Game1.paused = wasPaused;
                };
            }
        }
Beispiel #2
0
 /****
 ** Methods
 ****/
 /// <summary>Reload <see cref="Config"/> from the config file.</summary>
 private void ReloadConfig()
 {
     this.Config = this.Helper.ReadConfig <TimeSpeedConfig>();
     this.UpdateScaleForDay(Game1.currentSeason, Game1.dayOfMonth);
     this.UpdateSettingsForLocation(Game1.currentLocation);
     this.Notifier.ShortNotify("Time feels differently now...");
 }