diff options
Diffstat (limited to 'src/StardewModdingAPI/Framework')
7 files changed, 28 insertions, 28 deletions
diff --git a/src/StardewModdingAPI/Framework/CursorPosition.cs b/src/StardewModdingAPI/Framework/CursorPosition.cs index 4f256da5..0fb2309b 100644 --- a/src/StardewModdingAPI/Framework/CursorPosition.cs +++ b/src/StardewModdingAPI/Framework/CursorPosition.cs @@ -1,4 +1,4 @@ -#if SMAPI_2_0 +#if !SMAPI_1_x using Microsoft.Xna.Framework; namespace StardewModdingAPI.Framework diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs index 69ef0b63..b75453b7 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs @@ -140,7 +140,7 @@ namespace StardewModdingAPI.Framework.ModLoading } // validate required fields -#if SMAPI_2_0 +#if !SMAPI_1_x { List<string> missingFields = new List<string>(3); @@ -158,7 +158,7 @@ namespace StardewModdingAPI.Framework.ModLoading } // validate IDs are unique -#if SMAPI_2_0 +#if !SMAPI_1_x { var duplicatesByID = mods .GroupBy(mod => mod.Manifest.UniqueID?.Trim(), mod => mod, StringComparer.InvariantCultureIgnoreCase) @@ -255,10 +255,10 @@ namespace StardewModdingAPI.Framework.ModLoading MinVersion = entry.MinimumVersion, Mod = dependencyMod, IsRequired = -#if SMAPI_2_0 - entry.IsRequired -#else +#if SMAPI_1_x true +#else + entry.IsRequired #endif } ) diff --git a/src/StardewModdingAPI/Framework/Models/Manifest.cs b/src/StardewModdingAPI/Framework/Models/Manifest.cs index 08b88025..1b5c2646 100644 --- a/src/StardewModdingAPI/Framework/Models/Manifest.cs +++ b/src/StardewModdingAPI/Framework/Models/Manifest.cs @@ -38,7 +38,7 @@ namespace StardewModdingAPI.Framework.Models /// <summary>The unique mod ID.</summary> public string UniqueID { get; set; } -#if !SMAPI_2_0 +#if SMAPI_1_x /// <summary>Whether the mod uses per-save config files.</summary> [Obsolete("Use " + nameof(Mod) + "." + nameof(Mod.Helper) + "." + nameof(IModHelper.ReadConfig) + " instead")] public bool PerSaveConfigs { get; set; } diff --git a/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs b/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs index 25d92a29..67f906e3 100644 --- a/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs +++ b/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs @@ -12,7 +12,7 @@ /// <summary>The minimum required version (if any).</summary> public ISemanticVersion MinimumVersion { get; set; } -#if SMAPI_2_0 +#if !SMAPI_1_x /// <summary>Whether the dependency must be installed to use the mod.</summary> public bool IsRequired { get; set; } #endif @@ -25,7 +25,7 @@ /// <param name="minimumVersion">The minimum required version (if any).</param> /// <param name="required">Whether the dependency must be installed to use the mod.</param> public ManifestDependency(string uniqueID, string minimumVersion -#if SMAPI_2_0 +#if !SMAPI_1_x , bool required = true #endif ) @@ -34,7 +34,7 @@ this.MinimumVersion = !string.IsNullOrWhiteSpace(minimumVersion) ? new SemanticVersion(minimumVersion) : null; -#if SMAPI_2_0 +#if !SMAPI_1_x this.IsRequired = required; #endif } diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs index 6359b454..5ae24a73 100644 --- a/src/StardewModdingAPI/Framework/Monitor.cs +++ b/src/StardewModdingAPI/Framework/Monitor.cs @@ -45,7 +45,7 @@ namespace StardewModdingAPI.Framework /// <summary>Whether SMAPI is aborting. Mods don't need to worry about this unless they have background tasks.</summary> public bool IsExiting => this.ExitTokenSource.IsCancellationRequested; -#if SMAPI_2_0 +#if !SMAPI_1_x /// <summary>Whether to show the full log stamps (with time/level/logger) in the console. If false, shows a simplified stamp with only the logger.</summary> internal bool ShowFullStampInConsole { get; set; } #endif @@ -97,7 +97,7 @@ namespace StardewModdingAPI.Framework this.ExitTokenSource.Cancel(); } -#if SMAPI_2_0 +#if !SMAPI_1_x /// <summary>Write a newline to the console and log file.</summary> internal void Newline() { @@ -108,7 +108,7 @@ namespace StardewModdingAPI.Framework } #endif -#if !SMAPI_2_0 +#if SMAPI_1_x /// <summary>Log a message for the player or developer, using the specified console color.</summary> /// <param name="source">The name of the mod logging the message.</param> /// <param name="message">The message to log.</param> @@ -144,7 +144,7 @@ namespace StardewModdingAPI.Framework string levelStr = level.ToString().ToUpper().PadRight(Monitor.MaxLevelLength); string fullMessage = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}"; -#if SMAPI_2_0 +#if !SMAPI_1_x string consoleMessage = this.ShowFullStampInConsole ? fullMessage : $"[{source}] {message}"; #else string consoleMessage = fullMessage; diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs index c7784c60..d6f1a05b 100644 --- a/src/StardewModdingAPI/Framework/SGame.cs +++ b/src/StardewModdingAPI/Framework/SGame.cs @@ -118,7 +118,7 @@ namespace StardewModdingAPI.Framework /// <summary>The time of day (in 24-hour military format) at last check.</summary> private int PreviousTime; -#if !SMAPI_2_0 +#if SMAPI_1_x /// <summary>The day of month (1–28) at last check.</summary> private int PreviousDay; @@ -292,7 +292,7 @@ namespace StardewModdingAPI.Framework if (this.FirstUpdate) { GameEvents.InvokeInitialize(this.Monitor); -#if !SMAPI_2_0 +#if SMAPI_1_x GameEvents.InvokeLoadContent(this.Monitor); #endif GameEvents.InvokeGameLoaded(this.Monitor); @@ -324,7 +324,7 @@ namespace StardewModdingAPI.Framework Context.IsWorldReady = true; SaveEvents.InvokeAfterLoad(this.Monitor); -#if !SMAPI_2_0 +#if SMAPI_1_x PlayerEvents.InvokeLoadedGame(this.Monitor, new EventArgsLoadedGameChanged(Game1.hasLoadedGame)); #endif TimeEvents.InvokeAfterDayStarted(this.Monitor); @@ -382,7 +382,7 @@ namespace StardewModdingAPI.Framework bool isClick = framePressedKeys.Contains(SButton.MouseLeft) || (framePressedKeys.Contains(SButton.ControllerA) && !currentlyPressedKeys.Contains(SButton.ControllerX)); // get cursor position -#if SMAPI_2_0 +#if !SMAPI_1_x ICursorPosition cursor; { // cursor position @@ -398,7 +398,7 @@ namespace StardewModdingAPI.Framework // raise button pressed foreach (SButton button in framePressedKeys) { -#if SMAPI_2_0 +#if !SMAPI_1_x InputEvents.InvokeButtonPressed(this.Monitor, button, cursor, isClick); #endif @@ -420,7 +420,7 @@ namespace StardewModdingAPI.Framework // raise button released foreach (SButton button in frameReleasedKeys) { -#if SMAPI_2_0 +#if !SMAPI_1_x bool wasClick = (button == SButton.MouseLeft && previousPressedKeys.Contains(SButton.MouseLeft)) // released left click || (button == SButton.ControllerA && previousPressedKeys.Contains(SButton.ControllerA) && !previousPressedKeys.Contains(SButton.ControllerX)); @@ -503,7 +503,7 @@ namespace StardewModdingAPI.Framework if (this.GetHash(Game1.locations) != this.PreviousGameLocations) LocationEvents.InvokeLocationsChanged(this.Monitor, Game1.locations); -#if !SMAPI_2_0 +#if SMAPI_1_x // raise player changed if (Game1.player != this.PreviousFarmer) PlayerEvents.InvokeFarmerChanged(this.Monitor, this.PreviousFarmer, Game1.player); @@ -538,7 +538,7 @@ namespace StardewModdingAPI.Framework // raise time changed if (Game1.timeOfDay != this.PreviousTime) TimeEvents.InvokeTimeOfDayChanged(this.Monitor, this.PreviousTime, Game1.timeOfDay); -#if !SMAPI_2_0 +#if SMAPI_1_x if (Game1.dayOfMonth != this.PreviousDay) TimeEvents.InvokeDayOfMonthChanged(this.Monitor, this.PreviousDay, Game1.dayOfMonth); if (Game1.currentSeason != this.PreviousSeason) @@ -566,7 +566,7 @@ namespace StardewModdingAPI.Framework this.PreviousTime = Game1.timeOfDay; this.PreviousMineLevel = Game1.mine?.mineLevel ?? 0; this.PreviousSaveID = Game1.uniqueIDForThisGame; -#if !SMAPI_2_0 +#if SMAPI_1_x this.PreviousFarmer = Game1.player; this.PreviousDay = Game1.dayOfMonth; this.PreviousSeason = Game1.currentSeason; @@ -577,7 +577,7 @@ namespace StardewModdingAPI.Framework /********* ** Game day transition event (obsolete) *********/ -#if !SMAPI_2_0 +#if SMAPI_1_x if (Game1.newDay != this.PreviousIsNewDay) { TimeEvents.InvokeOnNewDay(this.Monitor, this.PreviousDay, Game1.dayOfMonth, Game1.newDay); @@ -603,7 +603,7 @@ namespace StardewModdingAPI.Framework GameEvents.InvokeUpdateTick(this.Monitor); if (this.FirstUpdate) { -#if !SMAPI_2_0 +#if SMAPI_1_x GameEvents.InvokeFirstUpdateTick(this.Monitor); #endif this.FirstUpdate = false; diff --git a/src/StardewModdingAPI/Framework/Serialisation/ManifestFieldConverter.cs b/src/StardewModdingAPI/Framework/Serialisation/ManifestFieldConverter.cs index 5be0f0b6..6947311b 100644 --- a/src/StardewModdingAPI/Framework/Serialisation/ManifestFieldConverter.cs +++ b/src/StardewModdingAPI/Framework/Serialisation/ManifestFieldConverter.cs @@ -73,11 +73,11 @@ namespace StardewModdingAPI.Framework.Serialisation { string uniqueID = obj.Value<string>(nameof(IManifestDependency.UniqueID)); string minVersion = obj.Value<string>(nameof(IManifestDependency.MinimumVersion)); -#if SMAPI_2_0 +#if SMAPI_1_x + result.Add(new ManifestDependency(uniqueID, minVersion)); +#else bool required = obj.Value<bool?>(nameof(IManifestDependency.IsRequired)) ?? true; result.Add(new ManifestDependency(uniqueID, minVersion, required)); -#else - result.Add(new ManifestDependency(uniqueID, minVersion)); #endif } return result.ToArray(); |