diff options
author | James Finlay <jtfinlay@ualberta.ca> | 2016-03-04 22:32:04 -0800 |
---|---|---|
committer | James Finlay <jtfinlay@ualberta.ca> | 2016-03-04 22:55:47 -0800 |
commit | a5a32e148b44b406d131b11a0aeadebed6d496cb (patch) | |
tree | ae8134fd5aedac7f9e5da992f3b691e4079d62aa /StardewModdingAPI/Inheritance | |
parent | 9420dfb0719d7f00c36607a210c50dc4537a9626 (diff) | |
download | SMAPI-a5a32e148b44b406d131b11a0aeadebed6d496cb.tar.gz SMAPI-a5a32e148b44b406d131b11a0aeadebed6d496cb.tar.bz2 SMAPI-a5a32e148b44b406d131b11a0aeadebed6d496cb.zip |
Pulled Logs into new Log object
- Greatly simplifies Program.cs
- Removed the 'Colour' method so that logging is more consistent for users - willing to discuss this change. I believe it is beneficial.
- Added uses of #DEBUG
Diffstat (limited to 'StardewModdingAPI/Inheritance')
-rw-r--r-- | StardewModdingAPI/Inheritance/Menus/SGameMenu.cs | 2 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 25 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGameLocation.cs | 4 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SObject.cs | 6 |
4 files changed, 18 insertions, 19 deletions
diff --git a/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs b/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs index 8b883fb6..721e04d8 100644 --- a/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs +++ b/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs @@ -39,7 +39,7 @@ namespace StardewModdingAPI.Inheritance.Menus { if (pages[currentTab] is InventoryPage) { - Program.LogInfo("INV SCREEN"); + Log.Verbose("INV SCREEN"); } else { diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 69439209..c7b07c43 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -75,9 +75,8 @@ namespace StardewModdingAPI.Inheritance {
instance = this;
- if (Program.debug)
- {
- SaveGame.serializer = new XmlSerializer(typeof (SaveGame), new Type[28]
+#if DEBUG
+ SaveGame.serializer = new XmlSerializer(typeof (SaveGame), new Type[28]
{
typeof (Tool),
typeof (GameLocation),
@@ -108,12 +107,12 @@ namespace StardewModdingAPI.Inheritance typeof (TerrainFeature),
typeof (SObject)
});
- }
+#endif
}
protected override void Initialize()
{
- Program.Log("XNA Initialize");
+ Log.Verbose("XNA Initialize");
ModItems = new Dictionary<Int32, SObject>();
PreviouslyPressedKeys = new Keys[0];
base.Initialize();
@@ -122,7 +121,7 @@ namespace StardewModdingAPI.Inheritance protected override void LoadContent()
{
- Program.Log("XNA LoadContent");
+ Log.Verbose("XNA LoadContent");
base.LoadContent();
Events.GameEvents.InvokeLoadContent();
}
@@ -137,7 +136,7 @@ namespace StardewModdingAPI.Inheritance }
catch (Exception ex)
{
- Program.LogError("An error occured in the base update loop: " + ex);
+ Log.Error("An error occured in the base update loop: " + ex);
Console.ReadKey();
}
@@ -169,7 +168,7 @@ namespace StardewModdingAPI.Inheritance {
if (modItem.HasBeenRegistered)
{
- Program.LogError("The item {0} has already been registered with ID {1}", modItem.Name, modItem.RegisteredId);
+ Log.Error("The item {0} has already been registered with ID {1}", modItem.Name, modItem.RegisteredId);
return modItem.RegisteredId;
}
Int32 newId = LowestModItemID;
@@ -189,14 +188,14 @@ namespace StardewModdingAPI.Inheritance {
return ModItems.ElementAt(id).Value.Clone();
}
- Program.LogError("ModItem Dictionary does not contain index: " + id.ToString());
+ Log.Error("ModItem Dictionary does not contain index: " + id.ToString());
return null;
}
if (ModItems.ContainsKey(id))
{
return ModItems[id].Clone();
}
- Program.LogError("ModItem Dictionary does not contain ID: " + id.ToString());
+ Log.Error("ModItem Dictionary does not contain ID: " + id.ToString());
return null;
}
@@ -212,7 +211,7 @@ namespace StardewModdingAPI.Inheritance GameLocation gl = locations.FirstOrDefault(x => x.name == name);
if (gl != null)
{
- Program.LogDebug("A custom location was created for the new name: " + name);
+ Log.Debug("A custom location was created for the new name: " + name);
SGameLocation s = SGameLocation.ConstructFromBaseClass(gl);
ModLocations.Add(s);
return s;
@@ -220,13 +219,13 @@ namespace StardewModdingAPI.Inheritance if (currentLocation != null && currentLocation.name == name)
{
gl = currentLocation;
- Program.LogDebug("A custom location was created from the current location for the new name: " + name);
+ Log.Debug("A custom location was created from the current location for the new name: " + name);
SGameLocation s = SGameLocation.ConstructFromBaseClass(gl);
ModLocations.Add(s);
return s;
}
- Program.LogDebug("A custom location could not be created for: " + name);
+ Log.Debug("A custom location could not be created for: " + name);
return null;
}
diff --git a/StardewModdingAPI/Inheritance/SGameLocation.cs b/StardewModdingAPI/Inheritance/SGameLocation.cs index 0787c0e1..437b0bfa 100644 --- a/StardewModdingAPI/Inheritance/SGameLocation.cs +++ b/StardewModdingAPI/Inheritance/SGameLocation.cs @@ -25,7 +25,7 @@ namespace StardewModdingAPI.Inheritance s.BaseGameLocation = baseClass; s.name = baseClass.name; - Program.LogDebug("CONSTRUCTED: " + s.name); + Log.Debug("CONSTRUCTED: " + s.name); if (copyAllData) { @@ -42,7 +42,7 @@ namespace StardewModdingAPI.Inheritance } catch (Exception ex) { - Program.LogError(ex); + Log.Error(ex); } } } diff --git a/StardewModdingAPI/Inheritance/SObject.cs b/StardewModdingAPI/Inheritance/SObject.cs index 25cdb26e..28254c24 100644 --- a/StardewModdingAPI/Inheritance/SObject.cs +++ b/StardewModdingAPI/Inheritance/SObject.cs @@ -78,7 +78,7 @@ namespace StardewModdingAPI.Inheritance public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1) { - Program.LogInfo("THIS DRAW FUNCTION IS NOT IMPLEMENTED I WANT TO KNOW WHERE IT IS CALLED"); + Log.Debug("THIS DRAW FUNCTION IS NOT IMPLEMENTED I WANT TO KNOW WHERE IT IS CALLED"); return; try { @@ -105,7 +105,7 @@ namespace StardewModdingAPI.Inheritance } catch (Exception ex) { - Program.LogError(ex.ToString()); + Log.Error(ex.ToString()); Console.ReadKey(); } } @@ -249,7 +249,7 @@ namespace StardewModdingAPI.Inheritance s.boundingBox = new Rectangle(x / Game1.tileSize * Game1.tileSize, y / Game1.tileSize * Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height); location.objects.Add(key, s); - Program.LogInfo("{0} - {1}", this.GetHashCode(), s.GetHashCode()); + Log.Verbose("{0} - {1}", this.GetHashCode(), s.GetHashCode()); return true; } |