using UnityEngine; using System.Collections; using System; /// /// 输出管理者 /// author: gwang. 2022.8.11 (以前是谁写的不知道, 我给加了时间戳和文本颜色(#^.^#)). /// public class LogHelper { /// /// 输出开关 /// static public bool EnableLog = true; /// /// 输出日志信息 /// /// #if UNITY_EDITOR //public static Action Log = (msg) => Debug.Log($"[{DateTimeOffset.Now:fffff}] {msg}"); public static Action Log = (msg) => Debug.Log($"[{DateTimeOffset.Now:fffff}] {msg}"); #else static public void Log(object msg) { if (EnableLog) { Debug.Log($"[{DateTimeOffset.Now:fffff}] {msg}"); } } #endif /// /// 输出错误信息 /// /// #if UNITY_EDITOR public static Action LogError = (msg) => Debug.LogError($"[{DateTimeOffset.Now:fffff}] {msg}"); #else static public void LogError(object msg) { if (EnableLog) { Debug.LogError($"[{DateTimeOffset.Now:fffff}] {msg}"); } } #endif /// /// 输出警告信息 /// /// #if UNITY_EDITOR public static Action LogWarning = (msg) => Debug.LogWarning($"[{DateTimeOffset.Now:fffff}] {msg}"); #else static public void LogWarning(object msg) { if (EnableLog) { Debug.LogWarning($"[{DateTimeOffset.Now:HH:mm:ss fffff}] {msg}"); } } #endif }