summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/SpecialisedEvents.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Events/SpecialisedEvents.cs')
-rw-r--r--src/SMAPI/Events/SpecialisedEvents.cs25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/SMAPI/Events/SpecialisedEvents.cs b/src/SMAPI/Events/SpecialisedEvents.cs
index 2a36e6e4..33ebf3b2 100644
--- a/src/SMAPI/Events/SpecialisedEvents.cs
+++ b/src/SMAPI/Events/SpecialisedEvents.cs
@@ -1,5 +1,5 @@
using System;
-using StardewModdingAPI.Framework;
+using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
@@ -7,20 +7,31 @@ namespace StardewModdingAPI.Events
public static class SpecialisedEvents
{
/*********
+ ** Properties
+ *********/
+ /// <summary>The core event manager.</summary>
+ private static EventManager EventManager;
+
+
+ /*********
** Events
*********/
/// <summary>Raised when the game updates its state (≈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 method will trigger a stability warning in the SMAPI console.</summary>
- public static event EventHandler UnvalidatedUpdateTick;
+ public static event EventHandler UnvalidatedUpdateTick
+ {
+ add => SpecialisedEvents.EventManager.Specialised_UnvalidatedUpdateTick.Add(value);
+ remove => SpecialisedEvents.EventManager.Specialised_UnvalidatedUpdateTick.Remove(value);
+ }
/*********
- ** Internal methods
+ ** Public methods
*********/
- /// <summary>Raise an <see cref="UnvalidatedUpdateTick"/> event.</summary>
- /// <param name="monitor">Encapsulates logging and monitoring.</param>
- internal static void InvokeUnvalidatedUpdateTick(IMonitor monitor)
+ /// <summary>Initialise the events.</summary>
+ /// <param name="eventManager">The core event manager.</param>
+ internal static void Init(EventManager eventManager)
{
- monitor.SafelyRaisePlainEvent($"{nameof(SpecialisedEvents)}.{nameof(SpecialisedEvents.UnvalidatedUpdateTick)}", SpecialisedEvents.UnvalidatedUpdateTick?.GetInvocationList());
+ SpecialisedEvents.EventManager = eventManager;
}
}
}