// Copyright (c) Pixel Crushers. All rights reserved. using UnityEngine; namespace PixelCrushers.DialogueSystem { /// /// A simple static class to keep track of a global debug level setting for Dialogue System /// log messages. The DialogueManager / DialogueSystemController sets level. You can also /// set it manually. This class doesn't provide any wrappers for Debug.Log() because they /// would intercept the reference point that the editor goes to when you double-click the /// log message in the console window. /// public static class DialogueDebug { /// /// Dialogue system log messages are prefixed with this string. /// public const string Prefix = "Dialogue System"; /// /// The debug levels. /// /// - None: Don't log anything. /// - Error: Only log critical errors. /// - Warning: Log warnings and errors. /// - Info: Log trace information, warnings, and errors. /// public enum DebugLevel { None = 0, Error = 1, Warning = 2, Info = 3 } /// /// The current global debug level. /// /// /// The level. /// public static DebugLevel level { get; set; } /// /// Should the dialogue system log trace information? /// /// /// true if it should log trace info, warnings, and errors; otherwise, false. /// public static bool logInfo { get { return (level >= DebugLevel.Info) && Debug.isDebugBuild; } } /// /// Should the dialogue system log warnings and trace info? /// /// /// true to log warnings and errors; otherwise, false. /// public static bool logWarnings { get { return (level >= DebugLevel.Warning) && Debug.isDebugBuild; } } /// /// Should the dialogue system log critical errors? /// /// /// true to log errors; otherwise, false. /// public static bool logErrors { get { return (level >= DebugLevel.Error) && Debug.isDebugBuild; } } /// @cond FOR_V1_COMPATIBILITY public static DebugLevel Level { get { return level; } set { level = value; } } public static bool LogInfo { get { return logInfo; } } public static bool LogWarnings { get { return logWarnings; } } public static bool LogErrors { get { return logErrors; } } /// @endcond static DialogueDebug() { level = DebugLevel.Warning; } } }