EditorGuiUtils.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UnityEditor;
  6. using UnityEngine;
  7. namespace TheraBytes.BetterUi.Editor
  8. {
  9. public static class EditorGuiUtils
  10. {
  11. public const string ObsoleteMessage = "This method is obsolete.You most probably need to update the Better TextMesh Pro package. Please check the upgrade guide for more information: https://documentation.therabytes.de/better-ui/UpgradeGuide.html ";
  12. public static void DrawOldMethodCallWarning()
  13. {
  14. EditorGUILayout.HelpBox(@"Calling an old method. You probably need to update the Better TextMesh Pro package.
  15. Please install the right 'BetterUI_TextMeshPro' package found at 'Assets/TheraBytes/BetterUI/Packages' (probably you need the package that ends with '_EditorPanelUI').
  16. For more information, please read the upgrade guide.", MessageType.Warning);
  17. if (GUILayout.Button("Open Upgrade Guide", "minibutton"))
  18. {
  19. Application.OpenURL("https://documentation.therabytes.de/better-ui/UpgradeGuide.html");
  20. }
  21. EditorGUILayout.Space();
  22. }
  23. #region Backwards Compatibility Methods
  24. [Obsolete(ObsoleteMessage)]
  25. public static void DrawLayoutList<T>(string listTitle,
  26. List<T> list, SerializedProperty listProp, ref int count, ref bool foldout,
  27. Action<SerializedProperty> createCallback, Action<T, SerializedProperty> drawItemCallback)
  28. {
  29. DrawOldMethodCallWarning();
  30. }
  31. [Obsolete(ObsoleteMessage)]
  32. public static void DrawLayoutList<T>(string listTitle,
  33. List<T> list, SerializedProperty listProp, ref int count,
  34. Action<SerializedProperty> createCallback, Action<T, SerializedProperty> drawItemCallback)
  35. {
  36. DrawOldMethodCallWarning();
  37. }
  38. [Obsolete(ObsoleteMessage)]
  39. public static void DrawLayoutList<T>(string listTitle, bool usingFoldout,
  40. List<T> list, SerializedProperty listProp, ref int count, ref bool foldout,
  41. Action<SerializedProperty> createCallback, Action<T, SerializedProperty> drawItemCallback)
  42. {
  43. DrawOldMethodCallWarning();
  44. }
  45. [Obsolete(ObsoleteMessage)]
  46. public static void DrawTransitions(string title,
  47. List<Transitions> transitions, SerializedProperty transitionsProp, ref int count,
  48. params string[] stateNames)
  49. {
  50. DrawOldMethodCallWarning();
  51. }
  52. #endregion
  53. }
  54. }