XOpencoding.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Diagnostics;
  2. using UnityEngine;
  3. namespace XGame.Framework
  4. {
  5. public static class XOpencoding
  6. {
  7. private static GameObject _debugConsoleGO;
  8. [Conditional(MacroDefine.DEBUG), Conditional(MacroDefine.PROFILER)]
  9. public static void Initialize()
  10. {
  11. //加载并且实例预制
  12. #if UNITY_WEBGL || UNITY_WEIXINMINIGAME
  13. #else
  14. _debugConsoleGO = Object.Instantiate(Resources.Load<GameObject>("DebugConsole"));
  15. Opencoding.LogHistory.LogHandler.ConsoleVisibleChangedEvent += OnConsoleVisibleChanged;
  16. #endif
  17. }
  18. [Conditional(MacroDefine.DEBUG), Conditional(MacroDefine.PROFILER)]
  19. public static void Dispose()
  20. {
  21. #if UNITY_WEBGL || UNITY_WEIXINMINIGAME
  22. #else
  23. Object.DestroyImmediate(_debugConsoleGO);
  24. _debugConsoleGO = null;
  25. Opencoding.LogHistory.LogHandler.ConsoleVisibleChangedEvent -= OnConsoleVisibleChanged;
  26. #endif
  27. }
  28. /// <summary>
  29. /// DebugConsole事件
  30. /// </summary>
  31. /// <param name="isVisible"></param>
  32. private static void OnConsoleVisibleChanged(bool isVisible)
  33. {
  34. //冻结热区穿透
  35. //FingerGestureUtility.Freeze(isVisible);
  36. }
  37. }
  38. }