diff options
author | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-01 18:44:41 -0500 |
---|---|---|
committer | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-01 18:44:41 -0500 |
commit | 069589db98df9e388c919a32f8503ad7cd854b7c (patch) | |
tree | c09586126b1c7baa41fb1401a99e8a6d7af18061 | |
parent | c7ecc201bbd5cc18c52f173ae550ea42743b53fb (diff) | |
download | SMAPI-069589db98df9e388c919a32f8503ad7cd854b7c.tar.gz SMAPI-069589db98df9e388c919a32f8503ad7cd854b7c.tar.bz2 SMAPI-069589db98df9e388c919a32f8503ad7cd854b7c.zip |
sloppy 0.3 release for network dll loads and separation of trainer
-rw-r--r-- | Release/Mods/TrainerMod.dll | bin | 22528 -> 22528 bytes | |||
-rw-r--r-- | Release/StardewModdingAPI.exe | bin | 60416 -> 58368 bytes | |||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 5 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGameLocation.cs | 6 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SObject.cs | 7 | ||||
-rw-r--r-- | StardewModdingAPI/Program.cs | 75 | ||||
-rw-r--r-- | TrainerMod/bin/Debug/TrainerMod.dll | bin | 22528 -> 22528 bytes | |||
-rw-r--r-- | TrainerMod/obj/Debug/TrainerMod.dll | bin | 22528 -> 22528 bytes |
8 files changed, 63 insertions, 30 deletions
diff --git a/Release/Mods/TrainerMod.dll b/Release/Mods/TrainerMod.dll Binary files differindex 2b6130c9..0605748e 100644 --- a/Release/Mods/TrainerMod.dll +++ b/Release/Mods/TrainerMod.dll diff --git a/Release/StardewModdingAPI.exe b/Release/StardewModdingAPI.exe Binary files differindex ba7a88b6..754a7936 100644 --- a/Release/StardewModdingAPI.exe +++ b/Release/StardewModdingAPI.exe diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index b28b8d7c..0202e55f 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -117,7 +117,9 @@ namespace StardewModdingAPI.Inheritance { base.Draw(gameTime); Events.InvokeDrawTick(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.DepthRead, RasterizerState.CullNone); + /* + spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); + if (CurrentLocation != null) CurrentLocation.draw(Game1.spriteBatch); @@ -125,6 +127,7 @@ namespace StardewModdingAPI.Inheritance spriteBatch.DrawString(Game1.dialogueFont, Game1.player.position.ToString(), new Vector2(0, 180), Color.Orange); spriteBatch.End(); + */ } public static Int32 RegisterModItem(SObject modItem) diff --git a/StardewModdingAPI/Inheritance/SGameLocation.cs b/StardewModdingAPI/Inheritance/SGameLocation.cs index 82caab40..69b44003 100644 --- a/StardewModdingAPI/Inheritance/SGameLocation.cs +++ b/StardewModdingAPI/Inheritance/SGameLocation.cs @@ -29,6 +29,11 @@ namespace StardewModdingAPI.Inheritance //s.Map = baseClass.Map; //s.objects = baseClass.objects; //s.temporarySprites = baseClass.temporarySprites; + s.map = baseClass.map; + s.objects = baseClass.objects; + s.name = baseClass.name; + + /* s.actionObjectForQuestionDialogue = baseClass.actionObjectForQuestionDialogue; s.characters = baseClass.characters; s.critters = (List<Critter>)typeof(GameLocation).GetField("critters", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(baseClass); @@ -67,6 +72,7 @@ namespace StardewModdingAPI.Inheritance s.waterColor = baseClass.waterColor; s.waterTileFlip = baseClass.waterTileFlip; s.waterTiles = baseClass.waterTiles; + */ return s; } diff --git a/StardewModdingAPI/Inheritance/SObject.cs b/StardewModdingAPI/Inheritance/SObject.cs index 79edcb34..97d2fa41 100644 --- a/StardewModdingAPI/Inheritance/SObject.cs +++ b/StardewModdingAPI/Inheritance/SObject.cs @@ -55,11 +55,12 @@ namespace StardewModdingAPI.Inheritance public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1) { + return; try { if (Texture != null) { - int targSize = 64; + int targSize = Game1.tileSize; int midX = (int) ((xNonTile) + 32); int midY = (int) ((yNonTile) + 32); @@ -68,12 +69,14 @@ namespace StardewModdingAPI.Inheritance Rectangle targ = new Rectangle(targX, targY, targSize, targSize); spriteBatch.Draw(Texture, targ, null, new Color(255, 255, 255, 255f * alpha), 0, Vector2.Zero, SpriteEffects.None, layerDepth); - spriteBatch.Draw(Program.DebugPixel, targ, null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, layerDepth); + //spriteBatch.Draw(Program.DebugPixel, targ, null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, layerDepth); + /* spriteBatch.DrawString(Game1.dialogueFont, "TARG: " + targ, new Vector2(128, 0), Color.Red); spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX * 0.5f, targY), Color.Orange); spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX, targY), Color.Red); spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX * 1.5f, targY), Color.Yellow); spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX * 2f, targY), Color.Green); + */ } } catch (Exception ex) diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index 5c2f2b9c..ce5424c8 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -1,4 +1,5 @@ using System; +using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -9,6 +10,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using Microsoft.CSharp; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; @@ -28,8 +30,8 @@ namespace StardewModdingAPI { public static string ExecutionPath { get; private set; } public static string DataPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")); - public static string ModPath = Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")), "Mods"); - public static string ModContentPath = Path.Combine(Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")), "Mods"), "Content"); + public static List<string> ModPaths = new List<string>(); + public static List<string> ModContentPaths = new List<string>(); public static string LogPath = Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")), "ErrorLogs"); public static string CurrentLog { get; private set; } public static StreamWriter LogStream { get; private set; } @@ -57,14 +59,24 @@ namespace StardewModdingAPI Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - if (File.Exists(ModPath)) - File.Delete(ModPath); - if (!Directory.Exists(ModPath)) - Directory.CreateDirectory(ModPath); - if (!Directory.Exists(ModContentPath)) - Directory.CreateDirectory(ModContentPath); - ExecutionPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + ModPaths.Add(Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")), "Mods")); + ModPaths.Add(Path.Combine(ExecutionPath, "Mods")); + ModContentPaths.Add(Path.Combine(Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")), "Mods"), "Content")); + + foreach (string ModPath in ModPaths) + { + if (File.Exists(ModPath)) + File.Delete(ModPath); + if (!Directory.Exists(ModPath)) + Directory.CreateDirectory(ModPath); + } + foreach (string ModContentPath in ModContentPaths) + { + if (!Directory.Exists(ModContentPath)) + Directory.CreateDirectory(ModContentPath); + } + CurrentLog = LogPath + "\\MODDED_ProgramLog_" + System.DateTime.Now.Ticks + ".txt"; Log(ExecutionPath, false); @@ -196,24 +208,30 @@ namespace StardewModdingAPI public static void LoadMods() { LogColour(ConsoleColor.Green, "LOADING MODS"); - foreach (String s in Directory.GetFiles(ModPath, "*.dll")) + int loadedMods = 0; + foreach (string ModPath in ModPaths) { - LogColour(ConsoleColor.Green, "Found DLL: " + s); - Assembly mod = Assembly.LoadFile(s); - - if (mod.DefinedTypes.Count(x => x.BaseType == typeof (Mod)) > 0) + foreach (String s in Directory.GetFiles(ModPath, "*.dll")) { - LogColour(ConsoleColor.Green, "Loading Mod DLL..."); - TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof(Mod)); - Mod m = (Mod)mod.CreateInstance(tar.ToString()); - Console.WriteLine("LOADED MOD: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description); - m.Entry(); - } - else - { - LogError("Invalid Mod DLL"); + LogColour(ConsoleColor.Green, "Found DLL: " + s); + Assembly mod = Assembly.LoadFile(s); + + if (mod.DefinedTypes.Count(x => x.BaseType == typeof (Mod)) > 0) + { + LogColour(ConsoleColor.Green, "Loading Mod DLL..."); + TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof (Mod)); + Mod m = (Mod) mod.CreateInstance(tar.ToString()); + Console.WriteLine("LOADED MOD: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description); + loadedMods += 1; + m.Entry(); + } + else + { + LogError("Invalid Mod DLL"); + } } } + LogColour(ConsoleColor.Green, "LOADED {0} MODS", loadedMods); } public static void ConsoleInputThread() @@ -237,7 +255,7 @@ namespace StardewModdingAPI 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(ModContentPath + "\\Test.png", FileMode.Open)); + so.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\Test.png", FileMode.Open)); so.IsPassable = true; so.IsPlaceable = true; LogColour(ConsoleColor.Cyan, "REGISTERED WITH ID OF: " + SGame.RegisterModItem(so)); @@ -247,7 +265,7 @@ namespace StardewModdingAPI 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(ModContentPath + "\\PaintingTest.png", FileMode.Open)); + so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\PaintingTest.png", FileMode.Open)); so2.IsPassable = true; so2.IsPlaceable = true; LogColour(ConsoleColor.Cyan, "REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2)); @@ -274,9 +292,12 @@ namespace StardewModdingAPI static void Events_CurrentLocationChanged(GameLocation newLocation) { - SGame.CurrentLocation = null; - System.Threading.Thread.Sleep(10); + //SGame.CurrentLocation = null; + //System.Threading.Thread.Sleep(10); SGame.CurrentLocation = SGame.ModLocations.First(x => x.name == newLocation.name); + //Game1.currentLocation = SGame.CurrentLocation; + //LogInfo(((SGameLocation) newLocation).name); + //LogInfo("LOC CHANGED: " + SGame.currentLocation.name); } public static void StardewInvoke(Action a) diff --git a/TrainerMod/bin/Debug/TrainerMod.dll b/TrainerMod/bin/Debug/TrainerMod.dll Binary files differindex 2b6130c9..0605748e 100644 --- a/TrainerMod/bin/Debug/TrainerMod.dll +++ b/TrainerMod/bin/Debug/TrainerMod.dll diff --git a/TrainerMod/obj/Debug/TrainerMod.dll b/TrainerMod/obj/Debug/TrainerMod.dll Binary files differindex 2b6130c9..0605748e 100644 --- a/TrainerMod/obj/Debug/TrainerMod.dll +++ b/TrainerMod/obj/Debug/TrainerMod.dll |