summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ModWorldEvents.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-05-31 22:47:56 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-05-31 22:47:56 -0400
commit558fb8a865b638cf5536856e7dcab44823feeaf3 (patch)
tree6ae854fa005858dfd6b55b123a78ce1d66eac466 /src/SMAPI/Framework/Events/ModWorldEvents.cs
parente5f8b1419afa2ad4bece4fde2286b967476c1031 (diff)
downloadSMAPI-558fb8a865b638cf5536856e7dcab44823feeaf3.tar.gz
SMAPI-558fb8a865b638cf5536856e7dcab44823feeaf3.tar.bz2
SMAPI-558fb8a865b638cf5536856e7dcab44823feeaf3.zip
move location events into new event system (#310)
Diffstat (limited to 'src/SMAPI/Framework/Events/ModWorldEvents.cs')
-rw-r--r--src/SMAPI/Framework/Events/ModWorldEvents.cs56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Events/ModWorldEvents.cs b/src/SMAPI/Framework/Events/ModWorldEvents.cs
new file mode 100644
index 00000000..a76a7eb5
--- /dev/null
+++ b/src/SMAPI/Framework/Events/ModWorldEvents.cs
@@ -0,0 +1,56 @@
+using System;
+using StardewModdingAPI.Events;
+
+namespace StardewModdingAPI.Framework.Events
+{
+ /// <summary>Events raised when something changes in the world.</summary>
+ public class ModWorldEvents : IWorldEvents
+ {
+ /*********
+ ** Properties
+ *********/
+ /// <summary>The underlying event manager.</summary>
+ private readonly EventManager EventManager;
+
+ /// <summary>The mod which uses this instance.</summary>
+ private readonly IModMetadata Mod;
+
+
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>Raised after a game location is added or removed.</summary>
+ public event EventHandler<WorldLocationsChangedEventArgs> LocationsChanged
+ {
+ add => this.EventManager.World_LocationsChanged.Add(value, this.Mod);
+ remove => this.EventManager.World_LocationsChanged.Remove(value);
+ }
+
+ /// <summary>Raised after buildings are added or removed in a location.</summary>
+ public event EventHandler<WorldBuildingsChangedEventArgs> BuildingsChanged
+ {
+ add => this.EventManager.World_BuildingsChanged.Add(value, this.Mod);
+ remove => this.EventManager.World_BuildingsChanged.Remove(value);
+ }
+
+ /// <summary>Raised after objects are added or removed in a location.</summary>
+ public event EventHandler<WorldObjectsChangedEventArgs> ObjectsChanged
+ {
+ add => this.EventManager.World_ObjectsChanged.Add(value);
+ remove => this.EventManager.World_ObjectsChanged.Remove(value);
+ }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="mod">The mod which uses this instance.</param>
+ /// <param name="eventManager">The underlying event manager.</param>
+ internal ModWorldEvents(IModMetadata mod, EventManager eventManager)
+ {
+ this.Mod = mod;
+ this.EventManager = eventManager;
+ }
+ }
+}