LabelUtilityLabelUtilityWindow.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text.RegularExpressions;
  7. using AtlasUtility;
  8. using UnityEditor;
  9. using UnityEngine;
  10. public class LabelUtilityWindow : EditorWindow
  11. {
  12. #region Config
  13. protected LabelUtility Instance;
  14. protected SerializedProperty Prefabs;
  15. protected SerializedProperty TextAsset;
  16. protected SerializedObject SerializedObject;
  17. #endregion
  18. [MenuItem("DashGame/LabelUtility")]
  19. protected static void ShowWindow()
  20. {
  21. Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll");
  22. LabelUtilityWindow window = GetWindow<LabelUtilityWindow>(inspectorType);
  23. window.titleContent = new GUIContent("LabelUtility");
  24. window.Show();
  25. }
  26. private void OnEnable()
  27. {
  28. Instance = InstanceManager.SearchInstance<LabelUtility>();
  29. SerializedObject = new SerializedObject(Instance);
  30. Prefabs = SerializedObject.FindProperty("Prefabs");
  31. TextAsset = SerializedObject.FindProperty("TextAsset");
  32. }
  33. private void OnGUI()
  34. {
  35. SerializedObject.Update();
  36. EditorGUILayout.PropertyField(Prefabs, new GUIContent("UIPrefab"), true);
  37. EditorGUILayout.PropertyField(TextAsset, new GUIContent("TextAsset"));
  38. if (GUILayout.Button("CreateLabels"))
  39. {
  40. Instance.CreateLabels();
  41. }
  42. SerializedObject.ApplyModifiedProperties();
  43. }
  44. }