using UnityEngine; using UnityEngine.UI; using UnityEngine.Serialization; using System; using System.Text; using System.Collections; using System.Collections.Generic; using Sfs2X.Core; using Random = UnityEngine.Random; public class DebugManager : MonoBehaviour { #region Config public static Text Lab { get { if (Lab_ == null) { Lab = ResourceManager.Get(PrefabLabel.E_ScrrLab, false); } return Lab_; } set { Lab_ = value; } } private static Text Lab_; public int Counter; public float Timer; #endregion public void Update() { Timer += Time.deltaTime; Counter++; if (Timer >= 1) { //Log($"当前帧率 {Counter} 目标帧率 {Application.targetFrameRate}"); Timer = 0; Counter = 0; } } public static void Log(string message) { if (Lab == null) { return; } Lab.text += '\n' + message; } public static void TryCatch(Action tryAction, Action catchAction) { try { tryAction.Invoke(); } catch (Exception) { catchAction.Invoke(); } } public static void PrintKeysAndValuesOfBaseEvent(string seperator, BaseEvent baseEvent) { Debug.LogWarning(seperator); foreach (var key in baseEvent.Params.Keys) { Debug.Log("Key " + key); } foreach (var value in baseEvent.Params.Values) { Debug.Log("value " + value); } Debug.LogWarning(seperator); } }