rename new events for clarity (#310)

This commit is contained in:
Jesse Plamondon-Willard 2018-06-01 01:15:26 -04:00
parent 558fb8a865
commit cca7bf1970
8 changed files with 33 additions and 33 deletions

View File

@ -9,12 +9,12 @@ namespace StardewModdingAPI.Events
** Events
*********/
/// <summary>Raised after a game location is added or removed.</summary>
event EventHandler<WorldLocationsChangedEventArgs> LocationsChanged;
event EventHandler<WorldLocationListChangedEventArgs> LocationListChanged;
/// <summary>Raised after buildings are added or removed in a location.</summary>
event EventHandler<WorldBuildingsChangedEventArgs> BuildingsChanged;
event EventHandler<WorldBuildingListChangedEventArgs> BuildingListChanged;
/// <summary>Raised after objects are added or removed in a location.</summary>
event EventHandler<WorldObjectsChangedEventArgs> ObjectsChanged;
event EventHandler<WorldObjectListChangedEventArgs> ObjectListChanged;
}
}

View File

@ -6,8 +6,8 @@ using StardewValley.Buildings;
namespace StardewModdingAPI.Events
{
/// <summary>Event arguments for a <see cref="IWorldEvents.BuildingsChanged"/> event.</summary>
public class WorldBuildingsChangedEventArgs : EventArgs
/// <summary>Event arguments for a <see cref="IWorldEvents.BuildingListChanged"/> event.</summary>
public class WorldBuildingListChangedEventArgs : EventArgs
{
/*********
** Accessors
@ -29,7 +29,7 @@ namespace StardewModdingAPI.Events
/// <param name="location">The location which changed.</param>
/// <param name="added">The buildings added to the location.</param>
/// <param name="removed">The buildings removed from the location.</param>
public WorldBuildingsChangedEventArgs(GameLocation location, IEnumerable<Building> added, IEnumerable<Building> removed)
public WorldBuildingListChangedEventArgs(GameLocation location, IEnumerable<Building> added, IEnumerable<Building> removed)
{
this.Location = location;
this.Added = added.ToArray();

View File

@ -5,8 +5,8 @@ using StardewValley;
namespace StardewModdingAPI.Events
{
/// <summary>Event arguments for a <see cref="IWorldEvents.LocationsChanged"/> event.</summary>
public class WorldLocationsChangedEventArgs : EventArgs
/// <summary>Event arguments for a <see cref="IWorldEvents.LocationListChanged"/> event.</summary>
public class WorldLocationListChangedEventArgs : EventArgs
{
/*********
** Accessors
@ -24,7 +24,7 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="added">The added locations.</param>
/// <param name="removed">The removed locations.</param>
public WorldLocationsChangedEventArgs(IEnumerable<GameLocation> added, IEnumerable<GameLocation> removed)
public WorldLocationListChangedEventArgs(IEnumerable<GameLocation> added, IEnumerable<GameLocation> removed)
{
this.Added = added.ToArray();
this.Removed = removed.ToArray();

View File

@ -7,8 +7,8 @@ using Object = StardewValley.Object;
namespace StardewModdingAPI.Events
{
/// <summary>Event arguments for a <see cref="IWorldEvents.ObjectsChanged"/> event.</summary>
public class WorldObjectsChangedEventArgs : EventArgs
/// <summary>Event arguments for a <see cref="IWorldEvents.ObjectListChanged"/> event.</summary>
public class WorldObjectListChangedEventArgs : EventArgs
{
/*********
** Accessors
@ -30,7 +30,7 @@ namespace StardewModdingAPI.Events
/// <param name="location">The location which changed.</param>
/// <param name="added">The objects added to the location.</param>
/// <param name="removed">The objects removed from the location.</param>
public WorldObjectsChangedEventArgs(GameLocation location, IEnumerable<KeyValuePair<Vector2, Object>> added, IEnumerable<KeyValuePair<Vector2, Object>> removed)
public WorldObjectListChangedEventArgs(GameLocation location, IEnumerable<KeyValuePair<Vector2, Object>> added, IEnumerable<KeyValuePair<Vector2, Object>> removed)
{
this.Location = location;
this.Added = added.ToArray();

View File

@ -15,13 +15,13 @@ namespace StardewModdingAPI.Framework.Events
** World
****/
/// <summary>Raised after a game location is added or removed.</summary>
public readonly ManagedEvent<WorldLocationsChangedEventArgs> World_LocationsChanged;
public readonly ManagedEvent<WorldLocationListChangedEventArgs> World_LocationListChanged;
/// <summary>Raised after buildings are added or removed in a location.</summary>
public readonly ManagedEvent<WorldBuildingsChangedEventArgs> World_BuildingsChanged;
public readonly ManagedEvent<WorldBuildingListChangedEventArgs> World_BuildingListChanged;
/// <summary>Raised after objects are added or removed in a location.</summary>
public readonly ManagedEvent<WorldObjectsChangedEventArgs> World_ObjectsChanged;
public readonly ManagedEvent<WorldObjectListChangedEventArgs> 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<WorldBuildingsChangedEventArgs>(nameof(IModEvents.World), nameof(IWorldEvents.LocationsChanged));
this.World_LocationsChanged = ManageEventOf<WorldLocationsChangedEventArgs>(nameof(IModEvents.World), nameof(IWorldEvents.BuildingsChanged));
this.World_ObjectsChanged = ManageEventOf<WorldObjectsChangedEventArgs>(nameof(IModEvents.World), nameof(IWorldEvents.ObjectsChanged));
this.World_BuildingListChanged = ManageEventOf<WorldBuildingListChangedEventArgs>(nameof(IModEvents.World), nameof(IWorldEvents.LocationListChanged));
this.World_LocationListChanged = ManageEventOf<WorldLocationListChangedEventArgs>(nameof(IModEvents.World), nameof(IWorldEvents.BuildingListChanged));
this.World_ObjectListChanged = ManageEventOf<WorldObjectListChangedEventArgs>(nameof(IModEvents.World), nameof(IWorldEvents.ObjectListChanged));
// init events (old)
this.Content_LocaleChanged = ManageEventOf<EventArgsValueChanged<string>>(nameof(ContentEvents), nameof(ContentEvents.AfterLocaleChanged));

View File

@ -20,24 +20,24 @@ namespace StardewModdingAPI.Framework.Events
** Accessors
*********/
/// <summary>Raised after a game location is added or removed.</summary>
public event EventHandler<WorldLocationsChangedEventArgs> LocationsChanged
public event EventHandler<WorldLocationListChangedEventArgs> 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);
}
/// <summary>Raised after buildings are added or removed in a location.</summary>
public event EventHandler<WorldBuildingsChangedEventArgs> BuildingsChanged
public event EventHandler<WorldBuildingListChangedEventArgs> 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);
}
/// <summary>Raised after objects are added or removed in a location.</summary>
public event EventHandler<WorldObjectsChangedEventArgs> ObjectsChanged
public event EventHandler<WorldObjectListChangedEventArgs> 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);
}

View File

@ -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));
}
}

View File

@ -88,9 +88,9 @@
<Compile Include="Events\EventArgsLocationBuildingsChanged.cs" />
<Compile Include="Events\IWorldEvents.cs" />
<Compile Include="Events\MultiplayerEvents.cs" />
<Compile Include="Events\WorldBuildingsChangedEventArgs.cs" />
<Compile Include="Events\WorldLocationsChangedEventArgs.cs" />
<Compile Include="Events\WorldObjectsChangedEventArgs.cs" />
<Compile Include="Events\WorldBuildingListChangedEventArgs.cs" />
<Compile Include="Events\WorldLocationListChangedEventArgs.cs" />
<Compile Include="Events\WorldObjectListChangedEventArgs.cs" />
<Compile Include="Framework\ContentManagers\BaseContentManager.cs" />
<Compile Include="Framework\ContentManagers\GameContentManager.cs" />
<Compile Include="Framework\ContentManagers\IContentManager.cs" />