LabelUtilityLabelUtilityWindow.cs 1.3 KB

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