using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using StardewValley;
using Object = StardewValley.Object;
namespace StardewModdingAPI.Events
{
/// Events raised when the player transitions between game locations, a location is added or removed, or the objects in the current location change.
public static class LocationEvents
{
/*********
** Events
*********/
/// Raised after the player warps to a new location.
public static event EventHandler CurrentLocationChanged = delegate { };
/// Raised after a game location is added or removed.
public static event EventHandler LocationsChanged = delegate { };
/// Raised after the list of objects in the current location changes (e.g. an object is added or removed).
public static event EventHandler LocationObjectsChanged = delegate { };
/*********
** Internal methods
*********/
/// Raise a event.
/// The player's previous location.
/// The player's current location.
internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
{
LocationEvents.CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
}
/// Raise a event.
/// The current list of game locations.
internal static void InvokeLocationsChanged(List newLocations)
{
LocationEvents.LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
}
/// Raise a event.
/// The current list of objects in the current location.
internal static void InvokeOnNewLocationObject(SerializableDictionary newObjects)
{
LocationEvents.LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects));
}
}
}