private static void DrawReviewArea() { if (AssetIconsPreferences.HideReviewDialog.Value) { return; } using (new EditorGUILayout.VerticalScope(reviewBoxStyle, GUILayout.MaxWidth(420.0f))) { EditorGUILayout.LabelField("Write a Review", pageHeaderStyle); var headerRect = GUILayoutUtility.GetLastRect(); headerRect.xMin = headerRect.xMax - headerRect.height; headerRect = new Rect(headerRect.x + 8.0f, headerRect.y + 2.0f, headerRect.width - 8.0f, headerRect.height - 8.0f); var originalColor = GUI.color; GUI.color *= AssetIconsResources.CurrentTheme.CrossNormalColour; GUI.DrawTexture(headerRect, AssetIconsResources.CurrentTheme.CrossIcon); GUI.color = originalColor; if (Event.current.type == EventType.MouseDown && headerRect.Contains(Event.current.mousePosition)) { AssetIconsPreferences.HideReviewDialog.Value = true; } EditorGUIUtility.AddCursorRect(headerRect, MouseCursor.Link); GUILayout.Space(6.0f); EditorGUILayout.BeginHorizontal(); var starsBackground = EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false), GUILayout.MinWidth(200.0f)); originalColor = GUI.color; GUI.color *= new Color(1.0f, 1.0f, 1.0f, 0.35f); GUI.DrawTexture(starsBackground, AssetIconsResources.CurrentTheme.StarBackground); GUI.color = originalColor; EditorGUIUtility.AddCursorRect(starsBackground, MouseCursor.Link); GUILayout.Space(2.0f); for (int i = 0; i < 5; i++) { var rect = GUILayoutUtility.GetRect(40.0f, 40.0f, GUILayout.ExpandWidth(false)); var indentedRect = new Rect(rect.x + starIndent, rect.y + starIndent, rect.width - (starIndent * 2), rect.height - (starIndent * 2)); if (hoveredReviewStar >= i) { GUI.color = AssetIconsResources.CurrentTheme.StarHighlightedColor; } else { GUI.color = AssetIconsResources.CurrentTheme.StarNormalColor; } GUI.DrawTexture(indentedRect, AssetIconsResources.CurrentTheme.StarIcon); if (rect.Contains(Event.current.mousePosition)) { if (hoveredReviewStar != i) { hoveredReviewStar = i; if (preferencesEditorWindow != null) { preferencesEditorWindow.Repaint(); } } if (Event.current.type == EventType.MouseDown) { EditorProductInformation.WriteReview(hoveredReviewStar); AssetIconsPreferences.HideReviewDialog.Value = true; } } } GUI.color = originalColor; GUILayout.Space(2.0f); EditorGUILayout.EndHorizontal(); GUILayout.Space(10.0f); var reactionRect = GUILayoutUtility.GetRect(40.0f, 40.0f, GUILayout.ExpandWidth(false)); if (Event.current.type != EventType.Layout) { if (starsBackground.Contains(Event.current.mousePosition)) { if (hoveredReviewStar != -1) { originalColor = GUI.color; GUI.color *= new Color(1.0f, 1.0f, 1.0f, 0.55f); GUI.DrawTexture(reactionRect, AssetIconsResources.CurrentTheme.EmojisBackground); GUI.color = originalColor; var indentedRectionRect = new Rect(reactionRect.x + starIndent, reactionRect.y + starIndent, reactionRect.width - (starIndent * 2), reactionRect.height - (starIndent * 2)); GUI.DrawTexture(indentedRectionRect, AssetIconsResources.CurrentTheme.EmojisForRatings[hoveredReviewStar]); } } else { if (hoveredReviewStar != -1) { hoveredReviewStar = -1; if (preferencesEditorWindow != null) { preferencesEditorWindow.Repaint(); } } } } EditorGUILayout.EndHorizontal(); GUILayout.Space(6.0f); EditorGUILayout.LabelField("It’s great to hear all of your wonderful feedback. If you have a moment, feel free to write a review.", pageTextStyle); GUILayout.Space(2.0f); } }
private static void DrawPreferences(SerializedObject preferences) { if (linkLable == null) { linkLable = new GUIStyle(EditorStyles.label); linkLable.normal.textColor = new Color(0.0f, 0.0f, 1.0f); linkLable.hover.textColor = new Color(0.0f, 0.0f, 1.0f); linkLable.active.textColor = new Color(0.5f, 0.0f, 0.5f); } if (pageStyle == null) { pageStyle = new GUIStyle { padding = new RectOffset(12, 12, 0, 0) }; } EditorGUILayout.BeginVertical(pageStyle); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(versionString); GUILayout.FlexibleSpace(); if (GUILayout.Button("Issue Tracker", linkLable)) { Application.OpenURL(ProductInformation.IssueTracker); } } GUILayout.Space(10); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Ask a Question")) { EditorProductInformation.SubmitIssue(EditorProductInformation.IssueType.Question); } if (GUILayout.Button("Report a Bug")) { EditorProductInformation.SubmitIssue(EditorProductInformation.IssueType.Bug); } if (GUILayout.Button("Request a Feature")) { EditorProductInformation.SubmitIssue(EditorProductInformation.IssueType.Feature); } } if (GUILayout.Button("Check for Updates")) { AssetIconsUpdateCheckerWindow.Open(); } GUILayout.Space(10); preferences.Update(); EditorGUI.BeginChangeCheck(); foreach (string propertyString in propertyStrings) { var property = preferences.FindProperty(propertyString); EditorGUILayout.PropertyField(property, new GUIContent(property.displayName, property.tooltip)); } if (EditorGUI.EndChangeCheck()) { preferences.ApplyModifiedProperties(); EditorPrefs.SetString(AssetIconsPreferences.EditorPrefsKey, JsonUtility.ToJson(AssetIconsPreferences.CurrentPreferences)); } EditorGUILayout.EndVertical(); }