MediaPlayerEditor_AboutHelp.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using UnityEngine;
  2. using UnityEditor;
  3. //-----------------------------------------------------------------------------
  4. // Copyright 2015-2021 RenderHeads Ltd. All rights reserved.
  5. //-----------------------------------------------------------------------------
  6. namespace RenderHeads.Media.AVProVideo.Editor
  7. {
  8. /// <summary>
  9. /// About/Help section of the editor for the MediaPlayer component
  10. /// </summary>
  11. public partial class MediaPlayerEditor : UnityEditor.Editor
  12. {
  13. public const string LinkPluginWebsite = "https://renderheads.com/products/avpro-video/";
  14. public const string LinkForumPage = "https://forum.unity.com/threads/released-avpro-video-complete-video-playback-solution.385611/";
  15. public const string LinkForumLastPage = "https://forum.unity.com/threads/released-avpro-video-complete-video-playback-solution.385611/page-100";
  16. public const string LinkGithubIssues = "https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues";
  17. public const string LinkGithubIssuesNew = "https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/new/choose";
  18. public const string LinkAssetStorePage = "https://assetstore.unity.com/packages/slug/181844?aid=1101lcNgx";
  19. public const string LinkUserManual = "https://www.renderheads.com/content/docs/AVProVideo/";
  20. public const string LinkScriptingClassReference = "https://www.renderheads.com/content/docs/AVProVideo/api/RenderHeads.Media.AVProVideo.html";
  21. public const string LinkPurchase = "https://www.renderheads.com/content/docs/AVProVideo/articles/download.html";
  22. private struct Native
  23. {
  24. #if UNITY_EDITOR_WIN
  25. [System.Runtime.InteropServices.DllImport("AVProVideo")]
  26. public static extern System.IntPtr GetPluginVersion();
  27. #elif UNITY_EDITOR_OSX
  28. [System.Runtime.InteropServices.DllImport("AVProVideo")]
  29. public static extern System.IntPtr AVPPluginGetVersionStringPointer();
  30. #endif
  31. }
  32. private static string GetPluginVersion()
  33. {
  34. string version = "Unknown";
  35. try
  36. {
  37. #if UNITY_EDITOR_WIN
  38. version = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(Native.GetPluginVersion());
  39. #elif UNITY_EDITOR_OSX
  40. version = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(Native.AVPPluginGetVersionStringPointer());
  41. #endif
  42. }
  43. catch (System.DllNotFoundException e)
  44. {
  45. #if UNITY_EDITOR_OSX
  46. Debug.LogError("[AVProVideo] Failed to load Bundle. " + e.Message);
  47. #else
  48. Debug.LogError("[AVProVideo] Failed to load DLL. " + e.Message);
  49. #endif
  50. }
  51. return version;
  52. }
  53. private static Texture2D GetIcon(Texture2D icon)
  54. {
  55. if (icon == null)
  56. {
  57. icon = Resources.Load<Texture2D>("AVProVideoIcon");
  58. }
  59. return icon;
  60. }
  61. private void OnInspectorGUI_About()
  62. {
  63. EditorGUILayout.BeginHorizontal();
  64. GUILayout.FlexibleSpace();
  65. _icon = GetIcon(_icon);
  66. if (_icon != null)
  67. {
  68. GUILayout.Label(new GUIContent(_icon));
  69. }
  70. GUILayout.FlexibleSpace();
  71. EditorGUILayout.EndHorizontal();
  72. GUI.color = Color.yellow;
  73. EditorHelper.IMGUI.CentreLabel("AVPro Video by RenderHeads Ltd", EditorStyles.boldLabel);
  74. EditorHelper.IMGUI.CentreLabel("version " + Helper.AVProVideoVersion + " (plugin v" + GetPluginVersion() + ")");
  75. GUI.color = Color.white;
  76. GUI.backgroundColor = Color.white;
  77. if (_icon != null)
  78. {
  79. GUILayout.Space(8f);
  80. ShowSupportWindowButton();
  81. GUILayout.Space(8f);
  82. }
  83. EditorGUILayout.LabelField("Links", EditorStyles.boldLabel);
  84. GUILayout.Space(8f);
  85. EditorGUILayout.LabelField("Documentation");
  86. if (GUILayout.Button("User Manual, FAQ, Release Notes", GUILayout.ExpandWidth(false)))
  87. {
  88. Application.OpenURL(LinkUserManual);
  89. }
  90. if (GUILayout.Button("Scripting Class Reference", GUILayout.ExpandWidth(false)))
  91. {
  92. Application.OpenURL(LinkScriptingClassReference);
  93. }
  94. GUILayout.Space(16f);
  95. GUILayout.Label("Bugs and Support");
  96. if (GUILayout.Button("Open Help & Support", GUILayout.ExpandWidth(false)))
  97. {
  98. SupportWindow.Init();
  99. }
  100. GUILayout.Space(16f);
  101. GUILayout.Label("Rate and Review (★★★★☆)", GUILayout.ExpandWidth(false));
  102. if (GUILayout.Button("Asset Store Page", GUILayout.ExpandWidth(false)))
  103. {
  104. Application.OpenURL(LinkAssetStorePage);
  105. }
  106. GUILayout.Space(16f);
  107. GUILayout.Label("Community");
  108. if (GUILayout.Button("Forum Thread", GUILayout.ExpandWidth(false)))
  109. {
  110. Application.OpenURL(LinkForumPage);
  111. }
  112. GUILayout.Space(16f);
  113. GUILayout.Label("Homepage", GUILayout.ExpandWidth(false));
  114. if (GUILayout.Button("Official Website", GUILayout.ExpandWidth(false)))
  115. {
  116. Application.OpenURL(LinkPluginWebsite);
  117. }
  118. GUILayout.Space(32f);
  119. EditorGUILayout.LabelField("Credits", EditorStyles.boldLabel);
  120. GUILayout.Space(8f);
  121. EditorHelper.IMGUI.CentreLabel("Programming", EditorStyles.boldLabel);
  122. EditorHelper.IMGUI.CentreLabel("Andrew Griffiths");
  123. EditorHelper.IMGUI.CentreLabel("Morris Butler");
  124. EditorHelper.IMGUI.CentreLabel("Ste Butcher");
  125. EditorHelper.IMGUI.CentreLabel("Richard Turnbull");
  126. EditorHelper.IMGUI.CentreLabel("Sunrise Wang");
  127. EditorHelper.IMGUI.CentreLabel("Muano Mainganye");
  128. EditorHelper.IMGUI.CentreLabel("Shane Marks");
  129. GUILayout.Space(8f);
  130. EditorHelper.IMGUI.CentreLabel("Graphics", EditorStyles.boldLabel);
  131. GUILayout.Space(8f);
  132. EditorHelper.IMGUI.CentreLabel("Jeff Rusch");
  133. EditorHelper.IMGUI.CentreLabel("Luke Godward");
  134. GUILayout.Space(32f);
  135. }
  136. }
  137. }