Refactored all of the events into their own categories
This commit is contained in:
parent
ec81b3306e
commit
afef5648ca
|
@ -33,8 +33,21 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
||||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
||||||
<Reference Include="Mono.Cecil">
|
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>Z:\Games\Stardew Valley\Mono.Cecil.dll</HintPath>
|
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
@ -65,8 +78,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>mkdir "$(SolutionDir)Release\Mods\"
|
<PostBuildEvent>
|
||||||
copy /y "$(SolutionDir)$(ProjectName)\$(OutDir)$(TargetFileName)" "$(SolutionDir)Release\Mods\"</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Mono.Cecil" version="0.9.6.0" targetFramework="net40" />
|
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using StardewModdingAPI.Events;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
|
@ -1,153 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Xna.Framework.Input;
|
|
||||||
using StardewValley;
|
|
||||||
using StardewValley.Menus;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
|
|
||||||
namespace StardewModdingAPI
|
|
||||||
{
|
|
||||||
public static class Events
|
|
||||||
{
|
|
||||||
public static event EventHandler GameLoaded = delegate { };
|
|
||||||
public static event EventHandler Initialize = delegate { };
|
|
||||||
public static event EventHandler LoadContent = delegate { };
|
|
||||||
public static event EventHandler UpdateTick = delegate { };
|
|
||||||
public static event EventHandler DrawTick = delegate { };
|
|
||||||
|
|
||||||
public static event EventHandler<EventArgsKeyboardStateChanged> KeyboardChanged = delegate { };
|
|
||||||
public static event EventHandler<EventArgsKeyPressed> KeyPressed = delegate { };
|
|
||||||
public static event EventHandler<EventArgsMouseStateChanged> MouseChanged = delegate { };
|
|
||||||
public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
|
|
||||||
public static event EventHandler<EventArgsGameLocationsChanged> LocationsChanged = delegate { };
|
|
||||||
public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { };
|
|
||||||
public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
|
|
||||||
public static event EventHandler Resize = delegate { };
|
|
||||||
public static event EventHandler<EventArgsFarmerChanged> FarmerChanged = delegate { };
|
|
||||||
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 { };
|
|
||||||
|
|
||||||
public static void InvokeGameLoaded()
|
|
||||||
{
|
|
||||||
GameLoaded.Invoke(null, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeInitialize()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Initialize.Invoke(null, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Program.LogError("An exception occured in XNA Initialize: " + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeLoadContent()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadContent.Invoke(null, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Program.LogError("An exception occured in XNA LoadContent: " + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeUpdateTick()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateTick.Invoke(null, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Program.LogError("An exception occured in XNA UpdateTick: " + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeDrawTick()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DrawTick.Invoke(null, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Program.LogError("An exception occured in XNA DrawTick: " + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
|
|
||||||
{
|
|
||||||
KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeMouseChanged(MouseState priorState, MouseState newState)
|
|
||||||
{
|
|
||||||
MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeKeyPressed(Keys key)
|
|
||||||
{
|
|
||||||
KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
|
|
||||||
{
|
|
||||||
MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeLocationsChanged(List<GameLocation> newLocations)
|
|
||||||
{
|
|
||||||
LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
|
|
||||||
{
|
|
||||||
CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeResize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Resize.Invoke(sender, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
|
|
||||||
{
|
|
||||||
FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeTimeOfDayChanged(Int32 priorInt, Int32 newInt)
|
|
||||||
{
|
|
||||||
TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeDayOfMonthChanged(Int32 priorInt, Int32 newInt)
|
|
||||||
{
|
|
||||||
DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeYearOfGameChanged(Int32 priorInt, Int32 newInt)
|
|
||||||
{
|
|
||||||
YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InvokeSeasonOfYearChanged(String priorString, String newString)
|
|
||||||
{
|
|
||||||
SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void InvokeOnNewLocationObject(SerializableDictionary<Vector2, StardewValley.Object> newObjects)
|
|
||||||
{
|
|
||||||
LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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<EventArgsMouseStateChanged> MouseChanged = delegate { };
|
||||||
|
|
||||||
|
public static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
|
||||||
|
{
|
||||||
|
KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeMouseChanged(MouseState priorState, MouseState newState)
|
||||||
|
{
|
||||||
|
MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeKeyPressed(Keys key)
|
||||||
|
{
|
||||||
|
KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StardewModdingAPI
|
namespace StardewModdingAPI.Events
|
||||||
{
|
{
|
||||||
public class EventArgsKeyboardStateChanged : EventArgs
|
public class EventArgsKeyboardStateChanged : EventArgs
|
||||||
{
|
{
|
|
@ -0,0 +1,57 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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 UpdateTick = delegate { };
|
||||||
|
|
||||||
|
public static void InvokeGameLoaded()
|
||||||
|
{
|
||||||
|
GameLoaded.Invoke(null, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeInitialize()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Initialize.Invoke(null, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Program.LogError("An exception occured in XNA Initialize: " + ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeLoadContent()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadContent.Invoke(null, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Program.LogError("An exception occured in XNA LoadContent: " + ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeUpdateTick()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UpdateTick.Invoke(null, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Program.LogError("An exception occured in XNA UpdateTick: " + ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StardewModdingAPI.Events
|
||||||
|
{
|
||||||
|
public static class GraphicsEvents
|
||||||
|
{
|
||||||
|
public static event EventHandler Resize = delegate { };
|
||||||
|
public static event EventHandler DrawTick = delegate { };
|
||||||
|
|
||||||
|
public static void InvokeDrawTick()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DrawTick.Invoke(null, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Program.LogError("An exception occured in XNA DrawTick: " + ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeResize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Resize.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using StardewValley;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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 { };
|
||||||
|
|
||||||
|
public static void InvokeLocationsChanged(List<GameLocation> newLocations)
|
||||||
|
{
|
||||||
|
LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
|
||||||
|
{
|
||||||
|
CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void InvokeOnNewLocationObject(SerializableDictionary<Vector2, StardewValley.Object> newObjects)
|
||||||
|
{
|
||||||
|
LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using StardewValley.Menus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StardewModdingAPI.Events
|
||||||
|
{
|
||||||
|
public static class MenuEvents
|
||||||
|
{
|
||||||
|
public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
|
||||||
|
|
||||||
|
public static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
|
||||||
|
{
|
||||||
|
MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StardewModdingAPI.Events
|
||||||
|
{
|
||||||
|
public static class MineEvents
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using StardewValley;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StardewModdingAPI.Events
|
||||||
|
{
|
||||||
|
public static class PlayerEvents
|
||||||
|
{
|
||||||
|
public static event EventHandler<EventArgsFarmerChanged> FarmerChanged = delegate { };
|
||||||
|
|
||||||
|
public static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
|
||||||
|
{
|
||||||
|
FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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 { };
|
||||||
|
|
||||||
|
public static void InvokeTimeOfDayChanged(Int32 priorInt, Int32 newInt)
|
||||||
|
{
|
||||||
|
TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeDayOfMonthChanged(Int32 priorInt, Int32 newInt)
|
||||||
|
{
|
||||||
|
DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeYearOfGameChanged(Int32 priorInt, Int32 newInt)
|
||||||
|
{
|
||||||
|
YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InvokeSeasonOfYearChanged(String priorString, String newString)
|
||||||
|
{
|
||||||
|
SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -100,14 +100,14 @@ namespace StardewModdingAPI.Inheritance
|
||||||
ModItems = new Dictionary<Int32, SObject>();
|
ModItems = new Dictionary<Int32, SObject>();
|
||||||
PreviouslyPressedKeys = new Keys[0];
|
PreviouslyPressedKeys = new Keys[0];
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Events.InvokeInitialize();
|
Events.GameEvents.InvokeInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadContent()
|
protected override void LoadContent()
|
||||||
{
|
{
|
||||||
Program.Log("XNA LoadContent");
|
Program.Log("XNA LoadContent");
|
||||||
base.LoadContent();
|
base.LoadContent();
|
||||||
Events.InvokeLoadContent();
|
Events.GameEvents.InvokeLoadContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
|
@ -124,7 +124,7 @@ namespace StardewModdingAPI.Inheritance
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.InvokeUpdateTick();
|
Events.GameEvents.InvokeUpdateTick();
|
||||||
|
|
||||||
PreviouslyPressedKeys = CurrentlyPressedKeys;
|
PreviouslyPressedKeys = CurrentlyPressedKeys;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ namespace StardewModdingAPI.Inheritance
|
||||||
protected override void Draw(GameTime gameTime)
|
protected override void Draw(GameTime gameTime)
|
||||||
{
|
{
|
||||||
base.Draw(gameTime);
|
base.Draw(gameTime);
|
||||||
Events.InvokeDrawTick();
|
Events.GraphicsEvents.InvokeDrawTick();
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
|
@ -225,71 +225,71 @@ namespace StardewModdingAPI.Inheritance
|
||||||
MStateNow = Mouse.GetState();
|
MStateNow = Mouse.GetState();
|
||||||
|
|
||||||
foreach (Keys k in FramePressedKeys)
|
foreach (Keys k in FramePressedKeys)
|
||||||
Events.InvokeKeyPressed(k);
|
Events.ControlEvents.InvokeKeyPressed(k);
|
||||||
|
|
||||||
if (KStateNow != KStatePrior)
|
if (KStateNow != KStatePrior)
|
||||||
{
|
{
|
||||||
Events.InvokeKeyboardChanged(KStatePrior, KStateNow);
|
Events.ControlEvents.InvokeKeyboardChanged(KStatePrior, KStateNow);
|
||||||
KStatePrior = KStateNow;
|
KStatePrior = KStateNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MStateNow != MStatePrior)
|
if (MStateNow != MStatePrior)
|
||||||
{
|
{
|
||||||
Events.InvokeMouseChanged(MStatePrior, MStateNow);
|
Events.ControlEvents.InvokeMouseChanged(MStatePrior, MStateNow);
|
||||||
MStatePrior = MStateNow;
|
MStatePrior = MStateNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeClickableMenu != null && activeClickableMenu != PreviousActiveMenu)
|
if (activeClickableMenu != null && activeClickableMenu != PreviousActiveMenu)
|
||||||
{
|
{
|
||||||
Events.InvokeMenuChanged(PreviousActiveMenu, activeClickableMenu);
|
Events.MenuEvents.InvokeMenuChanged(PreviousActiveMenu, activeClickableMenu);
|
||||||
PreviousActiveMenu = activeClickableMenu;
|
PreviousActiveMenu = activeClickableMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locations.GetHash() != PreviousGameLocations)
|
if (locations.GetHash() != PreviousGameLocations)
|
||||||
{
|
{
|
||||||
Events.InvokeLocationsChanged(locations);
|
Events.LocationEvents.InvokeLocationsChanged(locations);
|
||||||
PreviousGameLocations = locations.GetHash();
|
PreviousGameLocations = locations.GetHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentLocation != PreviousGameLocation)
|
if (currentLocation != PreviousGameLocation)
|
||||||
{
|
{
|
||||||
Events.InvokeCurrentLocationChanged(PreviousGameLocation, currentLocation);
|
Events.LocationEvents.InvokeCurrentLocationChanged(PreviousGameLocation, currentLocation);
|
||||||
PreviousGameLocation = currentLocation;
|
PreviousGameLocation = currentLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != null && player != PreviousFarmer)
|
if (player != null && player != PreviousFarmer)
|
||||||
{
|
{
|
||||||
Events.InvokeFarmerChanged(PreviousFarmer, player);
|
Events.PlayerEvents.InvokeFarmerChanged(PreviousFarmer, player);
|
||||||
PreviousFarmer = player;
|
PreviousFarmer = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentLocation != null && PreviousLocationObjects != currentLocation.objects.GetHash())
|
if(currentLocation != null && PreviousLocationObjects != currentLocation.objects.GetHash())
|
||||||
{
|
{
|
||||||
Events.InvokeOnNewLocationObject(currentLocation.objects);
|
Events.LocationEvents.InvokeOnNewLocationObject(currentLocation.objects);
|
||||||
PreviousLocationObjects = currentLocation.objects.GetHash();
|
PreviousLocationObjects = currentLocation.objects.GetHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeOfDay != PreviousTimeOfDay)
|
if (timeOfDay != PreviousTimeOfDay)
|
||||||
{
|
{
|
||||||
Events.InvokeTimeOfDayChanged(PreviousTimeOfDay, timeOfDay);
|
Events.TimeEvents.InvokeTimeOfDayChanged(PreviousTimeOfDay, timeOfDay);
|
||||||
PreviousTimeOfDay = timeOfDay;
|
PreviousTimeOfDay = timeOfDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dayOfMonth != PreviousDayOfMonth)
|
if (dayOfMonth != PreviousDayOfMonth)
|
||||||
{
|
{
|
||||||
Events.InvokeDayOfMonthChanged(PreviousDayOfMonth, dayOfMonth);
|
Events.TimeEvents.InvokeDayOfMonthChanged(PreviousDayOfMonth, dayOfMonth);
|
||||||
PreviousDayOfMonth = dayOfMonth;
|
PreviousDayOfMonth = dayOfMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentSeason != PreviousSeasonOfYear)
|
if (currentSeason != PreviousSeasonOfYear)
|
||||||
{
|
{
|
||||||
Events.InvokeSeasonOfYearChanged(PreviousSeasonOfYear, currentSeason);
|
Events.TimeEvents.InvokeSeasonOfYearChanged(PreviousSeasonOfYear, currentSeason);
|
||||||
PreviousSeasonOfYear = currentSeason;
|
PreviousSeasonOfYear = currentSeason;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (year != PreviousYearOfGame)
|
if (year != PreviousYearOfGame)
|
||||||
{
|
{
|
||||||
Events.InvokeYearOfGameChanged(PreviousYearOfGame, year);
|
Events.TimeEvents.InvokeYearOfGameChanged(PreviousYearOfGame, year);
|
||||||
PreviousYearOfGame = year;
|
PreviousYearOfGame = year;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ using StardewValley.Network;
|
||||||
using StardewValley.Tools;
|
using StardewValley.Tools;
|
||||||
using Keys = Microsoft.Xna.Framework.Input.Keys;
|
using Keys = Microsoft.Xna.Framework.Input.Keys;
|
||||||
using Object = StardewValley.Object;
|
using Object = StardewValley.Object;
|
||||||
|
using StardewModdingAPI.Events;
|
||||||
|
|
||||||
namespace StardewModdingAPI
|
namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
|
@ -249,8 +250,8 @@ namespace StardewModdingAPI
|
||||||
//Command.RegisterCommand("crash", "crashes sdv").CommandFired += delegate { Game1.player.draw(null); };
|
//Command.RegisterCommand("crash", "crashes sdv").CommandFired += delegate { Game1.player.draw(null); };
|
||||||
|
|
||||||
//Subscribe to events
|
//Subscribe to events
|
||||||
Events.KeyPressed += Events_KeyPressed;
|
Events.ControlEvents.KeyPressed += Events_KeyPressed;
|
||||||
Events.LoadContent += Events_LoadContent;
|
Events.GameEvents.LoadContent += Events_LoadContent;
|
||||||
//Events.MenuChanged += Events_MenuChanged; //Idk right now
|
//Events.MenuChanged += Events_MenuChanged; //Idk right now
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
@ -265,12 +266,12 @@ namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
gamePtr.IsMouseVisible = false;
|
gamePtr.IsMouseVisible = false;
|
||||||
gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version;
|
gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version;
|
||||||
StardewForm.Resize += Events.InvokeResize;
|
StardewForm.Resize += Events.GraphicsEvents.InvokeResize;
|
||||||
});
|
});
|
||||||
|
|
||||||
//Game's in memory now, send the event
|
//Game's in memory now, send the event
|
||||||
LogInfo("Game Loaded");
|
LogInfo("Game Loaded");
|
||||||
Events.InvokeGameLoaded();
|
Events.GameEvents.InvokeGameLoaded();
|
||||||
|
|
||||||
LogColour(ConsoleColor.Cyan, "Type 'help' for help, or 'help <cmd>' for a command's usage");
|
LogColour(ConsoleColor.Cyan, "Type 'help' for help, or 'help <cmd>' for a command's usage");
|
||||||
//Begin listening to input
|
//Begin listening to input
|
||||||
|
|
|
@ -78,8 +78,15 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Command.cs" />
|
<Compile Include="Command.cs" />
|
||||||
<Compile Include="EventArgs.cs" />
|
<Compile Include="Events\Controls.cs" />
|
||||||
<Compile Include="Events.cs" />
|
<Compile Include="Events\EventArgs.cs" />
|
||||||
|
<Compile Include="Events\Game.cs" />
|
||||||
|
<Compile Include="Events\Graphics.cs" />
|
||||||
|
<Compile Include="Events\Location.cs" />
|
||||||
|
<Compile Include="Events\Menu.cs" />
|
||||||
|
<Compile Include="Events\Mine.cs" />
|
||||||
|
<Compile Include="Events\Player.cs" />
|
||||||
|
<Compile Include="Events\Time.cs" />
|
||||||
<Compile Include="Extensions.cs" />
|
<Compile Include="Extensions.cs" />
|
||||||
<Compile Include="Inheritance\Menus\SBobberBar.cs" />
|
<Compile Include="Inheritance\Menus\SBobberBar.cs" />
|
||||||
<Compile Include="Inheritance\Menus\SGameMenu.cs" />
|
<Compile Include="Inheritance\Menus\SGameMenu.cs" />
|
||||||
|
@ -102,7 +109,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy /y "$(SolutionDir)$(ProjectName)\$(OutDir)StardewModdingAPI.exe" "$(SolutionDir)Release\"</PostBuildEvent>
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -10,6 +10,7 @@ using StardewValley;
|
||||||
using StardewValley.Tools;
|
using StardewValley.Tools;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using StardewValley.Objects;
|
using StardewValley.Objects;
|
||||||
|
using StardewModdingAPI.Events;
|
||||||
|
|
||||||
namespace TrainerMod
|
namespace TrainerMod
|
||||||
{
|
{
|
||||||
|
@ -41,7 +42,7 @@ namespace TrainerMod
|
||||||
public override void Entry(params object[] objects)
|
public override void Entry(params object[] objects)
|
||||||
{
|
{
|
||||||
RegisterCommands();
|
RegisterCommands();
|
||||||
Events.UpdateTick += Events_UpdateTick;
|
GameEvents.UpdateTick += Events_UpdateTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Events_UpdateTick(object sender, EventArgs e)
|
static void Events_UpdateTick(object sender, EventArgs e)
|
||||||
|
|
|
@ -64,8 +64,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>mkdir "$(SolutionDir)Release\Mods\"
|
<PostBuildEvent>
|
||||||
copy /y "$(SolutionDir)$(ProjectName)\$(OutDir)TrainerMod.dll" "$(SolutionDir)Release\Mods\"</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
Loading…
Reference in New Issue