diff options
author | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-21 21:07:37 -0400 |
---|---|---|
committer | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-21 21:07:37 -0400 |
commit | c73c1a0ec779228015a2f70f8a14a353f32664e2 (patch) | |
tree | 198e2e864a2371530735c2c4506d077a709422c4 /StardewModdingAPI/Inheritance | |
parent | 78609647e9e5ed6310942eaf104f495353e328e3 (diff) | |
parent | 46d21e384e3075b5352e20733f31e61d929d561a (diff) | |
download | SMAPI-c73c1a0ec779228015a2f70f8a14a353f32664e2.tar.gz SMAPI-c73c1a0ec779228015a2f70f8a14a353f32664e2.tar.bz2 SMAPI-c73c1a0ec779228015a2f70f8a14a353f32664e2.zip |
Merge branch 'master'
Diffstat (limited to 'StardewModdingAPI/Inheritance')
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 735cd58a..53d9df59 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -173,6 +173,15 @@ namespace StardewModdingAPI.Inheritance public Farmer PreviousFarmer { get; private set; }
+ public Int32 CurrentUpdateTick { get; private set; }
+ public bool FirstUpdate { get; private set; }
+
+ public RenderTarget2D Screen
+ {
+ get { return typeof (Game1).GetBaseFieldValue<RenderTarget2D>(Program.gamePtr, "screen"); }
+ set { typeof (Game1).SetBaseFieldValue("screen", value); }
+ }
+
private static SGame instance;
public static SGame Instance { get { return instance; } }
@@ -181,7 +190,9 @@ namespace StardewModdingAPI.Inheritance public SGame()
{
instance = this;
+ FirstUpdate = true;
+ /*
#if DEBUG
SaveGame.serializer = new XmlSerializer(typeof (SaveGame), new Type[28]
{
@@ -215,6 +226,7 @@ namespace StardewModdingAPI.Inheritance typeof (SObject)
});
#endif
+ */
}
protected override void Initialize()
@@ -251,6 +263,33 @@ namespace StardewModdingAPI.Inheritance }
Events.GameEvents.InvokeUpdateTick();
+ if (FirstUpdate)
+ {
+ GameEvents.InvokeFirstUpdateTick();
+ FirstUpdate = false;
+ }
+
+ if (CurrentUpdateTick % 2 == 0)
+ Events.GameEvents.InvokeSecondUpdateTick();
+
+ if (CurrentUpdateTick % 4 == 0)
+ Events.GameEvents.InvokeFourthUpdateTick();
+
+ if (CurrentUpdateTick % 8 == 0)
+ Events.GameEvents.InvokeEighthUpdateTick();
+
+ if (CurrentUpdateTick % 15 == 0)
+ Events.GameEvents.InvokeQuarterSecondTick();
+
+ if (CurrentUpdateTick % 30 == 0)
+ Events.GameEvents.InvokeHalfSecondTick();
+
+ if (CurrentUpdateTick % 60 == 0)
+ Events.GameEvents.InvokeOneSecondTick();
+
+ CurrentUpdateTick += 1;
+ if (CurrentUpdateTick >= 60)
+ CurrentUpdateTick = 0;
PreviouslyPressedKeys = CurrentlyPressedKeys;
for(PlayerIndex i = PlayerIndex.One; i <= PlayerIndex.Four; i++)
|