#if UNITY_EDITOR using Sirenix.OdinInspector.Editor; using UguiToolkit.Editor.Windows; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; namespace UguiToolkit.Editor { public static class PanelHelper { [InitializeOnLoadMethod] public static void AddListener() { PrefabStage.prefabStageOpened += OnPrefabStageOpened; PrefabStage.prefabStageClosing += OnPrefabStageClosing; } private static void OnPrefabStageOpened(PrefabStage stage) { var setting = GlobalManager.Instance.setting; if (stage.assetPath == null || !setting || string.IsNullOrEmpty(setting.prefabForUIDirPath) || !stage.assetPath.StartsWith(setting.prefabForUIDirPath)) return; // 打开配置界面 PanelCacheWindow.ShowWindow(new PanelCacheWindow.PanelCacheWindowArgs { stage = stage, }); } private static void OnPrefabStageClosing(PrefabStage stage) { // 关闭界面 PanelCacheWindow.CloseWindow(); EditWindow.CloseWindow(); } /// /// 创建热键 SPACE /// /// [MenuItem("GameObject/拼接助手/应用上次变换 _SPACE", false, 5)] public static void JumpOfGameCameraByCurPos(MenuCommand menuCommand) { if (StageManager.Instance) { var entityMng = StageManager.Instance.GetManager(); if (entityMng && Selection.activeGameObject) { entityMng.EffectLastApplyTransform(Selection.activeGameObject.transform); } } } } } #endif