APINavigation.cs 1018 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using UnityEditor;
  2. using UnityEngine;
  3. using UnityToolbarExtender;
  4. [InitializeOnLoad]
  5. class APINavigation : INavigation
  6. {
  7. public int Order => 50;
  8. static APINavigation()
  9. {
  10. ToolbarExtender.AddToLeft(new APINavigation());
  11. }
  12. public void OnGUI()
  13. {
  14. EditorGUI.BeginDisabledGroup(Application.isPlaying);
  15. if (GUILayout.Button("Unity API", ToolbarStyles.apiButtonStyle))
  16. {
  17. Application.OpenURL("https://docs.unity.cn/cn/current/Manual/index.html");
  18. }
  19. EditorGUI.EndDisabledGroup();
  20. }
  21. static class ToolbarStyles
  22. {
  23. public static readonly GUIStyle apiButtonStyle;
  24. static ToolbarStyles()
  25. {
  26. apiButtonStyle = new GUIStyle("Command")
  27. {
  28. fixedWidth = 80,
  29. fontSize = 13,
  30. alignment = TextAnchor.MiddleCenter,
  31. imagePosition = ImagePosition.ImageAbove,
  32. fontStyle = FontStyle.Bold
  33. };
  34. }
  35. }
  36. }