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.RegistStrings = new List(); eventString.RegistStrings.Add("#NEWNAME.onClick.AddListener(On#NEWNAMEClick)"); eventString.MethodNames = new List(); eventString.MethodNames.Add("void On#NEWNAMEClick()"); Instance.EventStrings.Add(eventString); eventString = new ComponentEventString(); eventString.ComponentType = ComponentType.Text; eventString.RegistStrings = new List(); eventString.RegistStrings.Add("LanguageManager.Add(#NEWNAME, new MulLanStr(LanguageLabel.#NAME))"); eventString.MethodNames = new List(); eventString.MethodNames.Add("On#NEWNAMEClick"); Instance.EventStrings.Add(eventString); eventString = new ComponentEventString(); eventString.ComponentType = ComponentType.VirtualScrollRectPlus; eventString.RegistStrings = new List(); eventString.RegistStrings.Add("#NAME.OnSaveItem += OnSave#NAMEItem"); eventString.RegistStrings.Add("#NAME.OnGetNextItem += OnGetNext#NAMEItem"); eventString.RegistStrings.Add("#NAME.OnGetPreviousItem += OnGetPrevious#NAMEItem"); eventString.MethodNames = new List(); eventString.MethodNames.Add("void OnSave#NAMEItem(int index, VirtualScrollRectItem item)"); eventString.MethodNames.Add("VirtualScrollRectItem OnGetNext#NAMEItem(int index)"); eventString.MethodNames.Add("VirtualScrollRectItem OnGetPrevious#NAMEItem(int index)"); 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(); } } }