public void PostDraw() { SidekickEditorGUI.DrawSplitter(); GUILayout.Label("Output", EditorStyles.boldLabel); outputScrollPosition = EditorGUILayout.BeginScrollView(outputScrollPosition, GUILayout.MaxHeight(100)); foreach (var outputObject in outputObjects) { if (TypeUtility.IsNotNull(outputObject)) { string name = outputObject switch { Object unityObject => $"{unityObject.name}", _ => outputObject.ToString() }; if (GUILayout.Button($"Select {name} ({TypeUtility.NameForType(outputObject.GetType())})")) { SidekickWindow.Current.SetSelection(outputObject); } } else { using (new EditorGUI.DisabledScope(true)) { GUILayout.Button("null"); } } } if (opacity > 0) { Rect lastRect = GUILayoutUtility.GetLastRect(); Color baseColor = new Color(0, 0, 1, 0.3f * opacity); GUI.color = baseColor; GUI.DrawTexture(lastRect, EditorGUIUtility.whiteTexture); baseColor.a = 0.8f * opacity; GUI.color = baseColor; float lineThickness = 2; GUI.DrawTexture(new Rect(lastRect.xMin, lastRect.yMin, lineThickness, lastRect.height), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(lastRect.xMax - lineThickness, lastRect.yMin, lineThickness, lastRect.height), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(lastRect.xMin + lineThickness, lastRect.yMin, lastRect.width - lineThickness * 2, lineThickness), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(lastRect.xMin + lineThickness, lastRect.yMax - lineThickness, lastRect.width - lineThickness * 2, lineThickness), EditorGUIUtility.whiteTexture); GUI.color = Color.white; opacity -= AnimationHelper.DeltaTime; AnimationHelper.SetAnimationActive(); } EditorGUILayout.EndScrollView(); }
private static void DrawExtensions(object fieldValue, GUIStyle expandButtonStyle) { bool wasGUIEnabled = GUI.enabled; GUI.enabled = TypeUtility.IsNotNull(fieldValue); if (GUILayout.Button(new GUIContent(SidekickEditorGUI.ForwardIcon, "Select This"), expandButtonStyle, GUILayout.Width(18), GUILayout.Height(18))) { SidekickWindow.Current.SetSelection(fieldValue); } Rect rect = GUILayoutUtility.GetRect(18, 18, expandButtonStyle, GUILayout.Width(18)); if (GUI.Button(rect, new GUIContent(SidekickEditorGUI.MoreOptions, "More Options"), expandButtonStyle)) { var menu = ClassUtilities.GetMenu(fieldValue, null); menu.DropDown(rect); } GUI.enabled = wasGUIEnabled; }