The Swartz-Manning’s first exhibit will provide a detailed history of Aaron Swartz Day. https://www.aaronswartzday.org/vr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pb_UpdateAvailable.cs 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using UnityEngine;
  2. using UnityEditor;
  3. using ProBuilder2.Common;
  4. namespace ProBuilder2.EditorCommon
  5. {
  6. class pb_UpdateAvailable : EditorWindow
  7. {
  8. public static void Init(pb_VersionInfo newVersion, string changelog)
  9. {
  10. pb_UpdateAvailable win = EditorWindow.GetWindow<pb_UpdateAvailable>(true, "ProBuilder Update Available", true);
  11. win.m_NewVersion = newVersion;
  12. win.m_NewChangelog = changelog;
  13. }
  14. [SerializeField] pb_VersionInfo m_NewVersion;
  15. [SerializeField] string m_NewChangelog;
  16. Vector2 scroll = Vector2.zero;
  17. GUIContent gc_DownloadUpdate = new GUIContent("", "Open Asset Store Download Page");
  18. private static GUIStyle downloadImageStyle = null,
  19. updateHeader = null;
  20. private bool checkForProBuilderUpdates
  21. {
  22. get { return pb_PreferencesInternal.GetBool(pb_Constant.pbCheckForProBuilderUpdates, true); }
  23. set { pb_PreferencesInternal.SetBool(pb_Constant.pbCheckForProBuilderUpdates, value); }
  24. }
  25. void OnEnable()
  26. {
  27. pb_AboutWindow.InitGuiStyles();
  28. wantsMouseMove = true;
  29. minSize = new Vector2(400f, 350f);
  30. downloadImageStyle = new GUIStyle()
  31. {
  32. margin = new RectOffset(10, 10, 10, 10),
  33. fixedWidth = 154,
  34. fixedHeight = 85,
  35. normal = new GUIStyleState() {
  36. background = pb_AboutWindow.LoadAssetAtPath<Texture2D>(string.Format("{0}/Images/DownloadPB_Normal.png", pb_AboutWindow.AboutRoot))
  37. },
  38. hover = new GUIStyleState() {
  39. background = pb_AboutWindow.LoadAssetAtPath<Texture2D>(string.Format("{0}/Images/DownloadPB_Hover.png", pb_AboutWindow.AboutRoot))
  40. },
  41. };
  42. updateHeader = new GUIStyle()
  43. {
  44. margin = new RectOffset(0, 0, 0, 0),
  45. alignment = TextAnchor.MiddleCenter,
  46. fixedHeight = 85,
  47. fontSize = 24,
  48. wordWrap = true,
  49. font = pb_AboutWindow.LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", pb_AboutWindow.AboutRoot, pb_AboutWindow.FONT_MEDIUM)),
  50. normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? pb_AboutWindow.font_white : pb_AboutWindow.font_black }
  51. };
  52. }
  53. void OnGUI()
  54. {
  55. GUILayout.BeginHorizontal();
  56. if( GUILayout.Button(gc_DownloadUpdate, downloadImageStyle) )
  57. Application.OpenURL("http://u3d.as/30b");
  58. if(GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
  59. Repaint();
  60. GUILayout.BeginVertical(pb_AboutWindow.changelogStyle);
  61. GUILayout.Label("ProBuilder Update\nAvailable", updateHeader);
  62. GUILayout.EndVertical();
  63. GUILayout.EndHorizontal();
  64. scroll = EditorGUILayout.BeginScrollView(scroll, pb_AboutWindow.changelogStyle);
  65. GUILayout.Label(string.Format("Version: {0}", m_NewVersion.text), pb_AboutWindow.versionInfoStyle);
  66. GUILayout.Label("\n" + m_NewChangelog, pb_AboutWindow.changelogTextStyle);
  67. EditorGUILayout.EndScrollView();
  68. GUILayout.BeginHorizontal();
  69. GUILayout.FlexibleSpace();
  70. checkForProBuilderUpdates = EditorGUILayout.Toggle("Show Update Notifications", checkForProBuilderUpdates);
  71. GUILayout.Space(4);
  72. GUILayout.EndHorizontal();
  73. GUILayout.Space(10);
  74. }
  75. }
  76. }