예제 #1
0
 private void GameLoop_UnvalidatedUpdateTicked(object sender, UnvalidatedUpdateTickedEventArgs e)
 {
     if (Game1.activeClickableMenu is ShippingMenu)
     {
         RespondToQueuedRequests(UpdateTickedRequestQueue, "UnvalidatedUpdateTicked");
     }
 }
예제 #2
0
        /// <summary>Raised after the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnUnvalidatedUpdateTick(object sender, UnvalidatedUpdateTickedEventArgs e)
        {
            // wait until game loaded
            if (!this.IsSaveLoaded)
            {
                return;
            }
            this.Helper.Events.Specialised.UnvalidatedUpdateTicked -= this.OnUnvalidatedUpdateTick;

            // apply patcher
            this.Patcher.ApplyPatches(out Compound compoundData);
            ModEntry.PatchData = compoundData;

            // start handling dynamic stuff
            if (compoundData.DynamicTiles.Any() || compoundData.DynamicProperties.Any() || compoundData.DynamicWarps.Any() || compoundData.SeasonalTilesheets.Any())
            {
                this.Monitor.Log("Dynamic content detected, preparing dynamic update logic...", LogLevel.Info);
                this.Helper.Events.GameLoop.DayStarted += ModEntry.OnDayStarted;
            }
        }
예제 #3
0
 /// <summary>Raised after the game state is updated (≈60 times per second), regardless of normal SMAPI validation.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void OnUnvalidatedUpdateTicked(object sender, UnvalidatedUpdateTickedEventArgs e)
 {
     this.Apply(this.UnvalidatedTickHandlers);
 }