namespace labelUtility { using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; using UnityEditor; using UnityEngine; public class LabelUtilityWindow : EditorWindow { #region Config protected Vector2 ScrollPosition; protected LabelUtility Instance; protected SerializedProperty LabelSets; protected SerializedProperty DllNames; protected SerializedProperty EventStrings; protected SerializedObject SerializedObject; #endregion [MenuItem("DashGame/LabelUtility")] protected static void ShowWindow() { Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); LabelUtilityWindow window = GetWindow(inspectorType); window.titleContent = new GUIContent("LabelUtility"); window.Show(); } private void OnEnable() { Instance = InstanceManager.SearchInstance(); SerializedObject = new SerializedObject(Instance); LabelSets = SerializedObject.FindProperty("LabelSets"); DllNames = SerializedObject.FindProperty("DllNames"); EventStrings = SerializedObject.FindProperty("EventStrings"); } private void OnGUI() { SerializedObject.Update(); ScrollPosition = EditorGUILayout.BeginScrollView(ScrollPosition); if (!Instance.DllNames.Valid()) { Instance.DllNames = new List(); Instance.DllNames.Add("UnityEngine"); Instance.DllNames.Add("UnityEngine.UI"); } if (!Instance.EventStrings.Valid()) { Instance.EventStrings = new List(); ComponentEventString eventString = new ComponentEventString(); eventString.ComponentType = ComponentType.Button; eventString.Strings = new List(); eventString.Strings.Add("On#NEWNAMEClick"); Instance.EventStrings.Add(eventString); } EditorGUILayout.PropertyField(DllNames, new GUIContent("DllNames"), true); EditorGUILayout.PropertyField(EventStrings, new GUIContent("EventStrings"), true); EditorGUILayout.PropertyField(LabelSets, new GUIContent("LabelSets"), true); EditorGUILayout.EndScrollView(); SerializedObject.ApplyModifiedProperties(); } } }