#if !SMAPI_3_0_STRICT using System; using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { /// Events raised when the game changes state. [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] public static class GameEvents { /********* ** Properties *********/ /// The core event manager. private static EventManager EventManager; /// Manages deprecation warnings. private static DeprecationManager DeprecationManager; /********* ** Events *********/ /// Raised when the game updates its state (≈60 times per second). public static event EventHandler UpdateTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_UpdateTick.Add(value); } remove => GameEvents.EventManager.Legacy_UpdateTick.Remove(value); } /// Raised every other tick (≈30 times per second). public static event EventHandler SecondUpdateTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_SecondUpdateTick.Add(value); } remove => GameEvents.EventManager.Legacy_SecondUpdateTick.Remove(value); } /// Raised every fourth tick (≈15 times per second). public static event EventHandler FourthUpdateTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_FourthUpdateTick.Add(value); } remove => GameEvents.EventManager.Legacy_FourthUpdateTick.Remove(value); } /// Raised every eighth tick (≈8 times per second). public static event EventHandler EighthUpdateTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_EighthUpdateTick.Add(value); } remove => GameEvents.EventManager.Legacy_EighthUpdateTick.Remove(value); } /// Raised every 15th tick (≈4 times per second). public static event EventHandler QuarterSecondTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_QuarterSecondTick.Add(value); } remove => GameEvents.EventManager.Legacy_QuarterSecondTick.Remove(value); } /// Raised every 30th tick (≈twice per second). public static event EventHandler HalfSecondTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_HalfSecondTick.Add(value); } remove => GameEvents.EventManager.Legacy_HalfSecondTick.Remove(value); } /// Raised every 60th tick (≈once per second). public static event EventHandler OneSecondTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_OneSecondTick.Add(value); } remove => GameEvents.EventManager.Legacy_OneSecondTick.Remove(value); } /// Raised once after the game initialises and all methods have been called. public static event EventHandler FirstUpdateTick { add { GameEvents.DeprecationManager.WarnForOldEvents(); GameEvents.EventManager.Legacy_FirstUpdateTick.Add(value); } remove => GameEvents.EventManager.Legacy_FirstUpdateTick.Remove(value); } /********* ** Public methods *********/ /// Initialise the events. /// The core event manager. /// Manages deprecation warnings. internal static void Init(EventManager eventManager, DeprecationManager deprecationManager) { GameEvents.EventManager = eventManager; GameEvents.DeprecationManager = deprecationManager; } } } #endif