123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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 DebugBugText
- {
- get
- {
- if (debugBugText == null)
- {
- DebugBugText = ResourceManager.Get<Text>(CanvasLabel.E_ScrrLab, false);
- }
- return debugBugText;
- }
- set { debugBugText = value; }
- }
- private static Text debugBugText;
- public int TextCounter;
- public float FrameRateTimer;
- #endregion
- public void Update()
- {
- FrameRateTimer += Time.deltaTime;
- TextCounter++;
- if (FrameRateTimer >= 1)
- {
- //Log($"当前帧率 {Counter} 目标帧率 {Application.targetFrameRate}");
- FrameRateTimer = 0;
- TextCounter = 0;
- }
- }
- public static void Log(string message)
- {
- if (DebugBugText == null)
- {
- return;
- }
- DebugBugText.text += '\n' + message;
- }
- public static void ResetAbilityAnim()
- {
- SkillRoot skillRoot = Manager.SkillDictionary["Ability2"];
- skillRoot.Level = 0;
- skillRoot.ItemStatus = SkillStatus.Lock;
- skillRoot = Manager.SkillDictionary["Ability3"];
- skillRoot.Level = 0;
- skillRoot.ItemStatus = SkillStatus.Lock;
- skillRoot = Manager.SkillDictionary["Ability4"];
- skillRoot.Level = 0;
- skillRoot.ItemStatus = SkillStatus.Lock;
- }
- public static void ResetGardenLevel(int level)
- {
- SkillRoot skillRoot = Manager.SkillDictionary["Ability1"];
- skillRoot.Level = level;
- if (level == 0)
- {
- skillRoot.itemStatus = SkillStatus.UnLock;
- }
- else
- {
- skillRoot.itemStatus = SkillStatus.Upgrade;
- }
- }
- public static void ResetVisitTutorial()
- {
- TutorialManager.visitTutorial = true;
- TutorialManager.VisitTutorial = true;
- }
- 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);
- }
- }
|