private void SetOpen(string key, bool openTimer) { TimerItem timer = GetTimer(key); if (timer != null) { timer.SetOpen(openTimer); } else { HTLogger.Error("无法使用计时器功能,Timer:" + key + "尚未注册!"); } }
/// <summary> /// 获取计时器计时总时间 /// </summary> public float GetSumTime(string key) { TimerItem timer = GetTimer(key); if (timer != null) { return(timer.SumTime); } else { HTLogger.Error("无法使用计时器功能,Timer:" + key + "尚未注册!"); return(0.0f); } }
public void Init() { UnityDebugListener unityDebugListener = new UnityDebugListener(); UnityWarningListener unityWarningListener = new UnityWarningListener(); UnityErrorListener unityErrorListener = new UnityErrorListener(); HTLogger.Instance.Init(true); HTLogger.Instance.AddListener(HTLogger.Channel.Info, unityDebugListener); HTLogger.Instance.AddListener(HTLogger.Channel.Todo, unityDebugListener); HTLogger.Instance.AddListener(HTLogger.Channel.Debug, unityDebugListener); HTLogger.Instance.AddListener(HTLogger.Channel.Warning, unityWarningListener); HTLogger.Instance.AddListener(HTLogger.Channel.Error, unityErrorListener); HTLogger.Info("CustomLoggerService init done."); }
/// <summary> /// 订阅指定计时器 /// </summary> public TimerItem Subscribe(string key) { TimerItem timer; if (mTimerDict.TryGetValue(key, out timer)) { if (timer == null) { timer = new TimerItem(this); } else { HTLogger.Error("重复订阅Timer:" + key); } } timer = new TimerItem(this); mTimerDict.Add(key, timer); return(timer); }