invocations are now internal

This commit is contained in:
Zoryn Aaron 2016-03-27 05:05:36 -04:00
parent 668b6b10b5
commit 2cce7c2d27
9 changed files with 68 additions and 55 deletions

View File

@ -15,42 +15,42 @@ namespace StardewModdingAPI.Events
public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { };
public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { };
public static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
{
KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
}
public static void InvokeMouseChanged(MouseState priorState, MouseState newState)
internal static void InvokeMouseChanged(MouseState priorState, MouseState newState)
{
MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
}
public static void InvokeKeyPressed(Keys key)
internal static void InvokeKeyPressed(Keys key)
{
KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
}
public static void InvokeKeyReleased(Keys key)
internal static void InvokeKeyReleased(Keys key)
{
KeyReleased.Invoke(null, new EventArgsKeyPressed(key));
}
public static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
{
ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons));
}
public static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
{
ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons));
}
public static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
{
ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value));
}
public static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
{
ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value));
}

View File

@ -236,6 +236,19 @@ namespace StardewModdingAPI.Events
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
{

View File

@ -44,12 +44,12 @@ namespace StardewModdingAPI.Events
/// </summary>
public static event EventHandler OneSecondTick = delegate { };
public static void InvokeGameLoaded()
internal static void InvokeGameLoaded()
{
GameLoaded.Invoke(null, EventArgs.Empty);
}
public static void InvokeInitialize()
internal static void InvokeInitialize()
{
try
{
@ -61,7 +61,7 @@ namespace StardewModdingAPI.Events
}
}
public static void InvokeLoadContent()
internal static void InvokeLoadContent()
{
try
{
@ -73,7 +73,7 @@ namespace StardewModdingAPI.Events
}
}
public static void InvokeUpdateTick()
internal static void InvokeUpdateTick()
{
try
{
@ -85,37 +85,37 @@ namespace StardewModdingAPI.Events
}
}
public static void InvokeSecondUpdateTick()
internal static void InvokeSecondUpdateTick()
{
SecondUpdateTick.Invoke(null, EventArgs.Empty);
}
public static void InvokeFourthUpdateTick()
internal static void InvokeFourthUpdateTick()
{
FourthUpdateTick.Invoke(null, EventArgs.Empty);
}
public static void InvokeEighthUpdateTick()
internal static void InvokeEighthUpdateTick()
{
EighthUpdateTick.Invoke(null, EventArgs.Empty);
}
public static void InvokeQuarterSecondTick()
internal static void InvokeQuarterSecondTick()
{
QuarterSecondTick.Invoke(null, EventArgs.Empty);
}
public static void InvokeHalfSecondTick()
internal static void InvokeHalfSecondTick()
{
HalfSecondTick.Invoke(null, EventArgs.Empty);
}
public static void InvokeOneSecondTick()
internal static void InvokeOneSecondTick()
{
OneSecondTick.Invoke(null, EventArgs.Empty);
}
public static void InvokeFirstUpdateTick()
internal static void InvokeFirstUpdateTick()
{
FirstUpdateTick.Invoke(null, EventArgs.Empty);
}

View File

@ -12,12 +12,12 @@ namespace StardewModdingAPI.Events
public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { };
public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
public static void InvokeLocationsChanged(List<GameLocation> newLocations)
internal static void InvokeLocationsChanged(List<GameLocation> newLocations)
{
LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
}
public static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
{
CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
}

View File

@ -7,7 +7,7 @@ namespace StardewModdingAPI.Events
{
public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
public static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
{
MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
}

View File

@ -6,7 +6,7 @@ namespace StardewModdingAPI.Events
{
public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged = delegate { };
public static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
internal static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
{
MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMinelevel, currentMineLevel));
}

View File

@ -12,22 +12,22 @@ namespace StardewModdingAPI.Events
public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { };
public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
public static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
{
FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
}
public static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
{
InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
}
public static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
{
LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
}
public static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
{
LoadedGame.Invoke(null, loaded);
}

View File

@ -8,31 +8,31 @@ namespace StardewModdingAPI.Events
public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged = delegate { };
public static event EventHandler<EventArgsIntChanged> YearOfGameChanged = delegate { };
public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged = delegate { };
public static event EventHandler OnNewDay = delegate { };
public static event EventHandler<EventArgsNewDay> OnNewDay = delegate { };
public static void InvokeTimeOfDayChanged(int priorInt, int newInt)
internal static void InvokeTimeOfDayChanged(int priorInt, int newInt)
{
TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
}
public static void InvokeDayOfMonthChanged(int priorInt, int newInt)
internal static void InvokeDayOfMonthChanged(int priorInt, int newInt)
{
DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
}
public static void InvokeYearOfGameChanged(int priorInt, int newInt)
internal static void InvokeYearOfGameChanged(int priorInt, int newInt)
{
YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
}
public static void InvokeSeasonOfYearChanged(string priorString, string newString)
internal static void InvokeSeasonOfYearChanged(string priorString, string newString)
{
SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
}
public static void InvokeOnNewDay(int priorInt, int newInt)
internal static void InvokeOnNewDay(int priorInt, int newInt, bool newDay)
{
OnNewDay.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
OnNewDay.Invoke(null, new EventArgsNewDay(priorInt, newInt, newDay));
}
}
}

View File

@ -994,28 +994,28 @@ namespace StardewModdingAPI.Inheritance
}
}
#endregion
}
if (Debug)
{
spriteBatch.Begin();
spriteBatch.DrawString(smoothFont, "FPS: " + FramesPerSecond, Vector2.Zero, BgColour);
spriteBatch.DrawString(smoothFont, "FPS: " + FramesPerSecond, Vector2.Zero, Color.CornflowerBlue);
int i = 1;
while (DebugMessageQueue.Any())
{
string s = DebugMessageQueue.Dequeue();
spriteBatch.DrawString(smoothFont, s, new Vector2(0, i * 12), BgColour);
spriteBatch.DrawString(smoothFont, s, new Vector2(0, i * 12), Color.CornflowerBlue);
i++;
}
GraphicsEvents.InvokeDrawDebug(null, null);
GraphicsEvents.InvokeDrawDebug(null, EventArgs.Empty);
spriteBatch.End();
}
else
{
DebugMessageQueue.Clear();
}
#endregion
}
}
[Obsolete("Do not use at this time.")]
@ -1231,7 +1231,7 @@ namespace StardewModdingAPI.Inheritance
if (PreviousIsNewDay != newDay)
{
TimeEvents.InvokeOnNewDay(PreviousDayOfMonth, dayOfMonth);
TimeEvents.InvokeOnNewDay(PreviousDayOfMonth, dayOfMonth, newDay);
PreviousIsNewDay = newDay;
}
}