using System; using System.Linq; using UnityEditor; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; namespace LanLib.Singleton.EditorUtilities { public class SingletonWindow : EditorWindow { const int SourceUpdateInterval = 100; const string UIRootGuid = "f019694f4240ea24281a93f5aab2f756"; const string UIElementGuid = "a33c335b67caf3e41af9c2753dcbb734"; [MenuItem("Tools/LanLib/Singletons")] private static void ShowWindow() { var window = GetWindow(); window.titleContent = new GUIContent("Singletons"); window.Show(); } private void CreateGUI() { var uiRootAsset = GetVisualTreeAssetByGUID(UIRootGuid); var uiElementAsset = GetVisualTreeAssetByGUID(UIElementGuid); uiRootAsset.CloneTree(rootVisualElement); var lst = rootVisualElement.Q("lst"); (lst.makeItem, lst.bindItem) = BindItem(); rootVisualElement.schedule.Execute(UpdateSource).Every(SourceUpdateInterval); (Func, Action) BindItem() { // GameObject gameObject = null; // Label txtName = null; // VisualElement btnInspect = null; // VisualElement btnDestroy = null; // MaskField mask = null; return (OnCreate, OnBind); VisualElement OnCreate() { var ele = uiElementAsset.CloneTree(); var txtName = ele.Q