From 1debeb8eff19f2b5e222579405413ae175fb361d Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Sun, 27 Mar 2016 16:53:47 -0400 Subject: updates --- StardewModdingAPI/Config.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/StardewModdingAPI/Config.cs b/StardewModdingAPI/Config.cs index 035d28d7..d978d848 100644 --- a/StardewModdingAPI/Config.cs +++ b/StardewModdingAPI/Config.cs @@ -165,12 +165,12 @@ namespace StardewModdingAPI } /// - /// Re-reads the json blob on the disk and merges its values with a default config + /// Re-reads the json blob on the disk and merges its values with a default config. /// NOTE: You MUST set your config EQUAL to the return of this method! /// public static T ReloadConfig(this T baseConfig) where T : Config { - return baseConfig.UpdateConfig(); + return baseConfig.LoadConfig(); } } } \ No newline at end of file -- cgit From bcaa3fc7a435f462c0acbb1bcd55f061e4f5aa9c Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Sun, 27 Mar 2016 19:18:49 -0400 Subject: updates? --- StardewModdingAPI/Events/Graphics.cs | 13 ++++--------- StardewModdingAPI/Inheritance/SGame.cs | 2 ++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/StardewModdingAPI/Events/Graphics.cs b/StardewModdingAPI/Events/Graphics.cs index 79c5b4aa..4e533f92 100644 --- a/StardewModdingAPI/Events/Graphics.cs +++ b/StardewModdingAPI/Events/Graphics.cs @@ -12,8 +12,6 @@ namespace StardewModdingAPI.Events /// public static event EventHandler Resize = delegate { }; - - /// /// Occurs before anything is drawn. /// @@ -87,7 +85,10 @@ namespace StardewModdingAPI.Events OnPostRenderEvent.Invoke(sender, e); } - + internal static void InvokeResize(object sender, EventArgs e) + { + Resize.Invoke(sender, e); + } #region To Remove @@ -116,12 +117,6 @@ namespace StardewModdingAPI.Events DrawInRenderTargetTick.Invoke(null, EventArgs.Empty); } - [Obsolete("Should not be used.")] - public static void InvokeResize(object sender, EventArgs e) - { - Resize.Invoke(sender, e); - } - #endregion } } \ No newline at end of file diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index d6263d73..65711507 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -1245,6 +1245,8 @@ namespace StardewModdingAPI.Inheritance { farmEvent?.drawAboveEverything(spriteBatch); } + GraphicsEvents.InvokeDrawTick(); + GraphicsEvents.InvokeDrawInRenderTargetTick(); GraphicsEvents.InvokeOnPostRenderEvent(null, EventArgs.Empty); spriteBatch.End(); if (!ZoomLevelIsOne) -- cgit From 106ccd0d8760350d10054aab1c35cc6e71ef322b Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Sun, 27 Mar 2016 19:22:26 -0400 Subject: logging --- StardewModdingAPI/Logger.cs | 52 +++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/StardewModdingAPI/Logger.cs b/StardewModdingAPI/Logger.cs index 35903513..68638cb5 100644 --- a/StardewModdingAPI/Logger.cs +++ b/StardewModdingAPI/Logger.cs @@ -21,19 +21,7 @@ namespace StardewModdingAPI _writer.WriteToLog(li); } - #region Sync Logging - - /// - /// NOTICE: Sync logging is discouraged. Please use Async instead. - /// - /// Message to log - /// Colour of message - public static void SyncColour(object message, ConsoleColor colour) - { - PrintLog(new LogInfo(message?.ToString(), colour)); - } - - #endregion + #region Exception Logging /// /// Catch unhandled exception from the application @@ -55,6 +43,22 @@ namespace StardewModdingAPI File.WriteAllText(Constants.LogDir + "\\MODDED_ErrorLog.Log_" + Extensions.Random.Next(100000000, 999999999) + ".txt", e.Exception.ToString()); } + #endregion + + #region Sync Logging + + /// + /// NOTICE: Sync logging is discouraged. Please use Async instead. + /// + /// Message to log + /// Colour of message + public static void SyncColour(object message, ConsoleColor colour) + { + PrintLog(new LogInfo(message?.ToString(), colour)); + } + + #endregion + #region Async Logging public static void AsyncColour(object message, ConsoleColor colour) @@ -97,6 +101,26 @@ namespace StardewModdingAPI AsyncColour(message?.ToString(), ConsoleColor.Magenta); } + public static void Error(object message) + { + AsyncR("[ERROR] " + message); + } + + public static void Success(object message) + { + AsyncG("[SUCCESS] " + message); + } + + public static void Info(object message) + { + AsyncY("[INFO] " + message); + } + + public static void Out(object message) + { + Async("[OUT] " + message); + } + #endregion #region ToRemove @@ -157,7 +181,7 @@ namespace StardewModdingAPI } [Obsolete("Parameter 'values' is no longer supported. Format before logging.")] - public static void AsyncR(object message, params object[] values) + public static void Error(object message, params object[] values) { AsyncR(message); } -- cgit