From a29e2c59d4a01d5b8828644efd6becabc59af28e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 2 Jun 2018 01:04:02 -0400 Subject: disambiguate legacy events internally (#310) --- src/SMAPI/Events/IWorldEvents.cs | 5 +---- src/SMAPI/Events/LocationEvents.cs | 12 ++++++------ src/SMAPI/Framework/Events/EventManager.cs | 12 ++++++------ src/SMAPI/Framework/SGame.cs | 6 +++--- 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'src/SMAPI') diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs index 6a43baf2..067a79bc 100644 --- a/src/SMAPI/Events/IWorldEvents.cs +++ b/src/SMAPI/Events/IWorldEvents.cs @@ -2,12 +2,9 @@ using System; namespace StardewModdingAPI.Events { - /// Provides events raised when something changes in the world. + /// Events raised when something changes in the world. public interface IWorldEvents { - /********* - ** Events - *********/ /// Raised after a game location is added or removed. event EventHandler LocationListChanged; diff --git a/src/SMAPI/Events/LocationEvents.cs b/src/SMAPI/Events/LocationEvents.cs index ff75c619..e2108de0 100644 --- a/src/SMAPI/Events/LocationEvents.cs +++ b/src/SMAPI/Events/LocationEvents.cs @@ -19,22 +19,22 @@ namespace StardewModdingAPI.Events /// Raised after a game location is added or removed. public static event EventHandler LocationsChanged { - add => LocationEvents.EventManager.Location_LocationsChanged.Add(value); - remove => LocationEvents.EventManager.Location_LocationsChanged.Remove(value); + add => LocationEvents.EventManager.Legacy_Location_LocationsChanged.Add(value); + remove => LocationEvents.EventManager.Legacy_Location_LocationsChanged.Remove(value); } /// Raised after buildings are added or removed in a location. public static event EventHandler BuildingsChanged { - add => LocationEvents.EventManager.Location_BuildingsChanged.Add(value); - remove => LocationEvents.EventManager.Location_BuildingsChanged.Remove(value); + add => LocationEvents.EventManager.Legacy_Location_BuildingsChanged.Add(value); + remove => LocationEvents.EventManager.Legacy_Location_BuildingsChanged.Remove(value); } /// Raised after objects are added or removed in a location. public static event EventHandler ObjectsChanged { - add => LocationEvents.EventManager.Location_ObjectsChanged.Add(value); - remove => LocationEvents.EventManager.Location_ObjectsChanged.Remove(value); + add => LocationEvents.EventManager.Legacy_Location_ObjectsChanged.Add(value); + remove => LocationEvents.EventManager.Legacy_Location_ObjectsChanged.Remove(value); } diff --git a/src/SMAPI/Framework/Events/EventManager.cs b/src/SMAPI/Framework/Events/EventManager.cs index 7ce8c640..100e4e43 100644 --- a/src/SMAPI/Framework/Events/EventManager.cs +++ b/src/SMAPI/Framework/Events/EventManager.cs @@ -133,13 +133,13 @@ namespace StardewModdingAPI.Framework.Events ** LocationEvents ****/ /// Raised after a game location is added or removed. - public readonly ManagedEvent Location_LocationsChanged; + public readonly ManagedEvent Legacy_Location_LocationsChanged; /// Raised after buildings are added or removed in a location. - public readonly ManagedEvent Location_BuildingsChanged; + public readonly ManagedEvent Legacy_Location_BuildingsChanged; /// Raised after objects are added or removed in a location. - public readonly ManagedEvent Location_ObjectsChanged; + public readonly ManagedEvent Legacy_Location_ObjectsChanged; /**** ** MenuEvents @@ -273,9 +273,9 @@ namespace StardewModdingAPI.Framework.Events this.Input_ButtonPressed = ManageEventOf(nameof(InputEvents), nameof(InputEvents.ButtonPressed)); this.Input_ButtonReleased = ManageEventOf(nameof(InputEvents), nameof(InputEvents.ButtonReleased)); - this.Location_LocationsChanged = ManageEventOf(nameof(LocationEvents), nameof(LocationEvents.LocationsChanged)); - this.Location_BuildingsChanged = ManageEventOf(nameof(LocationEvents), nameof(LocationEvents.BuildingsChanged)); - this.Location_ObjectsChanged = ManageEventOf(nameof(LocationEvents), nameof(LocationEvents.ObjectsChanged)); + this.Legacy_Location_LocationsChanged = ManageEventOf(nameof(LocationEvents), nameof(LocationEvents.LocationsChanged)); + this.Legacy_Location_BuildingsChanged = ManageEventOf(nameof(LocationEvents), nameof(LocationEvents.BuildingsChanged)); + this.Legacy_Location_ObjectsChanged = ManageEventOf(nameof(LocationEvents), nameof(LocationEvents.ObjectsChanged)); this.Menu_Changed = ManageEventOf(nameof(MenuEvents), nameof(MenuEvents.MenuChanged)); this.Menu_Closed = ManageEventOf(nameof(MenuEvents), nameof(MenuEvents.MenuClosed)); diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 90dbacfe..1611861f 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -547,7 +547,7 @@ namespace StardewModdingAPI.Framework } this.Events.World_LocationListChanged.Raise(new WorldLocationListChangedEventArgs(added, removed)); - this.Events.Location_LocationsChanged.Raise(new EventArgsLocationsChanged(added, removed)); + this.Events.Legacy_Location_LocationsChanged.Raise(new EventArgsLocationsChanged(added, removed)); } // raise location contents changed @@ -564,7 +564,7 @@ namespace StardewModdingAPI.Framework watcher.BuildingsWatcher.Reset(); this.Events.World_BuildingListChanged.Raise(new WorldBuildingListChangedEventArgs(location, added, removed)); - this.Events.Location_BuildingsChanged.Raise(new EventArgsLocationBuildingsChanged(location, added, removed)); + this.Events.Legacy_Location_BuildingsChanged.Raise(new EventArgsLocationBuildingsChanged(location, added, removed)); } // large terrain features changed @@ -598,7 +598,7 @@ namespace StardewModdingAPI.Framework watcher.ObjectsWatcher.Reset(); this.Events.World_ObjectListChanged.Raise(new WorldObjectListChangedEventArgs(location, added, removed)); - this.Events.Location_ObjectsChanged.Raise(new EventArgsLocationObjectsChanged(location, added, removed)); + this.Events.Legacy_Location_ObjectsChanged.Raise(new EventArgsLocationObjectsChanged(location, added, removed)); } // terrain features changed -- cgit