Skip to content

Commit 2cce7c2

Browse files
committed
invocations are now internal
1 parent 668b6b1 commit 2cce7c2

File tree

9 files changed

+66
-53
lines changed

9 files changed

+66
-53
lines changed

StardewModdingAPI/Events/Controls.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@ public static class ControlEvents
1515
public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { };
1616
public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { };
1717

18-
public static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
18+
internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
1919
{
2020
KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
2121
}
2222

23-
public static void InvokeMouseChanged(MouseState priorState, MouseState newState)
23+
internal static void InvokeMouseChanged(MouseState priorState, MouseState newState)
2424
{
2525
MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
2626
}
2727

28-
public static void InvokeKeyPressed(Keys key)
28+
internal static void InvokeKeyPressed(Keys key)
2929
{
3030
KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
3131
}
3232

33-
public static void InvokeKeyReleased(Keys key)
33+
internal static void InvokeKeyReleased(Keys key)
3434
{
3535
KeyReleased.Invoke(null, new EventArgsKeyPressed(key));
3636
}
3737

38-
public static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
38+
internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
3939
{
4040
ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons));
4141
}
4242

43-
public static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
43+
internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
4444
{
4545
ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons));
4646
}
4747

48-
public static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
48+
internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
4949
{
5050
ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value));
5151
}
5252

53-
public static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
53+
internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
5454
{
5555
ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value));
5656
}

StardewModdingAPI/Events/EventArgs.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,19 @@ public EventArgsLoadedGameChanged(bool loadedGame)
236236
public bool LoadedGame { get; private set; }
237237
}
238238

239+
public class EventArgsNewDay : EventArgs
240+
{
241+
public EventArgsNewDay(int prevDay, int curDay, bool newDay)
242+
{
243+
PreviousDay = prevDay;
244+
CurrentDay = curDay;
245+
IsNewDay = newDay;
246+
}
247+
248+
public int PreviousDay { get; private set; }
249+
public int CurrentDay { get; private set; }
250+
public bool IsNewDay { get; private set; }
251+
}
239252

240253
public class EventArgsCommand : EventArgs
241254
{

StardewModdingAPI/Events/Game.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public static class GameEvents
4444
/// </summary>
4545
public static event EventHandler OneSecondTick = delegate { };
4646

47-
public static void InvokeGameLoaded()
47+
internal static void InvokeGameLoaded()
4848
{
4949
GameLoaded.Invoke(null, EventArgs.Empty);
5050
}
5151

52-
public static void InvokeInitialize()
52+
internal static void InvokeInitialize()
5353
{
5454
try
5555
{
@@ -61,7 +61,7 @@ public static void InvokeInitialize()
6161
}
6262
}
6363

64-
public static void InvokeLoadContent()
64+
internal static void InvokeLoadContent()
6565
{
6666
try
6767
{
@@ -73,7 +73,7 @@ public static void InvokeLoadContent()
7373
}
7474
}
7575

76-
public static void InvokeUpdateTick()
76+
internal static void InvokeUpdateTick()
7777
{
7878
try
7979
{
@@ -85,37 +85,37 @@ public static void InvokeUpdateTick()
8585
}
8686
}
8787

88-
public static void InvokeSecondUpdateTick()
88+
internal static void InvokeSecondUpdateTick()
8989
{
9090
SecondUpdateTick.Invoke(null, EventArgs.Empty);
9191
}
9292

93-
public static void InvokeFourthUpdateTick()
93+
internal static void InvokeFourthUpdateTick()
9494
{
9595
FourthUpdateTick.Invoke(null, EventArgs.Empty);
9696
}
9797

98-
public static void InvokeEighthUpdateTick()
98+
internal static void InvokeEighthUpdateTick()
9999
{
100100
EighthUpdateTick.Invoke(null, EventArgs.Empty);
101101
}
102102

103-
public static void InvokeQuarterSecondTick()
103+
internal static void InvokeQuarterSecondTick()
104104
{
105105
QuarterSecondTick.Invoke(null, EventArgs.Empty);
106106
}
107107

108-
public static void InvokeHalfSecondTick()
108+
internal static void InvokeHalfSecondTick()
109109
{
110110
HalfSecondTick.Invoke(null, EventArgs.Empty);
111111
}
112112

113-
public static void InvokeOneSecondTick()
113+
internal static void InvokeOneSecondTick()
114114
{
115115
OneSecondTick.Invoke(null, EventArgs.Empty);
116116
}
117117

118-
public static void InvokeFirstUpdateTick()
118+
internal static void InvokeFirstUpdateTick()
119119
{
120120
FirstUpdateTick.Invoke(null, EventArgs.Empty);
121121
}

StardewModdingAPI/Events/Location.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ public static class LocationEvents
1212
public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { };
1313
public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
1414

15-
public static void InvokeLocationsChanged(List<GameLocation> newLocations)
15+
internal static void InvokeLocationsChanged(List<GameLocation> newLocations)
1616
{
1717
LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
1818
}
1919

20-
public static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
20+
internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
2121
{
2222
CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
2323
}

StardewModdingAPI/Events/Menu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static class MenuEvents
77
{
88
public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
99

10-
public static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
10+
internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
1111
{
1212
MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
1313
}

StardewModdingAPI/Events/Mine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public static class MineEvents
66
{
77
public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged = delegate { };
88

9-
public static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
9+
internal static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
1010
{
1111
MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMinelevel, currentMineLevel));
1212
}

StardewModdingAPI/Events/Player.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ public static class PlayerEvents
1212
public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { };
1313
public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
1414

15-
public static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
15+
internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
1616
{
1717
FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
1818
}
1919

20-
public static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
20+
internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
2121
{
2222
InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
2323
}
2424

25-
public static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
25+
internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
2626
{
2727
LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
2828
}
2929

30-
public static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
30+
internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
3131
{
3232
LoadedGame.Invoke(null, loaded);
3333
}

StardewModdingAPI/Events/Time.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ public static class TimeEvents
88
public static event EventHandler<EventArgsIntChanged> DayOfMonthChanged = delegate { };
99
public static event EventHandler<EventArgsIntChanged> YearOfGameChanged = delegate { };
1010
public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged = delegate { };
11-
public static event EventHandler OnNewDay = delegate { };
11+
public static event EventHandler<EventArgsNewDay> OnNewDay = delegate { };
1212

13-
public static void InvokeTimeOfDayChanged(int priorInt, int newInt)
13+
internal static void InvokeTimeOfDayChanged(int priorInt, int newInt)
1414
{
1515
TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
1616
}
1717

18-
public static void InvokeDayOfMonthChanged(int priorInt, int newInt)
18+
internal static void InvokeDayOfMonthChanged(int priorInt, int newInt)
1919
{
2020
DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
2121
}
2222

23-
public static void InvokeYearOfGameChanged(int priorInt, int newInt)
23+
internal static void InvokeYearOfGameChanged(int priorInt, int newInt)
2424
{
2525
YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
2626
}
2727

28-
public static void InvokeSeasonOfYearChanged(string priorString, string newString)
28+
internal static void InvokeSeasonOfYearChanged(string priorString, string newString)
2929
{
3030
SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
3131
}
3232

33-
public static void InvokeOnNewDay(int priorInt, int newInt)
33+
internal static void InvokeOnNewDay(int priorInt, int newInt, bool newDay)
3434
{
35-
OnNewDay.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
35+
OnNewDay.Invoke(null, new EventArgsNewDay(priorInt, newInt, newDay));
3636
}
3737
}
3838
}

