using BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject; using UnityEngine; using Framework; using PhxhSDK; using SRF; //屏幕相关debug类 public class DebugScreen: Singlenton { public bool IsShowSafeArea; private GameObject _goSafeArea; private DebugScreenMono _debugScreenMono; //显示安全区域 private async void _ShowSafeArea() { // var prefabPath = "Assets/Art/UI/Prefab/Debug/DebugScreenSafeArea.prefab"; // var asset = await AssetManager.Instance.LoadAssetAsync(prefabPath); // if (!_goSafeArea) // { // _goSafeArea = Object.Instantiate(asset, UIRoot.Instance.Root.transform); // } if (!_debugScreenMono) { _debugScreenMono = UIRoot.Instance.Root.AddComponent(); } } private void _DestroySafeArea() { // Object.DestroyImmediate(_goSafeArea); // _goSafeArea = null; UIRoot.Instance.Root.RemoveComponentIfExists(); _debugScreenMono = null; } public void DrawSafeAreaRect() { var rect = Screen.safeArea; rect.height = -rect.height; rect.y = Screen.height - rect.y; GUI.Box(rect, ""); } public void DebugChangeShowAreaState() { if (IsShowSafeArea) { _ShowSafeArea(); return; } _DestroySafeArea(); } }