From cca7bf197079975bf310ca90c03b78d0f77fdf02 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 1 Jun 2018 01:15:26 -0400 Subject: [PATCH] rename new events for clarity (#310) --- src/SMAPI/Events/IWorldEvents.cs | 6 +++--- ...cs => WorldBuildingListChangedEventArgs.cs} | 6 +++--- ...cs => WorldLocationListChangedEventArgs.cs} | 6 +++--- ...s.cs => WorldObjectListChangedEventArgs.cs} | 6 +++--- src/SMAPI/Framework/Events/EventManager.cs | 12 ++++++------ src/SMAPI/Framework/Events/ModWorldEvents.cs | 18 +++++++++--------- src/SMAPI/Framework/SGame.cs | 6 +++--- src/SMAPI/StardewModdingAPI.csproj | 6 +++--- 8 files changed, 33 insertions(+), 33 deletions(-) rename src/SMAPI/Events/{WorldBuildingsChangedEventArgs.cs => WorldBuildingListChangedEventArgs.cs} (83%) rename src/SMAPI/Events/{WorldLocationsChangedEventArgs.cs => WorldLocationListChangedEventArgs.cs} (79%) rename src/SMAPI/Events/{WorldObjectsChangedEventArgs.cs => WorldObjectListChangedEventArgs.cs} (81%) diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs index 5c713250..a9a5fe6b 100644 --- a/src/SMAPI/Events/IWorldEvents.cs +++ b/src/SMAPI/Events/IWorldEvents.cs @@ -9,12 +9,12 @@ namespace StardewModdingAPI.Events ** Events *********/ /// Raised after a game location is added or removed. - event EventHandler LocationsChanged; + event EventHandler LocationListChanged; /// Raised after buildings are added or removed in a location. - event EventHandler BuildingsChanged; + event EventHandler BuildingListChanged; /// Raised after objects are added or removed in a location. - event EventHandler ObjectsChanged; + event EventHandler ObjectListChanged; } } diff --git a/src/SMAPI/Events/WorldBuildingsChangedEventArgs.cs b/src/SMAPI/Events/WorldBuildingListChangedEventArgs.cs similarity index 83% rename from src/SMAPI/Events/WorldBuildingsChangedEventArgs.cs rename to src/SMAPI/Events/WorldBuildingListChangedEventArgs.cs index 1f68fd02..e73b9396 100644 --- a/src/SMAPI/Events/WorldBuildingsChangedEventArgs.cs +++ b/src/SMAPI/Events/WorldBuildingListChangedEventArgs.cs @@ -6,8 +6,8 @@ using StardewValley.Buildings; namespace StardewModdingAPI.Events { - /// Event arguments for a event. - public class WorldBuildingsChangedEventArgs : EventArgs + /// Event arguments for a event. + public class WorldBuildingListChangedEventArgs : EventArgs { /********* ** Accessors @@ -29,7 +29,7 @@ namespace StardewModdingAPI.Events /// The location which changed. /// The buildings added to the location. /// The buildings removed from the location. - public WorldBuildingsChangedEventArgs(GameLocation location, IEnumerable added, IEnumerable removed) + public WorldBuildingListChangedEventArgs(GameLocation location, IEnumerable added, IEnumerable removed) { this.Location = location; this.Added = added.ToArray(); diff --git a/src/SMAPI/Events/WorldLocationsChangedEventArgs.cs b/src/SMAPI/Events/WorldLocationListChangedEventArgs.cs similarity index 79% rename from src/SMAPI/Events/WorldLocationsChangedEventArgs.cs rename to src/SMAPI/Events/WorldLocationListChangedEventArgs.cs index 5cf77959..8bc26a43 100644 --- a/src/SMAPI/Events/WorldLocationsChangedEventArgs.cs +++ b/src/SMAPI/Events/WorldLocationListChangedEventArgs.cs @@ -5,8 +5,8 @@ using StardewValley; namespace StardewModdingAPI.Events { - /// Event arguments for a event. - public class WorldLocationsChangedEventArgs : EventArgs + /// Event arguments for a event. + public class WorldLocationListChangedEventArgs : EventArgs { /********* ** Accessors @@ -24,7 +24,7 @@ namespace StardewModdingAPI.Events /// Construct an instance. /// The added locations. /// The removed locations. - public WorldLocationsChangedEventArgs(IEnumerable added, IEnumerable removed) + public WorldLocationListChangedEventArgs(IEnumerable added, IEnumerable removed) { this.Added = added.ToArray(); this.Removed = removed.ToArray(); diff --git a/src/SMAPI/Events/WorldObjectsChangedEventArgs.cs b/src/SMAPI/Events/WorldObjectListChangedEventArgs.cs similarity index 81% rename from src/SMAPI/Events/WorldObjectsChangedEventArgs.cs rename to src/SMAPI/Events/WorldObjectListChangedEventArgs.cs index fb20acd4..5623a49b 100644 --- a/src/SMAPI/Events/WorldObjectsChangedEventArgs.cs +++ b/src/SMAPI/Events/WorldObjectListChangedEventArgs.cs @@ -7,8 +7,8 @@ using Object = StardewValley.Object; namespace StardewModdingAPI.Events { - /// Event arguments for a event. - public class WorldObjectsChangedEventArgs : EventArgs + /// Event arguments for a event. + public class WorldObjectListChangedEventArgs : EventArgs { /********* ** Accessors @@ -30,7 +30,7 @@ namespace StardewModdingAPI.Events /// The location which changed. /// The objects added to the location. /// The objects removed from the location. - public WorldObjectsChangedEventArgs(GameLocation location, IEnumerable> added, IEnumerable> removed) + public WorldObjectListChangedEventArgs(GameLocation location, IEnumerable> added, IEnumerable> removed) { this.Location = location; this.Added = added.ToArray(); diff --git a/src/SMAPI/Framework/Events/EventManager.cs b/src/SMAPI/Framework/Events/EventManager.cs index 53ea699a..0e1e6241 100644 --- a/src/SMAPI/Framework/Events/EventManager.cs +++ b/src/SMAPI/Framework/Events/EventManager.cs @@ -15,13 +15,13 @@ namespace StardewModdingAPI.Framework.Events ** World ****/ /// Raised after a game location is added or removed. - public readonly ManagedEvent World_LocationsChanged; + public readonly ManagedEvent World_LocationListChanged; /// Raised after buildings are added or removed in a location. - public readonly ManagedEvent World_BuildingsChanged; + public readonly ManagedEvent World_BuildingListChanged; /// Raised after objects are added or removed in a location. - public readonly ManagedEvent World_ObjectsChanged; + public readonly ManagedEvent World_ObjectListChanged; /********* @@ -225,9 +225,9 @@ namespace StardewModdingAPI.Framework.Events ManagedEvent ManageEvent(string typeName, string eventName) => new ManagedEvent($"{typeName}.{eventName}", monitor, modRegistry); // init events (new) - this.World_BuildingsChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.LocationsChanged)); - this.World_LocationsChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.BuildingsChanged)); - this.World_ObjectsChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.ObjectsChanged)); + this.World_BuildingListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.LocationListChanged)); + this.World_LocationListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.BuildingListChanged)); + this.World_ObjectListChanged = ManageEventOf(nameof(IModEvents.World), nameof(IWorldEvents.ObjectListChanged)); // init events (old) this.Content_LocaleChanged = ManageEventOf>(nameof(ContentEvents), nameof(ContentEvents.AfterLocaleChanged)); diff --git a/src/SMAPI/Framework/Events/ModWorldEvents.cs b/src/SMAPI/Framework/Events/ModWorldEvents.cs index a76a7eb5..7036b765 100644 --- a/src/SMAPI/Framework/Events/ModWorldEvents.cs +++ b/src/SMAPI/Framework/Events/ModWorldEvents.cs @@ -20,24 +20,24 @@ namespace StardewModdingAPI.Framework.Events ** Accessors *********/ /// Raised after a game location is added or removed. - public event EventHandler LocationsChanged + public event EventHandler LocationListChanged { - add => this.EventManager.World_LocationsChanged.Add(value, this.Mod); - remove => this.EventManager.World_LocationsChanged.Remove(value); + add => this.EventManager.World_LocationListChanged.Add(value, this.Mod); + remove => this.EventManager.World_LocationListChanged.Remove(value); } /// Raised after buildings are added or removed in a location. - public event EventHandler BuildingsChanged + public event EventHandler BuildingListChanged { - add => this.EventManager.World_BuildingsChanged.Add(value, this.Mod); - remove => this.EventManager.World_BuildingsChanged.Remove(value); + add => this.EventManager.World_BuildingListChanged.Add(value, this.Mod); + remove => this.EventManager.World_BuildingListChanged.Remove(value); } /// Raised after objects are added or removed in a location. - public event EventHandler ObjectsChanged + public event EventHandler ObjectListChanged { - add => this.EventManager.World_ObjectsChanged.Add(value); - remove => this.EventManager.World_ObjectsChanged.Remove(value); + add => this.EventManager.World_ObjectListChanged.Add(value); + remove => this.EventManager.World_ObjectListChanged.Remove(value); } diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index e7e9f74f..9442c749 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -543,7 +543,7 @@ namespace StardewModdingAPI.Framework this.Monitor.Log($"Context: location list changed (added {addedText}; removed {removedText}).", LogLevel.Trace); } - this.Events.World_LocationsChanged.Raise(new WorldLocationsChangedEventArgs(added, removed)); + this.Events.World_LocationListChanged.Raise(new WorldLocationListChangedEventArgs(added, removed)); this.Events.Location_LocationsChanged.Raise(new EventArgsLocationsChanged(added, removed)); } @@ -560,7 +560,7 @@ namespace StardewModdingAPI.Framework var removed = watcher.ObjectsWatcher.Removed.ToArray(); watcher.ObjectsWatcher.Reset(); - this.Events.World_ObjectsChanged.Raise(new WorldObjectsChangedEventArgs(location, added, removed)); + this.Events.World_ObjectListChanged.Raise(new WorldObjectListChangedEventArgs(location, added, removed)); this.Events.Location_ObjectsChanged.Raise(new EventArgsLocationObjectsChanged(location, added, removed)); } @@ -572,7 +572,7 @@ namespace StardewModdingAPI.Framework var removed = watcher.BuildingsWatcher.Removed.ToArray(); watcher.BuildingsWatcher.Reset(); - this.Events.World_BuildingsChanged.Raise(new WorldBuildingsChangedEventArgs(location, added, removed)); + this.Events.World_BuildingListChanged.Raise(new WorldBuildingListChangedEventArgs(location, added, removed)); this.Events.Location_BuildingsChanged.Raise(new EventArgsLocationBuildingsChanged(location, added, removed)); } } diff --git a/src/SMAPI/StardewModdingAPI.csproj b/src/SMAPI/StardewModdingAPI.csproj index 6a062930..951a9e6b 100644 --- a/src/SMAPI/StardewModdingAPI.csproj +++ b/src/SMAPI/StardewModdingAPI.csproj @@ -88,9 +88,9 @@ - - - + + +