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); pageBodyStyle = new GUIStyle { #if UNITY_2019_1_OR_NEWER padding = new RectOffset(12, 12, 0, 0) #else padding = new RectOffset(0, 4, 0, 0) #endif }; pageTextStyle = new GUIStyle(EditorStyles.label) { wordWrap = true }; reviewBoxStyle = new GUIStyle(EditorStyles.helpBox) { padding = new RectOffset(8, 8, 8, 8) }; int fontSize = EditorStyles.label.fontSize; if (fontSize <= 2) { fontSize = 10; } pageHeaderStyle = new GUIStyle(EditorStyles.boldLabel) { fontSize = fontSize + 2, normal = new GUIStyleState() { textColor = EditorStyles.boldLabel.normal.textColor * new Color(1.0f, 1.0f, 1.0f, 0.8f) } }; githubSectionBlock = new GUIStyle() { padding = new RectOffset(6, 6, 5, 5) }; } if (preferencesEditorWindow == null) { string preferencesMenu; #if UNITY_2019_1_OR_NEWER preferencesMenu = "PreferenceSettingsWindow"; #else preferencesMenu = "PreferencesWindow"; #endif if (EditorWindow.focusedWindow != null && EditorWindow.focusedWindow.GetType().Name == preferencesMenu) { preferencesEditorWindow = EditorWindow.focusedWindow; } } if (preferencesEditorWindow != null) { preferencesEditorWindow.wantsMouseMove = true; } EditorGUILayout.BeginVertical(pageBodyStyle); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(versionString); GUILayout.FlexibleSpace(); if (GUILayout.Button("Issue Tracker", linkLable)) { Application.OpenURL(ProductInformation.IssueTracker); } var rect = GUILayoutUtility.GetLastRect(); EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link); } GUILayout.Space(10.0f); if (GUILayout.Button("Check for Updates")) { AssetIconsUpdateCheckerWindow.Open(); } float labelWidth = EditorGUIUtility.labelWidth; #if !UNITY_2019_1_OR_NEWER EditorGUIUtility.labelWidth -= 60.0f; #endif GUILayout.Space(10.0f); DrawConfigurationSection(preferences); GUILayout.Space(10.0f); DrawUnityAssetStoreSection(); GUILayout.Space(10.0f); DrawReviewArea(); GUILayout.Space(14.0f); DrawGithubSection(); GUILayout.Space(10.0f); EditorGUIUtility.labelWidth = labelWidth; GUILayout.FlexibleSpace(); EditorGUILayout.LabelField(ProductInformation.Copyright, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.EndVertical(); }
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(); }