123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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.Strings = new List<string>();
- 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();
- }
- }
- }
|