35 lines
1008 B
C#
35 lines
1008 B
C#
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;
|
|
Debug.Log(stage.assetPath);
|
|
Debug.Log(setting.prefabForUIDirPath);
|
|
if (!stage.assetPath.StartsWith(setting.prefabForUIDirPath)) return;
|
|
|
|
// 打开配置界面
|
|
PanelCacheWindow.ShowWindow(stage);
|
|
}
|
|
|
|
private static void OnPrefabStageClosing(PrefabStage stage)
|
|
{
|
|
// 关闭配置界面
|
|
PanelCacheWindow.CloseWindow();
|
|
}
|
|
}
|
|
} |