CompassNavigatorProAbout.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4. namespace CompassNavigatorPro {
  5. public class CompassProAbout : EditorWindow {
  6. Texture2D _headerTexture, _blackTexture;
  7. GUIStyle richLabelStyle;
  8. GUIStyle blackStyle;
  9. public static void ShowAboutWindow() {
  10. float height = 350.0f;
  11. float width = 515.0f;
  12. Rect rect = new Rect(Screen.width * 0.5f - width * 0.5f, Screen.height * 0.5f - height * 0.5f, width, height);
  13. GetWindowWithRect<CompassProAbout>(rect, true, "About Compass Navigator Pro", true);
  14. }
  15. void OnEnable() {
  16. Color backColor = EditorGUIUtility.isProSkin ? new Color (0.18f, 0.18f, 0.18f) : new Color (0.7f, 0.7f, 0.7f);
  17. _blackTexture = MakeTex (4, 4, backColor);
  18. _blackTexture.hideFlags = HideFlags.DontSave;
  19. _headerTexture = Resources.Load<Texture2D> ("CNPro/CompassNavigatorProHeader");
  20. blackStyle = new GUIStyle ();
  21. blackStyle.normal.background = _blackTexture;
  22. }
  23. void OnGUI(){
  24. if (richLabelStyle==null) {
  25. richLabelStyle = new GUIStyle(GUI.skin.label);
  26. richLabelStyle.richText = true;
  27. richLabelStyle.wordWrap = true;
  28. }
  29. EditorGUILayout.Separator ();
  30. GUI.skin.label.alignment = TextAnchor.MiddleCenter;
  31. GUILayout.Label (_headerTexture, GUILayout.ExpandWidth (true));
  32. GUI.skin.label.alignment = TextAnchor.MiddleLeft;
  33. EditorGUILayout.Separator ();
  34. EditorGUILayout.Separator ();
  35. EditorGUILayout.BeginHorizontal();
  36. GUILayout.Label("<b>Compass Navigator Pro</b>\nCopyright (C) by Kronnect", richLabelStyle);
  37. EditorGUILayout.EndHorizontal();
  38. EditorGUILayout.Separator ();
  39. GUILayout.Label("Thanks for purchasing!");
  40. EditorGUILayout.Separator ();
  41. EditorGUILayout.Separator ();
  42. EditorGUILayout.Separator ();
  43. EditorGUILayout.BeginHorizontal();
  44. if(GUILayout.Button("Support Forum and more assets!", GUILayout.Height(40))){
  45. Application.OpenURL("http://kronnect.me");
  46. }
  47. if(GUILayout.Button("Rate this Asset", GUILayout.Height(40))){
  48. Application.OpenURL("com.unity3d.kharma:content/49858");
  49. }
  50. if(GUILayout.Button("Close Window", GUILayout.Height(40))){
  51. Close();
  52. }
  53. EditorGUILayout.EndHorizontal();
  54. EditorGUILayout.Separator ();
  55. }
  56. Texture2D MakeTex (int width, int height, Color col) {
  57. Color[] pix = new Color[width * height];
  58. for (int i = 0; i < pix.Length; i++)
  59. pix [i] = col;
  60. Texture2D result = new Texture2D (width, height);
  61. result.SetPixels (pix);
  62. result.Apply ();
  63. return result;
  64. }
  65. }
  66. }