StardewModdingAPI/Inheritance/SGame.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -994,27 +994,27 @@ protected override void Draw(GameTime gameTime)
994994
}
995995
}
996996

997-
if (Debug)
998-
{
999-
spriteBatch.Begin();
1000-
spriteBatch.DrawString(smoothFont, "FPS: " + FramesPerSecond, Vector2.Zero, BgColour);
997+
#endregion
998+
}
1001999

1002-
int i = 1;
1003-
while (DebugMessageQueue.Any())
1004-
{
1005-
string s = DebugMessageQueue.Dequeue();
1006-
spriteBatch.DrawString(smoothFont, s, new Vector2(0, i * 12), BgColour);
1007-
i++;
1008-
}
1009-
GraphicsEvents.InvokeDrawDebug(null, null);
1010-
spriteBatch.End();
1011-
}
1012-
else
1000+
if (Debug)
1001+
{
1002+
spriteBatch.Begin();
1003+
spriteBatch.DrawString(smoothFont, "FPS: " + FramesPerSecond, Vector2.Zero, Color.CornflowerBlue);
1004+
1005+
int i = 1;
1006+
while (DebugMessageQueue.Any())
10131007
{
1014-
DebugMessageQueue.Clear();
1008+
string s = DebugMessageQueue.Dequeue();
1009+
spriteBatch.DrawString(smoothFont, s, new Vector2(0, i * 12), Color.CornflowerBlue);
1010+
i++;
10151011
}
1016-
1017-
#endregion
1012+
GraphicsEvents.InvokeDrawDebug(null, EventArgs.Empty);
1013+
spriteBatch.End();
1014+
}
1015+
else
1016+
{
1017+
DebugMessageQueue.Clear();
10181018
}
10191019
}
10201020

@@ -1231,7 +1231,7 @@ private void UpdateEventCalls()
12311231

12321232
if (PreviousIsNewDay != newDay)
12331233
{
1234-
TimeEvents.InvokeOnNewDay(PreviousDayOfMonth, dayOfMonth);
1234+
TimeEvents.InvokeOnNewDay(PreviousDayOfMonth, dayOfMonth, newDay);
12351235
PreviousIsNewDay = newDay;
12361236
}
12371237
}

0 commit comments

Comments
 (0)