From 2be6ad15744e7230030e0b48f775603d83ff14f7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 26 Oct 2016 20:35:48 -0400 Subject: choose correct references for platform automatically (#126) --- src/TrainerMod/TrainerMod.csproj | 50 ++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'src/TrainerMod') diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index a6955c68..77d1c9ef 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -52,20 +52,49 @@ C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley + + + + + False + + + False + + + $(GamePath)\Stardew Valley.exe + False + + + $(GamePath)\xTile.dll + False + False + + + + + + + $(GamePath)\MonoGame.Framework.dll + False + False + + + $(GamePath)\StardewValley.exe + False + + + $(GamePath)\xTile.dll + False + + + + - - False - - - False - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - $(GamePath)\Stardew Valley.exe - @@ -74,9 +103,6 @@ - - $(GamePath)\xTile.dll - -- cgit From 9436920d91fddd36d5c208299c3fa24b29a909be Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 26 Oct 2016 21:15:34 -0400 Subject: remove broken and unused test code (#126) --- src/StardewModdingAPI/Program.cs | 58 -------------------------- src/StardewModdingAPI/StardewModdingAPI.csproj | 6 +-- src/TrainerMod/TrainerMod.cs | 27 ------------ src/TrainerMod/TrainerMod.csproj | 4 +- 4 files changed, 3 insertions(+), 92 deletions(-) (limited to 'src/TrainerMod') diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 5513b23a..f37f573d 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -81,7 +81,6 @@ namespace StardewModdingAPI private static void ConfigureUI() { Console.Title = Constants.ConsoleTitle; - #if DEBUG Console.Title += " - DEBUG IS NOT FALSE, AUTHOUR NEEDS TO REUPLOAD THIS VERSION"; #endif @@ -149,12 +148,10 @@ namespace StardewModdingAPI // The only command in the API (at least it should be, for now) Command.RegisterCommand("help", "Lists all commands | 'help ' returns command description").CommandFired += help_CommandFired; - //Command.RegisterCommand("crash", "crashes sdv").CommandFired += delegate { Game1.player.draw(null); }; //Subscribe to events ControlEvents.KeyPressed += Events_KeyPressed; GameEvents.LoadContent += Events_LoadContent; - //Events.MenuChanged += Events_MenuChanged; //Idk right now Log.AsyncY("Applying Final SDV Tweaks..."); StardewInvoke(() => @@ -360,8 +357,6 @@ namespace StardewModdingAPI public static void ConsoleInputThread() { - var input = string.Empty; - while (true) { Command.CallCommand(Console.ReadLine()); @@ -373,65 +368,12 @@ namespace StardewModdingAPI Log.AsyncY("Initializing Debug Assets..."); DebugPixel = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1); DebugPixel.SetData(new[] {Color.White}); - -#if DEBUG - StardewModdingAPI.Log.Async("REGISTERING BASE CUSTOM ITEM"); - SObject so = new SObject(); - so.Name = "Mario Block"; - so.CategoryName = "SMAPI Test Mod"; - so.Description = "It's a block from Mario!\nLoaded in realtime by SMAPI."; - so.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(_modContentPaths[0] + "\\Test.png", FileMode.Open)); - so.IsPassable = true; - so.IsPlaceable = true; - StardewModdingAPI.Log.Async("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so)); - - //StardewModdingAPI.Log.Async("REGISTERING SECOND CUSTOM ITEM"); - //SObject so2 = new SObject(); - //so2.Name = "Mario Painting"; - //so2.CategoryName = "SMAPI Test Mod"; - //so2.Description = "It's a painting of a creature from Mario!\nLoaded in realtime by SMAPI."; - //so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(_modContentPaths[0] + "\\PaintingTest.png", FileMode.Open)); - //so2.IsPassable = true; - //so2.IsPlaceable = true; - //StardewModdingAPI.Log.Async("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2)); - - Command.CallCommand("load"); -#endif } private static void Events_KeyPressed(object o, EventArgsKeyPressed e) { } - private static void Events_MenuChanged(IClickableMenu newMenu) - { - Log.AsyncY("NEW MENU: " + newMenu.GetType()); - if (newMenu is GameMenu) - { - Game1.activeClickableMenu = SGameMenu.ConstructFromBaseClass(Game1.activeClickableMenu as GameMenu); - } - } - - private static void Events_LocationsChanged(List newLocations) - { -#if DEBUG - SGame.ModLocations = SGameLocation.ConstructFromBaseClasses(Game1.locations); -#endif - } - - private static void Events_CurrentLocationChanged(GameLocation newLocation) - { - //SGame.CurrentLocation = null; - //System.Threading.Thread.Sleep(10); -#if DEBUG - Console.WriteLine(newLocation.name); - SGame.CurrentLocation = SGame.LoadOrCreateSGameLocationFromName(newLocation.name); -#endif - //Game1.currentLocation = SGame.CurrentLocation; - //Log.LogComment(((SGameLocation) newLocation).name); - //Log.LogComment("LOC CHANGED: " + SGame.currentLocation.name); - } - public static void StardewInvoke(Action a) { StardewForm.Invoke(a); diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj index ab62bd87..7c555fd8 100644 --- a/src/StardewModdingAPI/StardewModdingAPI.csproj +++ b/src/StardewModdingAPI/StardewModdingAPI.csproj @@ -55,7 +55,7 @@ x86 bin\Debug\ false - TRACE + DEBUG;TRACE true true bin\Debug\StardewModdingAPI.XML @@ -82,10 +82,8 @@ $(HOME)/GOG Games/Stardew Valley/game $(HOME)/.local/share/Steam/steamapps/common/Stardew Valley - $(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS - C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley @@ -226,4 +224,4 @@ - + \ No newline at end of file diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index da5365cb..92de9796 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -14,28 +14,6 @@ namespace TrainerMod { public class TrainerMod : Mod { - /* - public override string Name - { - get { return "Trainer Mod"; } - } - - public override string Authour - { - get { return "Zoryn Aaron"; } - } - - public override string Version - { - get { return "1.0"; } - } - - public override string Description - { - get { return "Registers several commands to use. Most commands are trainer-like in that they offer forms of cheating."; } - } - */ - public static int frozenTime; public static bool infHealth, infStamina, infMoney, freezeTime; @@ -758,11 +736,6 @@ namespace TrainerMod private static void RegisterNewItem(object sender, EventArgsCommand e) { -#if DEBUG - SObject s = SGame.PullModItemFromDict(0, true); - s.Stack = 999; - Game1.player.addItemToInventory(s); -#endif } } } \ No newline at end of file diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index 77d1c9ef..6844f1c1 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -20,7 +20,7 @@ full true ..\StardewModdingAPI\bin\Debug\Mods\TrainerMod\ - TRACE + DEBUG;TRACE prompt 4 x86 @@ -44,10 +44,8 @@ $(HOME)/GOG Games/Stardew Valley/game $(HOME)/.local/share/Steam/steamapps/common/Stardew Valley - $(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS - C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley -- cgit From 4e17de2f2c33a6ddda4952265f7866d407965653 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 26 Oct 2016 23:43:32 -0400 Subject: use simpler crossplatform window management (#126) --- src/StardewModdingAPI/Program.cs | 35 ++++------------------------------- src/TrainerMod/FodyWeavers.xml | 5 ----- src/TrainerMod/TrainerMod.cs | 13 ------------- src/TrainerMod/TrainerMod.csproj | 5 ----- 4 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 src/TrainerMod/FodyWeavers.xml (limited to 'src/TrainerMod') diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index f37f573d..f6c63851 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Globalization; using System.IO; using System.Linq; @@ -11,9 +10,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Events; using StardewModdingAPI.Inheritance; -using StardewModdingAPI.Inheritance.Menus; using StardewValley; -using StardewValley.Menus; namespace StardewModdingAPI { @@ -32,7 +29,6 @@ namespace StardewModdingAPI public static Assembly StardewAssembly; public static Type StardewProgramType; public static FieldInfo StardewGameInfo; - public static Form StardewForm; public static Thread gameThread; public static Thread consoleInputThread; @@ -154,12 +150,9 @@ namespace StardewModdingAPI GameEvents.LoadContent += Events_LoadContent; Log.AsyncY("Applying Final SDV Tweaks..."); - StardewInvoke(() => - { - gamePtr.IsMouseVisible = false; - gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version; - StardewForm.Resize += GraphicsEvents.InvokeResize; - }); + gamePtr.IsMouseVisible = false; + gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version; + gamePtr.Window.ClientSizeChanged += GraphicsEvents.InvokeResize; } /// @@ -226,10 +219,8 @@ namespace StardewModdingAPI Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef; LoadMods(); - StardewForm = Control.FromHandle(gamePtr.Window.Handle).FindForm(); - if (StardewForm != null) StardewForm.Closing += StardewForm_Closing; - ready = true; + gamePtr.Exiting += (sender, e) => ready = false; StardewGameInfo.SetValue(StardewProgramType, gamePtr); gamePtr.Run(); @@ -240,19 +231,6 @@ namespace StardewModdingAPI } } - private static void StardewForm_Closing(object sender, CancelEventArgs e) - { - e.Cancel = true; - - if (true || MessageBox.Show("Are you sure you would like to quit Stardew Valley?\nUnsaved progress will be lost!", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) - { - gamePtr.Exit(); - gamePtr.Dispose(); - StardewForm.Hide(); - ready = false; - } - } - public static void LoadMods() { Log.AsyncY("LOADING MODS"); @@ -374,11 +352,6 @@ namespace StardewModdingAPI { } - public static void StardewInvoke(Action a) - { - StardewForm.Invoke(a); - } - private static void help_CommandFired(object o, EventArgsCommand e) { if (e.Command.CalledArgs.Length > 0) diff --git a/src/TrainerMod/FodyWeavers.xml b/src/TrainerMod/FodyWeavers.xml deleted file mode 100644 index dc708fcb..00000000 --- a/src/TrainerMod/FodyWeavers.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index 92de9796..94fd823b 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -50,9 +50,6 @@ namespace TrainerMod { Command.RegisterCommand("types", "Lists all value types | types").CommandFired += types_CommandFired; - Command.RegisterCommand("hide", "Hides the game form | hide").CommandFired += hide_CommandFired; - Command.RegisterCommand("show", "Shows the game form | show").CommandFired += show_CommandFired; - Command.RegisterCommand("save", "Saves the game? Doesn't seem to work. | save").CommandFired += save_CommandFired; Command.RegisterCommand("load", "Shows the load screen | load").CommandFired += load_CommandFired; @@ -94,16 +91,6 @@ namespace TrainerMod Log.AsyncY($"[Int32: {int.MinValue} - {int.MaxValue}], [Int64: {long.MinValue} - {long.MaxValue}], [String: \"raw text\"], [Colour: r,g,b (EG: 128, 32, 255)]"); } - private static void hide_CommandFired(object sender, EventArgsCommand e) - { - Program.StardewInvoke(() => { Program.StardewForm.Hide(); }); - } - - private static void show_CommandFired(object sender, EventArgsCommand e) - { - Program.StardewInvoke(() => { Program.StardewForm.Show(); }); - } - private static void save_CommandFired(object sender, EventArgsCommand e) { SaveGame.Save(); diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index 6844f1c1..e5002ba4 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -95,9 +95,7 @@ - - @@ -119,9 +117,6 @@ - - - -- cgit