disambiguate legacy events internally (#310)

This commit is contained in:
Jesse Plamondon-Willard 2018-06-02 01:04:02 -04:00
parent 92006bd6ed
commit a29e2c59d4
4 changed files with 16 additions and 19 deletions

View File

@ -2,12 +2,9 @@ using System;
namespace StardewModdingAPI.Events namespace StardewModdingAPI.Events
{ {
/// <summary>Provides events raised when something changes in the world.</summary> /// <summary>Events raised when something changes in the world.</summary>
public interface IWorldEvents public interface IWorldEvents
{ {
/*********
** Events
*********/
/// <summary>Raised after a game location is added or removed.</summary> /// <summary>Raised after a game location is added or removed.</summary>
event EventHandler<WorldLocationListChangedEventArgs> LocationListChanged; event EventHandler<WorldLocationListChangedEventArgs> LocationListChanged;

View File

@ -19,22 +19,22 @@ namespace StardewModdingAPI.Events
/// <summary>Raised after a game location is added or removed.</summary> /// <summary>Raised after a game location is added or removed.</summary>
public static event EventHandler<EventArgsLocationsChanged> LocationsChanged public static event EventHandler<EventArgsLocationsChanged> LocationsChanged
{ {
add => LocationEvents.EventManager.Location_LocationsChanged.Add(value); add => LocationEvents.EventManager.Legacy_Location_LocationsChanged.Add(value);
remove => LocationEvents.EventManager.Location_LocationsChanged.Remove(value); remove => LocationEvents.EventManager.Legacy_Location_LocationsChanged.Remove(value);
} }
/// <summary>Raised after buildings are added or removed in a location.</summary> /// <summary>Raised after buildings are added or removed in a location.</summary>
public static event EventHandler<EventArgsLocationBuildingsChanged> BuildingsChanged public static event EventHandler<EventArgsLocationBuildingsChanged> BuildingsChanged
{ {
add => LocationEvents.EventManager.Location_BuildingsChanged.Add(value); add => LocationEvents.EventManager.Legacy_Location_BuildingsChanged.Add(value);
remove => LocationEvents.EventManager.Location_BuildingsChanged.Remove(value); remove => LocationEvents.EventManager.Legacy_Location_BuildingsChanged.Remove(value);
} }
/// <summary>Raised after objects are added or removed in a location.</summary> /// <summary>Raised after objects are added or removed in a location.</summary>
public static event EventHandler<EventArgsLocationObjectsChanged> ObjectsChanged public static event EventHandler<EventArgsLocationObjectsChanged> ObjectsChanged
{ {
add => LocationEvents.EventManager.Location_ObjectsChanged.Add(value); add => LocationEvents.EventManager.Legacy_Location_ObjectsChanged.Add(value);
remove => LocationEvents.EventManager.Location_ObjectsChanged.Remove(value); remove => LocationEvents.EventManager.Legacy_Location_ObjectsChanged.Remove(value);
} }

View File

@ -133,13 +133,13 @@ namespace StardewModdingAPI.Framework.Events
** LocationEvents ** LocationEvents
****/ ****/
/// <summary>Raised after a game location is added or removed.</summary> /// <summary>Raised after a game location is added or removed.</summary>
public readonly ManagedEvent<EventArgsLocationsChanged> Location_LocationsChanged; public readonly ManagedEvent<EventArgsLocationsChanged> Legacy_Location_LocationsChanged;
/// <summary>Raised after buildings are added or removed in a location.</summary> /// <summary>Raised after buildings are added or removed in a location.</summary>
public readonly ManagedEvent<EventArgsLocationBuildingsChanged> Location_BuildingsChanged; public readonly ManagedEvent<EventArgsLocationBuildingsChanged> Legacy_Location_BuildingsChanged;
/// <summary>Raised after objects are added or removed in a location.</summary> /// <summary>Raised after objects are added or removed in a location.</summary>
public readonly ManagedEvent<EventArgsLocationObjectsChanged> Location_ObjectsChanged; public readonly ManagedEvent<EventArgsLocationObjectsChanged> Legacy_Location_ObjectsChanged;
/**** /****
** MenuEvents ** MenuEvents
@ -273,9 +273,9 @@ namespace StardewModdingAPI.Framework.Events
this.Input_ButtonPressed = ManageEventOf<EventArgsInput>(nameof(InputEvents), nameof(InputEvents.ButtonPressed)); this.Input_ButtonPressed = ManageEventOf<EventArgsInput>(nameof(InputEvents), nameof(InputEvents.ButtonPressed));
this.Input_ButtonReleased = ManageEventOf<EventArgsInput>(nameof(InputEvents), nameof(InputEvents.ButtonReleased)); this.Input_ButtonReleased = ManageEventOf<EventArgsInput>(nameof(InputEvents), nameof(InputEvents.ButtonReleased));
this.Location_LocationsChanged = ManageEventOf<EventArgsLocationsChanged>(nameof(LocationEvents), nameof(LocationEvents.LocationsChanged)); this.Legacy_Location_LocationsChanged = ManageEventOf<EventArgsLocationsChanged>(nameof(LocationEvents), nameof(LocationEvents.LocationsChanged));
this.Location_BuildingsChanged = ManageEventOf<EventArgsLocationBuildingsChanged>(nameof(LocationEvents), nameof(LocationEvents.BuildingsChanged)); this.Legacy_Location_BuildingsChanged = ManageEventOf<EventArgsLocationBuildingsChanged>(nameof(LocationEvents), nameof(LocationEvents.BuildingsChanged));
this.Location_ObjectsChanged = ManageEventOf<EventArgsLocationObjectsChanged>(nameof(LocationEvents), nameof(LocationEvents.ObjectsChanged)); this.Legacy_Location_ObjectsChanged = ManageEventOf<EventArgsLocationObjectsChanged>(nameof(LocationEvents), nameof(LocationEvents.ObjectsChanged));
this.Menu_Changed = ManageEventOf<EventArgsClickableMenuChanged>(nameof(MenuEvents), nameof(MenuEvents.MenuChanged)); this.Menu_Changed = ManageEventOf<EventArgsClickableMenuChanged>(nameof(MenuEvents), nameof(MenuEvents.MenuChanged));
this.Menu_Closed = ManageEventOf<EventArgsClickableMenuClosed>(nameof(MenuEvents), nameof(MenuEvents.MenuClosed)); this.Menu_Closed = ManageEventOf<EventArgsClickableMenuClosed>(nameof(MenuEvents), nameof(MenuEvents.MenuClosed));

View File

@ -547,7 +547,7 @@ namespace StardewModdingAPI.Framework
} }
this.Events.World_LocationListChanged.Raise(new WorldLocationListChangedEventArgs(added, removed)); 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 // raise location contents changed
@ -564,7 +564,7 @@ namespace StardewModdingAPI.Framework
watcher.BuildingsWatcher.Reset(); watcher.BuildingsWatcher.Reset();
this.Events.World_BuildingListChanged.Raise(new WorldBuildingListChangedEventArgs(location, added, removed)); 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 // large terrain features changed
@ -598,7 +598,7 @@ namespace StardewModdingAPI.Framework
watcher.ObjectsWatcher.Reset(); watcher.ObjectsWatcher.Reset();
this.Events.World_ObjectListChanged.Raise(new WorldObjectListChangedEventArgs(location, added, removed)); 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 // terrain features changed