diff --git a/src/SlatedGameToolkit.Framework/StateSystem/StateManager.cs b/src/SlatedGameToolkit.Framework/StateSystem/StateManager.cs index 324cb41..4fe4f65 100644 --- a/src/SlatedGameToolkit.Framework/StateSystem/StateManager.cs +++ b/src/SlatedGameToolkit.Framework/StateSystem/StateManager.cs @@ -87,7 +87,7 @@ namespace SlatedGameToolkit.Framework.StateSystem /// /// Adds the given state to this manager under it's own name. /// Initializes the state as well. - /// Will not iniitialize the state if this method returns false. + /// Will not initialize the state if this method returns false. /// /// The state to be added to this manager. /// False if a state of this name has already been registered. @@ -115,6 +115,7 @@ namespace SlatedGameToolkit.Framework.StateSystem Logger.Log("Removing state: " + name, LogLevel.DEBUG); try { state.Deinitialize(); + Logger.Log("State deinitialized: " + name, LogLevel.DEBUG); } catch (Exception e) { Logger.Log(e.ToString(), LogLevel.WARNING); Logger.Log("Failed to deinitialize state: " + state.getName(), LogLevel.WARNING); diff --git a/src/SlatedGameToolkit.Tools/Commands/GraphicalPlaygroundCommand.cs b/src/SlatedGameToolkit.Tools/Commands/GraphicalPlaygroundCommand.cs index 0b0868f..0d09707 100644 --- a/src/SlatedGameToolkit.Tools/Commands/GraphicalPlaygroundCommand.cs +++ b/src/SlatedGameToolkit.Tools/Commands/GraphicalPlaygroundCommand.cs @@ -11,7 +11,6 @@ namespace SlatedGameToolkit.Tools.Commands { private readonly string[] invokers = new string[] {"playground"}; private ConsolePlaygroundListener logListener; - private bool debugging; public bool Execute(IInteractable interactable, string[] args) { @@ -38,18 +37,18 @@ namespace SlatedGameToolkit.Tools.Commands interactable.Tell("Debug logging: " + logListener.Debug); return true; } else if (args[0].Equals("debug")) { - debugging = !debugging; - if (logListener != null) { - logListener.Debug = debugging; - interactable.Tell("Debug logging: " + logListener.Debug); + if (logListener == null) { + Logger.AddLogListener((logListener = new ConsolePlaygroundListener(interactable as ConsoleInteraction))); + logListener.Debug = true; + interactable.Tell("Attached log listener."); } else { - interactable.Tell(string.Format("Debug will be turned {0} when playground is started.", debugging ? "on" : "off")); + logListener.Debug = !logListener.Debug; } + interactable.Tell(string.Format("Debug logging has been turned {0}.", logListener.Debug ? "on" : "off")); return true; } else if (args[0].Equals("log")) { if (logListener == null) { Logger.AddLogListener((logListener = new ConsolePlaygroundListener(interactable as ConsoleInteraction))); - logListener.Debug = debugging; interactable.Tell("Listening to game engine's logging."); } else { Logger.RemoveLogListener(logListener);