DragonECS-Unity/src/Tools/DeepDebugger/Editors/DeepDebuggerWindow.cs

48 lines
1.3 KiB
C#
Raw Normal View History

2025-03-20 10:34:20 +08:00
#if UNITY_EDITOR
using DCFApixels.DragonECS.Unity.Internal;
using UnityEditor;
using UnityEngine;
namespace DCFApixels.DragonECS.Unity.Editors
{
internal class DeepDebuggerWindow : EditorWindow
{
public const string TITLE = "DeepDebuggerWindow";
#if DRAGONECS_DEEP_DEBUG
[MenuItem("Tools/" + EcsConsts.FRAMEWORK_NAME + "/" + TITLE)]
static void Open()
{
var wnd = GetWindow<DeepDebuggerWindow>();
wnd.titleContent = new GUIContent(TITLE);
wnd.minSize = new Vector2(100f, 120f);
wnd.Show();
}
#endif
private Vector2 pos;
private void OnGUI()
{
var dicst = ScriptsCache.MetaIDScriptPathPairs;
pos = GUILayout.BeginScrollView(pos);
if (GUILayout.Button("Reset"))
{
ScriptsCache.Reinit();
}
foreach (var (metaID, scriptPath) in dicst)
{
GUILayout.Label("", GUILayout.ExpandWidth(true));
Rect rect = GUILayoutUtility.GetLastRect();
var (leftRect, rightRect) = rect.HorizontalSliceLerp(0.5f);
GUI.Label(leftRect, metaID);
GUI.Label(rightRect, scriptPath);
}
GUILayout.EndScrollView();
}
}
}
#endif