AlicizaX/Client/Packages/com.alicizax.uxtool/Editor/UXGUI/SceneView/UIEditWindow/UXComponentCreateWindow.cs

35 lines
1.0 KiB
C#
Raw Normal View History

2025-12-01 16:46:28 +08:00
using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace AlicizaX.UXTool
2025-12-01 16:46:28 +08:00
{
public class UXComponentCreateWindow : EditorWindow
{
public void SetCreateData(string path, System.Action callback)
{
uxCreateWindowVisualAsset.SetCallBack(path, callback);
}
private UXCreateWindowVisualAsset uxCreateWindowVisualAsset;
private void CreateGUI()
{
uxCreateWindowVisualAsset = new UXCreateWindowVisualAsset();
rootVisualElement.Add(uxCreateWindowVisualAsset);
}
}
public static class UXComponentCreateWindowHelper
{
public static void ShowWindow(string path, Action createCallBack)
{
UXComponentCreateWindow window = EditorWindow.GetWindow<UXComponentCreateWindow>(true, "创建组件");
window.maxSize = new Vector2(400, 150);
window.minSize = new Vector2(400, 150);
window.Show();
window.SetCreateData(path, createCallBack);
}
}
}