diff options
| author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-10-31 14:48:23 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-10-31 14:48:23 -0400 |
| commit | 7fe85119219c17d459fd5a373916dafff7b4e2a2 (patch) | |
| tree | 85e17035489dbeeb1ea5d44d18b7e868cfb93754 | |
| parent | d9adaf73869ce768686301ef30687a5fc18048a0 (diff) | |
| download | SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.tar.gz SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.tar.bz2 SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.zip | |
document & format event code
30 files changed, 816 insertions, 309 deletions
diff --git a/src/StardewModdingAPI.sln.DotSettings b/src/StardewModdingAPI.sln.DotSettings new file mode 100644 index 00000000..734205d2 --- /dev/null +++ b/src/StardewModdingAPI.sln.DotSettings @@ -0,0 +1,7 @@ +<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> + <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/StaticQualifier/STATIC_MEMBERS_QUALIFY_MEMBERS/@EntryValue">Field, Property, Event, Method</s:String> + <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">Field, Property, Event, Method</s:String> + <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean> + <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean> + <s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseVarWhenEvident</s:String> + <s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String></wpf:ResourceDictionary>
\ No newline at end of file diff --git a/src/StardewModdingAPI/Events/ControlEvents.cs b/src/StardewModdingAPI/Events/ControlEvents.cs index cb597cf1..8fb9061d 100644 --- a/src/StardewModdingAPI/Events/ControlEvents.cs +++ b/src/StardewModdingAPI/Events/ControlEvents.cs @@ -4,55 +4,102 @@ using Microsoft.Xna.Framework.Input; namespace StardewModdingAPI.Events { + /// <summary>Events raised when the player uses a controller, keyboard, or mouse.</summary> public static class ControlEvents { + /********* + ** Events + *********/ + /// <summary>Raised when the <see cref="KeyboardState"/> changes. That happens when the player presses or releases a key.</summary> public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged = delegate { }; + + /// <summary>Raised when the player presses a keyboard key.</summary> public static event EventHandler<EventArgsKeyPressed> KeyPressed = delegate { }; + + /// <summary>Raised when the player releases a keyboard key.</summary> public static event EventHandler<EventArgsKeyPressed> KeyReleased = delegate { }; + + /// <summary>Raised when the <see cref="MouseState"/> changes. That happens when the player moves the mouse, scrolls the mouse wheel, or presses/releases a button.</summary> public static event EventHandler<EventArgsMouseStateChanged> MouseChanged = delegate { }; + + /// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary> public static event EventHandler<EventArgsControllerButtonPressed> ControllerButtonPressed = delegate { }; + + /// <summary>The player released a controller button. This event isn't raised for trigger buttons.</summary> public static event EventHandler<EventArgsControllerButtonReleased> ControllerButtonReleased = delegate { }; + + /// <summary>The player pressed a controller trigger button.</summary> public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { }; + + /// <summary>The player released a controller trigger button.</summary> public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { }; + + /********* + ** Internal methods + *********/ + /// <summary>Raise a <see cref="KeyboardChanged"/> event.</summary> + /// <param name="priorState">The previous keyboard state.</param> + /// <param name="newState">The current keyboard state.</param> internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState) { - KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState)); + ControlEvents.KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState)); } + /// <summary>Raise a <see cref="MouseChanged"/> event.</summary> + /// <param name="priorState">The previous mouse state.</param> + /// <param name="newState">The current mouse state.</param> internal static void InvokeMouseChanged(MouseState priorState, MouseState newState) { - MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState)); + ControlEvents.MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState)); } + /// <summary>Raise a <see cref="KeyPressed"/> event.</summary> + /// <param name="key">The keyboard button that was pressed.</param> internal static void InvokeKeyPressed(Keys key) { - KeyPressed.Invoke(null, new EventArgsKeyPressed(key)); + ControlEvents.KeyPressed.Invoke(null, new EventArgsKeyPressed(key)); } + /// <summary>Raise a <see cref="KeyReleased"/> event.</summary> + /// <param name="key">The keyboard button that was released.</param> internal static void InvokeKeyReleased(Keys key) { - KeyReleased.Invoke(null, new EventArgsKeyPressed(key)); + ControlEvents.KeyReleased.Invoke(null, new EventArgsKeyPressed(key)); } - internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons) + /// <summary>Raise a <see cref="ControllerButtonPressed"/> event.</summary> + /// <param name="playerIndex">The player who pressed the button.</param> + /// <param name="button">The controller button that was pressed.</param> + internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons button) { - ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons)); + ControlEvents.ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, button)); } - internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons) + /// <summary>Raise a <see cref="ControllerButtonReleased"/> event.</summary> + /// <param name="playerIndex">The player who released the button.</param> + /// <param name="button">The controller button that was released.</param> + internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons button) { - ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons)); + ControlEvents.ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, button)); } - internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value) + /// <summary>Raise a <see cref="ControllerTriggerPressed"/> event.</summary> + /// <param name="playerIndex">The player who pressed the trigger button.</param> + /// <param name="button">The trigger button that was pressed.</param> + /// <param name="value">The current trigger value.</param> + internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons button, float value) { - ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value)); + ControlEvents.ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, button, value)); } - internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value) + /// <summary>Raise a <see cref="ControllerTriggerReleased"/> event.</summary> + /// <param name="playerIndex">The player who pressed the trigger button.</param> + /// <param name="button">The trigger button that was pressed.</param> + /// <param name="value">The current trigger value.</param> + internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons button, float value) { - ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value)); + ControlEvents.ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, button, value)); } } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs index 6765c8da..708c02e0 100644 --- a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs +++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs @@ -3,15 +3,29 @@ using StardewValley.Menus; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="MenuEvents.MenuChanged"/> event.</summary> public class EventArgsClickableMenuChanged : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The previous menu.</summary> + public IClickableMenu NewMenu { get; private set; } + + /// <summary>The current menu.</summary> + public IClickableMenu PriorMenu { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="priorMenu">The previous menu.</param> + /// <param name="newMenu">The current menu.</param> public EventArgsClickableMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu) { - NewMenu = newMenu; - PriorMenu = priorMenu; + this.NewMenu = newMenu; + this.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 index bdf44285..1a62432f 100644 --- a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs +++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs @@ -3,13 +3,24 @@ using StardewValley.Menus; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="MenuEvents.MenuClosed"/> event.</summary> public class EventArgsClickableMenuClosed : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The menu that was closed.</summary> + public IClickableMenu PriorMenu { get; private set; } + + + /********* + ** Accessors + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="priorMenu">The menu that was closed.</param> public EventArgsClickableMenuClosed(IClickableMenu priorMenu) { - PriorMenu = priorMenu; + this.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 index fd2d4a51..ddf644fb 100644 --- a/src/StardewModdingAPI/Events/EventArgsCommand.cs +++ b/src/StardewModdingAPI/Events/EventArgsCommand.cs @@ -2,13 +2,24 @@ namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="StardewModdingAPI.Command.CommandFired"/> event.</summary> public class EventArgsCommand : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The triggered command.</summary> + public Command Command { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="command">The triggered command.</param> public EventArgsCommand(Command command) { - Command = command; + this.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 index b51a8a5b..87c96678 100644 --- a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs +++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs @@ -4,15 +4,29 @@ using Microsoft.Xna.Framework.Input; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonPressed"/> event.</summary> public class EventArgsControllerButtonPressed : EventArgs { - public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons buttonPressed) - { - PlayerIndex = playerIndex; - ButtonPressed = buttonPressed; - } - + /********* + ** Accessors + *********/ + /// <summary>The player who pressed the button.</summary> public PlayerIndex PlayerIndex { get; private set; } + + /// <summary>The controller button that was pressed.</summary> public Buttons ButtonPressed { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="playerIndex">The player who pressed the button.</param> + /// <param name="button">The controller button that was pressed.</param> + public EventArgsControllerButtonPressed(PlayerIndex playerIndex, Buttons button) + { + this.PlayerIndex = playerIndex; + this.ButtonPressed = button; + } } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs index 0164b8d6..cb53b545 100644 --- a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs +++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs @@ -4,15 +4,29 @@ using Microsoft.Xna.Framework.Input; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="ControlEvents.ControllerButtonReleased"/> event.</summary> public class EventArgsControllerButtonReleased : EventArgs { - public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons buttonReleased) - { - PlayerIndex = playerIndex; - ButtonReleased = buttonReleased; - } - + /********* + ** Accessors + *********/ + /// <summary>The player who pressed the button.</summary> public PlayerIndex PlayerIndex { get; private set; } + + /// <summary>The controller button that was pressed.</summary> public Buttons ButtonReleased { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="playerIndex">The player who pressed the button.</param> + /// <param name="button">The controller button that was released.</param> + public EventArgsControllerButtonReleased(PlayerIndex playerIndex, Buttons button) + { + this.PlayerIndex = playerIndex; + this.ButtonReleased = button; + } } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs index 1bf4fa46..72b73040 100644 --- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs +++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs @@ -4,17 +4,34 @@ using Microsoft.Xna.Framework.Input; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerPressed"/> event.</summary> public class EventArgsControllerTriggerPressed : EventArgs { - public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons buttonPressed, float value) - { - PlayerIndex = playerIndex; - ButtonPressed = buttonPressed; - Value = value; - } - + /********* + ** Accessors + *********/ + /// <summary>The player who pressed the button.</summary> public PlayerIndex PlayerIndex { get; private set; } + + /// <summary>The controller button that was pressed.</summary> public Buttons ButtonPressed { get; private set; } + + /// <summary>The current trigger value.</summary> public float Value { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="playerIndex">The player who pressed the trigger button.</param> + /// <param name="button">The trigger button that was pressed.</param> + /// <param name="value">The current trigger value.</param> + public EventArgsControllerTriggerPressed(PlayerIndex playerIndex, Buttons button, float value) + { + this.PlayerIndex = playerIndex; + this.ButtonPressed = button; + this.Value = value; + } } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs index 07a4bcb1..de28a159 100644 --- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs +++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs @@ -4,17 +4,34 @@ using Microsoft.Xna.Framework.Input; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="ControlEvents.ControllerTriggerReleased"/> event.</summary> public class EventArgsControllerTriggerReleased : EventArgs { - public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons buttonReleased, float value) - { - PlayerIndex = playerIndex; - ButtonReleased = buttonReleased; - Value = value; - } - + /********* + ** Accessors + *********/ + /// <summary>The player who pressed the button.</summary> public PlayerIndex PlayerIndex { get; private set; } + + /// <summary>The controller button that was released.</summary> public Buttons ButtonReleased { get; private set; } + + /// <summary>The current trigger value.</summary> public float Value { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="playerIndex">The player who pressed the trigger button.</param> + /// <param name="button">The trigger button that was released.</param> + /// <param name="value">The current trigger value.</param> + public EventArgsControllerTriggerReleased(PlayerIndex playerIndex, Buttons button, float value) + { + this.PlayerIndex = playerIndex; + this.ButtonReleased = button; + this.Value = value; + } } -}
\ No newline at end of file +} diff --git a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs index 53ed1551..443429aa 100644 --- a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs +++ b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs @@ -3,15 +3,29 @@ using StardewValley; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="LocationEvents.CurrentLocationChanged"/> event.</summary> public class EventArgsCurrentLocationChanged : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The player's previous location.</summary> + public GameLocation NewLocation { get; private set; } + + /// <summary>The player's current location.</summary> + public GameLocation PriorLocation { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="priorLocation">The player's previous location.</param> + /// <param name="newLocation">The player's current location.</param> public EventArgsCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation) { - NewLocation = newLocation; - PriorLocation = priorLocation; + this.NewLocation = newLocation; + this.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 index 468d18ee..ba8794b7 100644 --- a/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs +++ b/src/StardewModdingAPI/Events/EventArgsFarmerChanged.cs @@ -3,15 +3,29 @@ using StardewValley; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="PlayerEvents.FarmerChanged"/> event.</summary> public class EventArgsFarmerChanged : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The previous player character.</summary> + public Farmer NewFarmer { get; } + + /// <summary>The new player character.</summary> + public Farmer PriorFarmer { get; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="priorFarmer">The previous player character.</param> + /// <param name="newFarmer">The new player character.</param> public EventArgsFarmerChanged(Farmer priorFarmer, Farmer newFarmer) { - NewFarmer = NewFarmer; - PriorFarmer = PriorFarmer; + this.NewFarmer = NewFarmer; + this.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 index 6a55c87a..c68951ce 100644 --- a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs +++ b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs @@ -4,13 +4,24 @@ using StardewValley; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="LocationEvents.LocationsChanged"/> event.</summary> public class EventArgsGameLocationsChanged : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The current list of game locations.</summary> + public List<GameLocation> NewLocations { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="newLocations">The current list of game locations.</param> public EventArgsGameLocationsChanged(List<GameLocation> newLocations) { - NewLocations = newLocations; + this.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 index c8a6e86d..0ccb9b87 100644 --- a/src/StardewModdingAPI/Events/EventArgsIntChanged.cs +++ b/src/StardewModdingAPI/Events/EventArgsIntChanged.cs @@ -2,15 +2,29 @@ namespace StardewModdingAPI.Events { + /// <summary>Event arguments for an integer field that changed value.</summary> public class EventArgsIntChanged : EventArgs { + /********* + ** Accessors + *********/ + /// <summary>The previous value.</summary> + public int NewInt { get; } + + /// <summary>The current value.</summary> + public int PriorInt { get; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="priorInt">The previous value.</param> + /// <param name="newInt">The current value.</param> public EventArgsIntChanged(int priorInt, int newInt) { - NewInt = NewInt; - PriorInt = PriorInt; + this.NewInt = NewInt; + this.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 index fa929ab5..40c77419 100644 --- a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs +++ b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs @@ -6,19 +6,37 @@ using StardewValley; namespace StardewModdingAPI.Events { + /// <summary>Event arguments for a <see cref="PlayerEvents.InventoryChanged"/> event.</summary> 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(); - } - + /********* + ** Accessors + *********/ + /// <summary>The player's inventory.</summary> public List<Item> Inventory { get; private set; } + + /// <summary>The added items.</summary> public List<ItemStackChange> Added { get; private set; } + + /// <summary>The removed items.</summary> public List<ItemStackChange> Removed { get; private set; } + + /// <summary>The items whose stack sizes changed.</summary> public List<ItemStackChange> QuantityChanged { get; private set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="inventory">The player's inventory.</param> + /// <param name="changedItems">The inventory changes.</param> + public EventArgsInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems) + { + this.Inventory = inventory; + this.Added = changedItems.Where(n => n.ChangeType == ChangeType.Added).ToList(); + |
