LabelUtilityWindow.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. namespace labelUtility
  2. {
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text.RegularExpressions;
  9. using UnityEditor;
  10. using UnityEngine;
  11. public class LabelUtilityWindow : EditorWindow
  12. {
  13. #region Config
  14. protected Vector2 ScrollPosition;
  15. protected LabelUtility Instance;
  16. protected SerializedProperty LabelSets;
  17. protected SerializedObject SerializedObject;
  18. #endregion
  19. [MenuItem("DashGame/LabelUtility")]
  20. protected static void ShowWindow()
  21. {
  22. Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll");
  23. LabelUtilityWindow window = GetWindow<LabelUtilityWindow>(inspectorType);
  24. window.titleContent = new GUIContent("LabelUtility");
  25. window.Show();
  26. }
  27. private void OnEnable()
  28. {
  29. Instance = InstanceManager.SearchInstance<LabelUtility>();
  30. SerializedObject = new SerializedObject(Instance);
  31. LabelSets = SerializedObject.FindProperty("LabelSets");
  32. }
  33. private void OnGUI()
  34. {
  35. SerializedObject.Update();
  36. ScrollPosition = EditorGUILayout.BeginScrollView(ScrollPosition);
  37. EditorGUILayout.PropertyField(LabelSets, new GUIContent("LabelSets"), true);
  38. //if (GUILayout.Button("CreateLabelScript"))
  39. //{
  40. // LabelUtility.CreateLabelScript(Instance.LabelSets[0]);
  41. //}
  42. //if (GUILayout.Button("CreateComponentScript"))
  43. //{
  44. // LabelUtility.CreateComponentScript(Instance.LabelSets[0]);
  45. //}
  46. //if (GUILayout.Button("CreateLabelFromPrefab"))
  47. //{
  48. // LabelUtility.CreateLabelFromPrefab(Instance.LabelSets[0]);
  49. //}
  50. //if (GUILayout.Button("CreateComponentsFromPrefab"))
  51. //{
  52. // LabelUtility.CreateComponentsFromPrefab(Instance.LabelSets[0], InitPurview.Text, InitPurview.Button, InitPurview.SpriteRenderer);
  53. //}
  54. EditorGUILayout.EndScrollView();
  55. SerializedObject.ApplyModifiedProperties();
  56. }
  57. }
  58. }