1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 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<LabelUtilityWindow>(inspectorType);
- window.titleContent = new GUIContent("LabelUtility");
- window.Show();
- }
- private void OnEnable()
- {
- Instance = InstanceManager.SearchInstance<LabelUtility>();
- 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<string>();
- Instance.DllNames.Add("UnityEngine");
- Instance.DllNames.Add("UnityEngine.UI");
- }
- if (!Instance.EventStrings.Valid())
- {
- Instance.EventStrings = new List<ComponentEventString>();
- ComponentEventString eventString = new ComponentEventString();
- eventString.ComponentType = ComponentType.Button;
- eventString.RegistStrings = new List<string>();
- eventString.RegistStrings.Add("#NEWNAME.onClick.AddListener(On#NEWNAMEClick)");
- eventString.MethodNames = new List<string>();
- eventString.MethodNames.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();
- }
- }
- }
|