diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-10-31 12:05:02 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-10-31 12:05:02 -0400 |
commit | d9adaf73869ce768686301ef30687a5fc18048a0 (patch) | |
tree | f9c53227a6682388f40ad5b1307bcdd12ad6ba29 /src/StardewModdingAPI/Events | |
parent | 1c15738233453edee36e964f099694ced64cb1b8 (diff) | |
download | SMAPI-d9adaf73869ce768686301ef30687a5fc18048a0.tar.gz SMAPI-d9adaf73869ce768686301ef30687a5fc18048a0.tar.bz2 SMAPI-d9adaf73869ce768686301ef30687a5fc18048a0.zip |
split combined class files per .NET conventions
Diffstat (limited to 'src/StardewModdingAPI/Events')
30 files changed, 845 insertions, 749 deletions
diff --git a/src/StardewModdingAPI/Events/Controls.cs b/src/StardewModdingAPI/Events/ControlEvents.cs index 6415561a..cb597cf1 100644 --- a/src/StardewModdingAPI/Events/Controls.cs +++ b/src/StardewModdingAPI/Events/ControlEvents.cs @@ -1,58 +1,58 @@ -using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-
-namespace StardewModdingAPI.Events
-{
- public static class ControlEvents
- {
- public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged = delegate { };
- public static event EventHandler<EventArgsKeyPressed> KeyPressed = delegate { };
- public static event EventHandler<EventArgsKeyPressed> KeyReleased = delegate { };
- public static event EventHandler<EventArgsMouseStateChanged> MouseChanged = delegate { };
- public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed = delegate { };
- public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased = delegate { };
- public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { };
- public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { };
-
- internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
- {
- KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
- }
-
- internal static void InvokeMouseChanged(MouseState priorState, MouseState newState)
- {
- MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
- }
-
- internal static void InvokeKeyPressed(Keys key)
- {
- KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
- }
-
- internal static void InvokeKeyReleased(Keys key)
- {
- KeyReleased.Invoke(null, new EventArgsKeyPressed(key));
- }
-
- internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
- {
- ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons));
- }
-
- internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
- {
- ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons));
- }
-
- internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
- {
- ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value));
- }
-
- internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
- {
- ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value));
- }
- }
+using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public static class ControlEvents + { + public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged = delegate { }; + public static event EventHandler<EventArgsKeyPressed> KeyPressed = delegate { }; + public static event EventHandler<EventArgsKeyPressed> KeyReleased = delegate { }; + public static event EventHandler<EventArgsMouseStateChanged> MouseChanged = delegate { }; + public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed = delegate { }; + public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased = delegate { }; + public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { }; + public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { }; + + internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState) + { + KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState)); + } + + internal static void InvokeMouseChanged(MouseState priorState, MouseState newState) + { + MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState)); + } + + internal static void InvokeKeyPressed(Keys key) + { + KeyPressed.Invoke(null, new EventArgsKeyPressed(key)); + } + + internal static void InvokeKeyReleased(Keys key) + { + KeyReleased.Invoke(null, new EventArgsKeyPressed(key)); + } + + internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons) + { + ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons)); + } + + internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons) + { + ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons)); + } + + internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value) + { + ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value)); + } + + internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value) + { + ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value)); + } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgs.cs b/src/StardewModdingAPI/Events/EventArgs.cs deleted file mode 100644 index 2bce964e..00000000 --- a/src/StardewModdingAPI/Events/EventArgs.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-using StardewModdingAPI.Inheritance;
-using StardewValley;
-using StardewValley.Menus;
-using Object = StardewValley.Object;
-
-namespace StardewModdingAPI.Events
-{
- public class EventArgsKeyboardStateChanged : EventArgs
- {
- public EventArgsKeyboardStateChanged(KeyboardState priorState, KeyboardState newState)
- {
- NewState = newState;
- NewState = newState;
- }
-
- public KeyboardState NewState { get; private set; }
- public KeyboardState PriorState { get; private set; }
- }
-
- public class EventArgsKeyPressed : EventArgs
- {
- public EventArgsKeyPressed(Keys keyPressed)
- {
- KeyPressed = keyPressed;
- }
-
- public Keys KeyPressed { get; private set; }
- }
-
- public class EventArgsControllerButtonPressed : EventArgs
- {
- public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons buttonPressed)
- {
- PlayerIndex = playerIndex;
- ButtonPressed = buttonPressed;
- }
-
- public PlayerIndex PlayerIndex { get; private set; }
- public Buttons ButtonPressed { get; private set; }
- }
-
- public class EventArgsControllerButtonReleased : EventArgs
- {
- public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons buttonReleased)
- {
- PlayerIndex = playerIndex;
- ButtonReleased = buttonReleased;
- }
-
- public PlayerIndex PlayerIndex { get; private set; }
- public Buttons ButtonReleased { get; private set; }
- }
-
- public class EventArgsControllerTriggerPressed : EventArgs
- {
- public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons buttonPressed, float value)
- {
- PlayerIndex = playerIndex;
- ButtonPressed = buttonPressed;
- Value = value;
- }
-
- public PlayerIndex PlayerIndex { get; private set; }
- public Buttons ButtonPressed { get; private set; }
- public float Value { get; private set; }
- }
-
- public class EventArgsControllerTriggerReleased : EventArgs
- {
- public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons buttonReleased, float value)
- {
- PlayerIndex = playerIndex;
- ButtonReleased = buttonReleased;
- Value = value;
- }
-
- public PlayerIndex PlayerIndex { get; private set; }
- public Buttons ButtonReleased { get; private set; }
- public float Value { get; private set; }
- }
-
- public class EventArgsMouseStateChanged : EventArgs
- {
- public EventArgsMouseStateChanged(MouseState priorState, MouseState newState)
- {
- NewState = newState;
- NewState = newState;
- }
-
- public MouseState NewState { get; private set; }
- public MouseState PriorState { get; private set; }
- }
-
- public class EventArgsClickableMenuChanged : EventArgs
- {
- public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
- {
- NewMenu = newMenu;
- PriorMenu = priorMenu;
- }
-
- public IClickableMenu NewMenu { get; private set; }
- public IClickableMenu PriorMenu { get; private set; }
- }
-
- public class EventArgsClickableMenuClosed : EventArgs
- {
- public EventArgsClickableMenuClosed(IClickableMenu priorMenu)
- {
- PriorMenu = priorMenu;
- }
-
- public IClickableMenu PriorMenu { get; private set; }
- }
-
- public class EventArgsGameLocationsChanged : EventArgs
- {
- public EventArgsGameLocationsChanged(List<GameLocation> newLocations)
- {
- NewLocations = newLocations;
- }
-
- public List<GameLocation> NewLocations { get; private set; }
- }
-
- public class EventArgsMineLevelChanged : EventArgs
- {
- public EventArgsMineLevelChanged(int previousMineLevel, int currentMineLevel)
- {
- PreviousMineLevel = previousMineLevel;
- CurrentMineLevel = currentMineLevel;
- }
-
- public int PreviousMineLevel { get; private set; }
- public int CurrentMineLevel { get; private set; }
- }
-
- public class EventArgsLocationObjectsChanged : EventArgs
- {
- public EventArgsLocationObjectsChanged(SerializableDictionary<Vector2, Object> newObjects)
- {
- NewObjects = newObjects;
- }
-
- public SerializableDictionary<Vector2, Object> NewObjects { get; private set; }
- }
-
- public class EventArgsCurrentLocationChanged : EventArgs
- {
- public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
- {
- NewLocation = newLocation;
- PriorLocation = priorLocation;
- }
-
- public GameLocation NewLocation { get; private set; }
- public GameLocation PriorLocation { get; private set; }
- }
-
- public class EventArgsFarmerChanged : EventArgs
- {
- public EventArgsFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
- {
- NewFarmer = NewFarmer;
- PriorFarmer = PriorFarmer;
- }
-
- public Farmer NewFarmer { get; }
- public Farmer PriorFarmer { get; }
- }
-
- public class EventArgsInventoryChanged : EventArgs
- {
- public EventArgsInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
- {
- Inventory = inventory;
- Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList();
- Removed = changedItems.Where(n => n.ChangeType == ChangeType.Removed).ToList();
- QuantityChanged = changedItems.Where(n => n.ChangeType == ChangeType.StackChange).ToList();
- }
-
- public List<Item> Inventory { get; private set; }
- public List<ItemStackChange> Added { get; private set; }
- public List<ItemStackChange> Removed { get; private set; }
- public List<ItemStackChange> QuantityChanged { get; private set; }
- }
-
- public class EventArgsLevelUp : EventArgs
- {
- public enum LevelType
- {
- Combat,
- Farming,
- Fishing,
- Foraging,
- Mining,
- Luck
- }
-
- public EventArgsLevelUp(LevelType type, int newLevel)
- {
- Type = type;
- NewLevel = newLevel;
- }
-
- public LevelType Type { get; private set; }
- public int NewLevel { get; private set; }
- }
-
- public class EventArgsIntChanged : EventArgs
- {
- public EventArgsIntChanged(int priorInt, int newInt)
- {
- NewInt = NewInt;
- PriorInt = PriorInt;
- }
-
- public int NewInt { get; }
- public int PriorInt { get; }
- }
-
- public class EventArgsStringChanged : EventArgs
- {
- public EventArgsStringChanged(string priorString, string newString)
- {
- NewString = newString;
- PriorString = priorString;
- }
-
- public string NewString { get; private set; }
- public string PriorString { get; private set; }
- }
-
- public class EventArgsLoadedGameChanged : EventArgs
- {
- public EventArgsLoadedGameChanged(bool loadedGame)
- {
- LoadedGame = loadedGame;
- }
-
- public bool LoadedGame { get; private set; }
- }
-
- public class EventArgsNewDay : EventArgs
- {
- public EventArgsNewDay(int prevDay, int curDay, bool newDay)
- {
- PreviousDay = prevDay;
- CurrentDay = curDay;
- IsNewDay = newDay;
- }
-
- public int PreviousDay { get; private set; }
- public int CurrentDay { get; private set; }
- public bool IsNewDay { get; private set; }
- }
-
- public class EventArgsCommand : EventArgs
- {
- public EventArgsCommand(Command command)
- {
- Command = command;
- }
-
- public Command Command { get; private set; }
- }
-}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs new file mode 100644 index 00000000..6765c8da --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs @@ -0,0 +1,17 @@ +using System; +using StardewValley.Menus; + +namespace StardewModdingAPI.Events +{ + public class EventArgsClickableMenuChanged : EventArgs + { + public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu) + { + NewMenu = newMenu; + PriorMenu = priorMenu; + } + + public IClickableMenu NewMenu { get; private set; } + public IClickableMenu PriorMenu { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs new file mode 100644 index 00000000..bdf44285 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs @@ -0,0 +1,15 @@ +using System; +using StardewValley.Menus; + +namespace StardewModdingAPI.Events +{ + public class EventArgsClickableMenuClosed : EventArgs + { + public EventArgsClickableMenuClosed(IClickableMenu priorMenu) + { + PriorMenu = priorMenu; + } + + public IClickableMenu PriorMenu { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsCommand.cs b/src/StardewModdingAPI/Events/EventArgsCommand.cs new file mode 100644 index 00000000..fd2d4a51 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsCommand.cs @@ -0,0 +1,14 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsCommand : EventArgs + { + public EventArgsCommand(Command command) + { + Command = command; + } + + public Command Command { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs new file mode 100644 index 00000000..b51a8a5b --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs @@ -0,0 +1,18 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsControllerButtonPressed : EventArgs + { + public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons buttonPressed) + { + PlayerIndex = playerIndex; + ButtonPressed = buttonPressed; + } + + public PlayerIndex PlayerIndex { get; private set; } + public Buttons ButtonPressed { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs new file mode 100644 index 00000000..0164b8d6 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs @@ -0,0 +1,18 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsControllerButtonReleased : EventArgs + { + public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons buttonReleased) + { + PlayerIndex = playerIndex; + ButtonReleased = buttonReleased; + } + + public PlayerIndex PlayerIndex { get; private set; } + public Buttons ButtonReleased { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs new file mode 100644 index 00000000..1bf4fa46 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs @@ -0,0 +1,20 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsControllerTriggerPressed : EventArgs + { + public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons buttonPressed, float value) + { + PlayerIndex = playerIndex; + ButtonPressed = buttonPressed; + Value = value; + } + + public PlayerIndex PlayerIndex { get; private set; } + public Buttons ButtonPressed { get; private set; } + public float Value { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs new file mode 100644 index 00000000..07a4bcb1 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs @@ -0,0 +1,20 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsControllerTriggerReleased : EventArgs + { + public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons buttonReleased, float value) + { + PlayerIndex = playerIndex; + ButtonReleased = buttonReleased; + Value = value; + } + + public PlayerIndex PlayerIndex { get; private set; } + public Buttons ButtonReleased { get; private set; } + public float Value { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs new file mode 100644 index 00000000..53ed1551 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs @@ -0,0 +1,17 @@ +using System; +using StardewValley; + +namespace StardewModdingAPI.Events +{ + public class EventArgsCurrentLocationChanged : EventArgs + { + public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation) + { + NewLocation = newLocation; + PriorLocation = priorLocation; + } + + public GameLocation NewLocation { get; private set; } + public GameLocation PriorLocation { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs new file mode 100644 index 00000000..468d18ee --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs @@ -0,0 +1,17 @@ +using System; +using StardewValley; + +namespace StardewModdingAPI.Events +{ + public class EventArgsFarmerChanged : EventArgs + { + public EventArgsFarmerChanged(Farmer priorFarmer, Farmer newFarmer) + { + NewFarmer = NewFarmer; + PriorFarmer = PriorFarmer; + } + + public Farmer NewFarmer { get; } + public Farmer PriorFarmer { get; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs new file mode 100644 index 00000000..6a55c87a --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using StardewValley; + +namespace StardewModdingAPI.Events +{ + public class EventArgsGameLocationsChanged : EventArgs + { + public EventArgsGameLocationsChanged(List<GameLocation> newLocations) + { + NewLocations = newLocations; + } + + public List<GameLocation> NewLocations { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsIntChanged.cs b/src/StardewModdingAPI/Events/EventArgsIntChanged.cs new file mode 100644 index 00000000..c8a6e86d --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsIntChanged.cs @@ -0,0 +1,16 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsIntChanged : EventArgs + { + public EventArgsIntChanged(int priorInt, int newInt) + { + NewInt = NewInt; + PriorInt = PriorInt; + } + + public int NewInt { get; } + public int PriorInt { get; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs new file mode 100644 index 00000000..fa929ab5 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using StardewModdingAPI.Inheritance; +using StardewValley; + +namespace StardewModdingAPI.Events +{ + public class EventArgsInventoryChanged : EventArgs + { + public EventArgsInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems) + { + Inventory = inventory; + Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList(); + Removed = changedItems.Where(n => n.ChangeType == ChangeType.Removed).ToList(); + QuantityChanged = changedItems.Where(n => n.ChangeType == ChangeType.StackChange).ToList(); + } + + public List<Item> Inventory { get; private set; } + public List<ItemStackChange> Added { get; private set; } + public List<ItemStackChange> Removed { get; private set; } + public List<ItemStackChange> QuantityChanged { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs b/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs new file mode 100644 index 00000000..df45e111 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs @@ -0,0 +1,15 @@ +using System; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsKeyPressed : EventArgs + { + public EventArgsKeyPressed(Keys keyPressed) + { + KeyPressed = keyPressed; + } + + public Keys KeyPressed { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs new file mode 100644 index 00000000..784cd197 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsKeyboardStateChanged : EventArgs + { + public EventArgsKeyboardStateChanged(KeyboardState priorState, KeyboardState newState) + { + NewState = newState; + NewState = newState; + } + + public KeyboardState NewState { get; private set; } + public KeyboardState PriorState { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsLevelUp.cs b/src/StardewModdingAPI/Events/EventArgsLevelUp.cs new file mode 100644 index 00000000..762422c2 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsLevelUp.cs @@ -0,0 +1,26 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsLevelUp : EventArgs + { + public enum LevelType + { + Combat, + Farming, + Fishing, + Foraging, + Mining, + Luck + } + + public EventArgsLevelUp(LevelType type, int newLevel) + { + Type = type; + NewLevel = newLevel; + } + + public LevelType Type { get; private set; } + public int NewLevel { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs new file mode 100644 index 00000000..1b6e21e2 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs @@ -0,0 +1,14 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsLoadedGameChanged : EventArgs + { + public EventArgsLoadedGameChanged(bool loadedGame) + { + LoadedGame = loadedGame; + } + + public bool LoadedGame { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs b/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs new file mode 100644 index 00000000..70309192 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.Xna.Framework; +using StardewValley; +using Object = StardewValley.Object; + +namespace StardewModdingAPI.Events +{ + public class EventArgsLocationObjectsChanged : EventArgs + { + public EventArgsLocationObjectsChanged(SerializableDictionary<Vector2, Object> newObjects) + { + NewObjects = newObjects; + } + + public SerializableDictionary<Vector2, Object> NewObjects { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs b/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs new file mode 100644 index 00000000..f95e0ac2 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs @@ -0,0 +1,16 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsMineLevelChanged : EventArgs + { + public EventArgsMineLevelChanged(int previousMineLevel, int currentMineLevel) + { + PreviousMineLevel = previousMineLevel; + CurrentMineLevel = currentMineLevel; + } + + public int PreviousMineLevel { get; private set; } + public int CurrentMineLevel { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs new file mode 100644 index 00000000..145a4445 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Events +{ + public class EventArgsMouseStateChanged : EventArgs + { + public EventArgsMouseStateChanged(MouseState priorState, MouseState newState) + { + PriorState = priorState; + NewState = newState; + } + + public MouseState NewState { get; private set; } + public MouseState PriorState { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsNewDay.cs b/src/StardewModdingAPI/Events/EventArgsNewDay.cs new file mode 100644 index 00000000..04d0e389 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsNewDay.cs @@ -0,0 +1,18 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsNewDay : EventArgs + { + public EventArgsNewDay(int prevDay, int curDay, bool newDay) + { + PreviousDay = prevDay; + CurrentDay = curDay; + IsNewDay = newDay; + } + + public int PreviousDay { get; private set; } + public int CurrentDay { get; private set; } + public bool IsNewDay { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs new file mode 100644 index 00000000..626d77b7 --- /dev/null +++ b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs @@ -0,0 +1,16 @@ +using System; + +namespace StardewModdingAPI.Events +{ + public class EventArgsStringChanged : EventArgs + { + public EventArgsStringChanged(string priorString, string newString) + { + NewString = newString; + PriorString = priorString; + } + + public string NewString { get; private set; } + public string PriorString { get; private set; } + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Game.cs b/src/StardewModdingAPI/Events/GameEvents.cs index 8b8042ed..1a366011 100644 --- a/src/StardewModdingAPI/Events/Game.cs +++ b/src/StardewModdingAPI/Events/GameEvents.cs @@ -1,123 +1,123 @@ -using System;
-
-namespace StardewModdingAPI.Events
-{
- public static class GameEvents
- {
- public static event EventHandler GameLoaded = delegate { };
- public static event EventHandler Initialize = delegate { };
- public static event EventHandler LoadContent = delegate { };
- public static event EventHandler FirstUpdateTick = delegate { };
-
- /// <summary>
- /// Fires every update (1/60 of a second)
- /// </summary>
- public static event EventHandler UpdateTick = delegate { };
-
- /// <summary>
- /// Fires every other update (1/30 of a second)
- /// </summary>
- public static event EventHandler SecondUpdateTick = delegate { };
-
- /// <summary>
- /// Fires every fourth update (1/15 of a second)
- /// </summary>
- public static event EventHandler FourthUpdateTick = delegate { };
-
- /// <summary>
- /// Fires every eighth update (roughly 1/8 of a second)
- /// </summary>
- public static event EventHandler EighthUpdateTick = delegate { };
-
- /// <summary>
- /// Fires every fifthteenth update (1/4 of a second)
- /// </summary>
- public static event EventHandler QuarterSecondTick = delegate { };
-
- /// <summary>
- /// Fires every thirtieth update (1/2 of a second)
- /// </summary>
- public static event EventHandler HalfSecondTick = delegate { };
-
- /// <summary>
- /// Fires every sixtieth update (a second)
- /// </summary>
- public static event EventHandler OneSecondTick = delegate { };
-
- internal static void InvokeGameLoaded()
- {
- GameLoaded.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeInitialize()
- {
- try
- {
- Initialize.Invoke(null, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Log.AsyncR("An exception occured in XNA Initialize: " + ex);
- }
- }
-
- internal static void InvokeLoadContent()
- {
- try
- {
- LoadContent.Invoke(null, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Log.AsyncR("An exception occured in XNA LoadContent: " + ex);
- }
- }
-
- internal static void InvokeUpdateTick()
- {
- try
- {
- UpdateTick.Invoke(null, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Log.AsyncR("An exception occured in XNA UpdateTick: " + ex);
- }
- }
-
- internal static void InvokeSecondUpdateTick()
- {
- SecondUpdateTick.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeFourthUpdateTick()
- {
- FourthUpdateTick.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeEighthUpdateTick()
- {
- EighthUpdateTick.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeQuarterSecondTick()
- {
- QuarterSecondTick.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeHalfSecondTick()
- {
- HalfSecondTick.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeOneSecondTick()
- {
- OneSecondTick.Invoke(null, EventArgs.Empty);
- }
-
- internal static void InvokeFirstUpdateTick()
- {
- FirstUpdateTick.Invoke(null, EventArgs.Empty);
- }
- }
+using System; + +namespace StardewModdingAPI.Events +{ + public static class GameEvents + { + public static event EventHandler GameLoaded = delegate { }; + public static event EventHandler Initialize = delegate { }; + public static event EventHandler LoadContent = delegate { }; + public static event EventHandler FirstUpdateTick = delegate { }; + + /// <summary> + /// Fires every update (1/60 of a second) + /// </summary> + public static event EventHandler UpdateTick = delegate { }; + + /// <summary> + /// Fires every other update (1/30 of a second) + /// </summary> + public static event EventHandler SecondUpdateTick = delegate { }; + + /// <summary> + /// Fires every fourth update (1/15 of a second) + /// </summary> + public static event EventHandler FourthUpdateTick = delegate { }; + + /// <summary> + /// Fires every eighth update (roughly 1/8 of a second) + /// </summary> + public static event EventHandler EighthUpdateTick = delegate { }; + + /// <summary> + /// Fires every fifthteenth update (1/4 of a second) + /// </summary> + public static event EventHandler QuarterSecondTick = delegate { }; + + /// <summary> + /// Fires every thirtieth update (1/2 of a second) + /// </summary> + public static event EventHandler HalfSecondTick = delegate { }; + + /// <summary> + /// Fires every sixtieth update (a second) + /// </summary> + public static event EventHandler OneSecondTick = delegate { }; + + internal static void InvokeGameLoaded() + { + GameLoaded.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeInitialize() + { + try + { + Initialize.Invoke(null, EventArgs.Empty); + } + catch (Exception ex) + { + Log.AsyncR("An exception occured in XNA Initialize: " + ex); + } + } + + internal static void InvokeLoadContent() + { + try + { + LoadContent.Invoke(null, EventArgs.Empty); + } + catch (Exception ex) + { + Log.AsyncR("An exception occured in XNA LoadContent: " + ex); + } + } + + internal static void InvokeUpdateTick() + { + try + { + UpdateTick.Invoke(null, EventArgs.Empty); + } + catch (Exception ex) + { + Log.AsyncR("An exception occured in XNA UpdateTick: " + ex); + } + } + + internal static void InvokeSecondUpdateTick() + { + SecondUpdateTick.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeFourthUpdateTick() + { + FourthUpdateTick.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeEighthUpdateTick() + { + EighthUpdateTick.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeQuarterSecondTick() + { + QuarterSecondTick.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeHalfSecondTick() + { + HalfSecondTick.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeOneSecondTick() + { + OneSecondTick.Invoke(null, EventArgs.Empty); + } + + internal static void InvokeFirstUpdateTick() + { + FirstUpdateTick.Invoke(null, EventArgs.Empty); + } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Graphics.cs b/src/StardewModdingAPI/Events/GraphicsEvents.cs index 331d3e3a..1435bc37 100644 --- a/src/StardewModdingAPI/Events/Graphics.cs +++ b/src/StardewModdingAPI/Events/GraphicsEvents.cs @@ -1,162 +1,162 @@ -using System;
-
-namespace StardewModdingAPI.Events
-{
- /// <summary>
- ///
- /// </summary>
- public static class GraphicsEvents
- {
- /// <summary>
- /// Occurs when the form (game) is resized.
- /// </summary>
- public static event EventHandler Resize = delegate { };
-
- /// <summary>
- /// Occurs before anything is drawn.
- /// </summary>
- public static event EventHandler OnPreRenderEvent = delegate { };
-
- /// <summary>
- /// Occurs before the GUI is drawn.
- /// </summary>
- public static event EventHandler OnPreRenderGuiEvent = delegate { };
-
- /// <summary>
- /// Occurs after the GUI is drawn.
- /// </summary>
- public static event EventHandler OnPostRenderGuiEvent = delegate { };
-
- /// <summary>
- /// Occurs before the HUD is drawn.
- /// </summary>
- public static event EventHandler OnPreRenderHudEvent = delegate { };
-
- /// <summary>
- /// Occurs after the HUD is drawn.
- /// </summary>
- public static event EventHandler OnPostRenderHudEvent = delegate { };
-
- /// <summary>
- /// Occurs after everything is drawn.
- /// </summary>
- public static event EventHandler OnPostRenderEvent = delegate { };
-
- /// <summary>
- /// Occurs before the GUI is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPreRenderGuiEventNoCheck = delegate { };
-
- /// <summary>
- /// Occurs after the GUI is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPostRenderGuiEventNoCheck = delegate { };
-
- /// <summary>
- /// Occurs before the HUD is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPreRenderHudEventNoCheck = delegate { };
-
- /// <summary>
- /// Occurs after the HUD is drawn. Does not check for conditional statements.
- /// </summary>
- public static event EventHandler OnPostRenderHudEventNoCheck = delegate { };
-
- /// <summary>
- /// Draws when SGame.Debug is true. F3 toggles this.
- /// Game1.spriteBatch.Begin() is pre-called.
- /// Do not make end or begin calls to the spritebatch.
- /// If you are only trying to add debug information, use SGame.DebugMessageQueue in your Update loop.
- /// </summary>
- public static event EventHandler DrawDebug = delegate { };
-
- internal static void InvokeDrawDebug(object sender, EventArgs e)
- {
- DrawDebug.Invoke(sender, e);
- }
-
- internal static void InvokeOnPreRenderEvent(object sender, EventArgs e)
- {
- OnPreRenderEvent.Invoke(sender, e);
- }
-
- internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e)
- {
- OnPreRenderGuiEvent.Invoke(sender, e);
- }
-
- internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e)
- {
- OnPostRenderGuiEvent.Invoke(sender, e);
- }
-
- internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e)
- {
- OnPreRenderHudEvent.Invoke(sender, e);
- }
-
- internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e)
- {
- OnPostRenderHudEvent.Invoke(sender, e);
- }
-
- internal static void InvokeOnPostRenderEvent(object sender, EventArgs e)
- {
- OnPostRenderEvent.Invoke(sender, e);
- }
-
- internal static void InvokeOnPreRenderGuiEventNoCheck(object sender, EventArgs e)
- {
- OnPreRenderGuiEventNoCheck.Invoke(sender, e);
- }
-
- internal static void InvokeOnPostRenderGuiEventNoCheck(object sender, EventArgs e)
- {
- OnPostRenderGuiEventNoCheck.Invoke(sender, e);
- }
-
- internal static void InvokeOnPreRenderHudEventNoCheck(object sender, EventArgs e)
- {
- OnPreRenderHudEventNoCheck.Invoke(sender, e);
- }
-
- internal static void InvokeOnPostRenderHudEventNoCheck(object sender, EventArgs e)
- {
- OnPostRenderHudEventNoCheck.Invoke(sender, e);
- }
-
- internal static void InvokeResize(object sender, EventArgs e)
- {
- Resize.Invoke(sender, e);
- }
-
- #region To Remove
-
- [Obsolete("Use the other Pre/Post render events instead.")]
- public static event EventHandler DrawTick = delegate { };
-
- [Obsolete("Use the other Pre/Post render events instead. All of them will automatically be drawn into the render target if needed.")]
- public static event EventHandler DrawInRenderTargetTick = delegate { };
-
- [Obsolete("Should not be used.")]
- public static void InvokeDrawTick()
- {
- try
- {
- DrawTick.Invoke(null, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Log.AsyncR("An exception occured in a Mod's DrawTick: " + ex);
- }
- }
-
- [Obsolete("Should not be used.")]
- public static void InvokeDrawInRenderTargetTick()
- {
- DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
- }
-
- #endregion
- }
+using System; + +namespace StardewModdingAPI.Events +{ + /// <summary> + /// + /// </summary> + public static class GraphicsEvents + { + /// <summary> + /// Occurs when the form (game) is resized. + /// </summary> + public static event EventHandler Resize = delegate { }; + + /// <summary> + /// Occurs before anything is drawn. + /// </summary> + public static event EventHandler OnPreRenderEvent = delegate { }; + + /// <summary> + /// Occurs before the GUI is drawn. + /// </summary> + public static event EventHandler OnPreRenderGuiEvent = delegate { }; + + /// <summary> + /// Occurs after the GUI is drawn. + /// </summary> + public static event EventHandler OnPostRenderGuiEvent = delegate { }; + + /// <summary> + /// Occurs before the HUD is drawn. + /// </summary> + public static event EventHandler OnPreRenderHudEvent = delegate { }; + + /// <summary> + /// Occurs after the HUD is drawn. + /// </summary> + public static event EventHandler OnPostRenderHudEvent = delegate { }; + + /// <summary> + /// Occurs after everything is drawn. + /// </summary> + public static event EventHandler OnPostRenderEvent = delegate { }; + + /// <summary> + /// Occurs before the GUI is drawn. Does not check for conditional statements. + /// </summary> + public static event EventHandler OnPreRenderGuiEventNoCheck = delegate { }; + + /// <summary> + /// Occurs after the GUI is drawn. Does not check for conditional statements. + /// </summary> + public static event EventHandler OnPostRenderGuiEventNoCheck = delegate { }; + + /// <summary> + /// Occurs before the HUD is drawn. Does not check for conditional statements. + /// </summary> + public static event EventHandler OnPreRenderHudEventNoCheck = delegate { }; + + /// <summary> + /// Occurs after the HUD is drawn. Does not check for conditional statements. + /// </summary> + public static event EventHandler OnPostRenderHudEventNoCheck = delegate { }; + + /// <summary> + /// Draws when SGame.Debug is true. F3 toggles this. + /// Game1.spriteBatch.Begin() is pre-called. + /// Do not make end or begin calls to the spritebatch. + /// If you are only trying to add debug information, use SGame.DebugMessageQueue in your Update loop. + /// </summary> + public static event EventHandler DrawDebug = delegate { }; + + internal static void InvokeDrawDebug(object sender, EventArgs e) + { + DrawDebug.Invoke(sender, e); + } + + internal static void InvokeOnPreRenderEvent(object sender, EventArgs e) + { + OnPreRenderEvent.Invoke(sender, e); + } + + internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e) + { + OnPreRenderGuiEvent.Invoke(sender, e); + } + + internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e) + { + OnPostRenderGuiEvent.Invoke(sender, e); + } + + internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e) + { + OnPreRenderHudEvent.Invoke(sender, e); + } + + internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e) + { + OnPostRenderHudEvent.Invoke(sender, e); + } + + internal static void InvokeOnPostRenderEvent(object sender, EventArgs e) + { + OnPostRenderEvent.Invoke(sender, e); + } + + internal static void InvokeOnPreRenderGuiEventNoCheck(object sender, EventArgs e) + { + OnPreRenderGuiEventNoCheck.Invoke(sender, e); + } + + internal static void InvokeOnPostRenderGuiEventNoCheck(object sender, EventArgs e) + { + OnPostRenderGuiEventNoCheck.Invoke(sender, e); + } + + internal static void InvokeOnPreRenderHudEventNoCheck(object sender, EventArgs e) + { + OnPreRenderHudEventNoCheck.Invoke(sender, e); + } + + internal static void InvokeOnPostRenderHudEventNoCheck(object sender, EventArgs e) + { + OnPostRenderHudEventNoCheck.Invoke(sender, e); + } + + internal static void InvokeResize(object sender, EventArgs e) + { + Resize.Invoke(sender, e); + } + + #region To Remove + + [Obsolete("Use the other Pre/Post render events instead.")] + public static event EventHandler DrawTick = delegate { }; + + [Obsolete("Use the other Pre/Post render events instead. All of them will automatically be drawn into the render target if needed.")] + public static event EventHandler DrawInRenderTargetTick = delegate { }; + + [Obsolete("Should not be used.")] + public static void InvokeDrawTick() + { + try + { + DrawTick.Invoke(null, EventArgs.Empty); + } + catch (Exception ex) + { + Log.AsyncR("An exception occured in a Mod's DrawTick: " + ex); + } + } + + [Obsolete("Should not be used.")] + public static void InvokeDrawInRenderTargetTick() + { + DrawInRenderTargetTick.Invoke(null, EventArgs.Empty); + } + + #endregion + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Location.cs b/src/StardewModdingAPI/Events/LocationEvents.cs index f951ab95..b4b4ac33 100644 --- a/src/StardewModdingAPI/Events/Location.cs +++ b/src/StardewModdingAPI/Events/LocationEvents.cs @@ -1,30 +1,30 @@ -using System;
-using System.Collections.Generic;
-using Microsoft.Xna.Framework;
-using StardewValley;
-using Object = StardewValley.Object;
-
-namespace StardewModdingAPI.Events
-{
- public static class LocationEvents
- {
- public static event EventHandler<EventArgsGameLocationsChanged> LocationsChanged = delegate { };
- public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { };
- public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
-
- internal static void InvokeLocationsChanged(List<GameLocation> newLocations)
- {
- LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
- }
-
- internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
- {
- CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
- }
-
- internal static void InvokeOnNewLocationObject(SerializableDictionary<Vector2, Object> newObjects)
- {
- LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects));
- }
- }
+using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using StardewValley; +using Object = StardewValley.Object; + +namespace StardewModdingAPI.Events +{ + public static class LocationEvents + { + public static event EventHandler<EventArgsGameLocationsChanged> LocationsChanged = delegate { }; + public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { }; + public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { }; + + internal static void InvokeLocationsChanged(List<GameLocation> newLocations) + { + LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations)); + } + + internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation) + { + CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation)); + } + + internal static void InvokeOnNewLocationObject(SerializableDictionary<Vector2, Object> newObjects) + { + LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects)); + } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Menu.cs b/src/StardewModdingAPI/Events/MenuEvents.cs index 0e043780..fdd96f00 100644 --- a/src/StardewModdingAPI/Events/Menu.cs +++ b/src/StardewModdingAPI/Events/MenuEvents.cs @@ -1,21 +1,21 @@ -using System;
-using StardewValley.Menus;
-
-namespace StardewModdingAPI.Events
-{
- public static class MenuEvents
- {
- public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
- public static event EventHandler<EventArgsClickableMenuClosed> MenuClosed = delegate { };
-
- internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
- {
- MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
- }
-
- internal static void InvokeMenuClosed(IClickableMenu priorMenu)
- {
- MenuClosed.Invoke(null, new EventArgsClickableMenuClosed(priorMenu));
- }
- }
+using System; +using StardewValley.Menus; + +namespace StardewModdingAPI.Events +{ + public static class MenuEvents + { + public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { }; + public static event EventHandler<EventArgsClickableMenuClosed> MenuClosed = delegate { }; + + internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu) + { + MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu)); + } + + internal static void InvokeMenuClosed(IClickableMenu priorMenu) + { + MenuClosed.Invoke(null, new EventArgsClickableMenuClosed(priorMenu)); + } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Mine.cs b/src/StardewModdingAPI/Events/MineEvents.cs index 55514d42..b9c3070c 100644 --- a/src/StardewModdingAPI/Events/Mine.cs +++ b/src/StardewModdingAPI/Events/MineEvents.cs @@ -1,14 +1,14 @@ -using System;
-
-namespace StardewModdingAPI.Events
-{
- public static class MineEvents
- {
- public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged = delegate { };
-
- internal static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
- {
- MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMinelevel, currentMineLevel));
- }
- }
+using System; + +namespace StardewModdingAPI.Events +{ + public static class MineEvents + { + public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged = delegate { }; + + internal static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel) + { + MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMinelevel, currentMineLevel)); + } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Player.cs b/src/StardewModdingAPI/Events/PlayerEvents.cs index 22f572b7..910f3c96 100644 --- a/src/StardewModdingAPI/Events/Player.cs +++ b/src/StardewModdingAPI/Events/PlayerEvents.cs @@ -1,35 +1,35 @@ -using System;
-using System.Collections.Generic;
-using StardewModdingAPI.Inheritance;
-using StardewValley;
-
-namespace StardewModdingAPI.Events
-{
- public static class PlayerEvents
- {
- public static event EventHandler<EventArgsFarmerChanged> FarmerChanged = delegate { };
- public static event EventHandler<EventArgsInventoryChanged> InventoryChanged = delegate { };
- public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { };
- public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
-
- internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
- {
- FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
- }
-
- internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
- {
- InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
- }
-
- internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
- {
- LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
- }
-
- internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
- {
- LoadedGame.Invoke(null, loaded);
- }
- }
+using System; +using System.Collections.Generic; +using StardewModdingAPI.Inheritance; +using StardewValley; + +namespace StardewModdingAPI.Events +{ + public static class PlayerEvents + { + public static event EventHandler<EventArgsFarmerChanged> FarmerChanged = delegate { }; + public static event EventHandler<EventArgsInventoryChanged> InventoryChanged = delegate { }; + public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { }; + public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { }; + + internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer) + { + FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer)); + } + + internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems) + { + InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems)); + } + + internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel) + { + LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel)); + } + + internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded) + { + LoadedGame.Invoke(null, loaded); + } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/Time.cs b/src/StardewModdingAPI/Events/TimeEvents.cs index 39ca642a..42fa6ce2 100644 --- a/src/StardewModdingAPI/Events/Time.cs +++ b/src/StardewModdingAPI/Events/TimeEvents.cs @@ -1,42 +1,42 @@ -using System;
-
-namespace StardewModdingAPI.Events
-{
- public static class TimeEvents
- {
- public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged = delegate { };
- public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged = delegate { };
- public static event EventHandler<EventArgsIntChanged> YearOfGameChanged = delegate { };
- public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged = delegate { };
-
- /// <summary>
- /// Occurs when Game1.newDay changes. True directly before saving, and False directly after.
- /// </summary>
- public static event EventHandler<EventArgsNewDay> OnNewDay = delegate { };
-
- internal static void InvokeTimeOfDayChanged(int priorInt, int newInt)
- {
- TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
- }
-
- internal static void InvokeDayOfMonthChanged(int priorInt, int newInt)
- {
- DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
- }
-
- internal static void InvokeYearOfGameChanged(int priorInt, int newInt)
- {
- YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
- }
-
- internal static void InvokeSeasonOfYearChanged(string priorString, string newString)
- {
- SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
- }
-
- internal static void InvokeOnNewDay(int priorInt, int newInt, bool newDay)
- {
- OnNewDay.Invoke(null, new EventArgsNewDay(priorInt, newInt, newDay));
- }
- }
+using System; + +namespace StardewModdingAPI.Events +{ + public static class TimeEvents + { + public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged = delegate { }; + public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged = delegate { }; + public static event EventHandler<EventArgsIntChanged> YearOfGameChanged = delegate { }; + public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged = delegate { }; + + /// <summary> + /// Occurs when Game1.newDay changes. True directly before saving, and False directly after. + /// </summary> + public static event EventHandler<EventArgsNewDay> OnNewDay = delegate { }; + + internal static void InvokeTimeOfDayChanged(int priorInt, int newInt) + { + TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt)); + } + + internal static void InvokeDayOfMonthChanged(int priorInt, int newInt) + { + DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt)); + } + + internal static void InvokeYearOfGameChanged(int priorInt, int newInt) + { + YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt)); + } + + internal static void InvokeSeasonOfYearChanged(string priorString, string newString) + { + SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString)); + } + + internal static void InvokeOnNewDay(int priorInt, int newInt, bool newDay) + { + OnNewDay.Invoke(null, new EventArgsNewDay(priorInt, newInt, newDay)); + } + } }
\ No newline at end of file |