private void DrawFirstToolbar() { //选项 GUILayout.Space(1); Rect rect = GUILayoutUtility.GetRect(0f, ToolbarHeight, SirenixGUIStyles.ToolbarBackground); rect = rect.SetHeight(ToolbarHeight); var opptionWidth = SirenixGUIStyles.LeftAlignedCenteredLabel.CalcSize(this.m_optionGui).x * 2f; Rect leftRect = rect.AlignLeft(opptionWidth); OdinSelector <int> .DrawSelectorDropdown(leftRect, this.m_optionGui, this.SelectType, btnStyle); //搜索 Rect filterRect = rect.AlignRight(opptionWidth * 2); Rect searchRect = rect.SetXMax(filterRect.xMin).SetXMin(opptionWidth); searchRect = searchRect.HorizontalPadding(5f).AlignMiddle(16); this.m_sSearchKeyName = SirenixEditorGUI.SearchField(searchRect, this.m_sSearchKeyName); //数据类型过滤 EditorGUI.BeginChangeCheck(); this.m_eDataFilterType = EnumSelector <EPlayerPrefsType> .DrawEnumField(filterRect, null, new GUIContent("Type Filter"), this.m_eDataFilterType, CaomaoPlayerPrefsWindow.btnStyle); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetInt("CaomaoPlayerPrefsWindow.m_eDataFilterType", (int)this.m_eDataFilterType); } }
public void DrawOverview() { if (Event.current.type == EventType.Layout && this.nextDisplay != null) { this.Display = this.nextDisplay.Value; this.nextDisplay = null; this.Update(); } if (Event.current.type == EventType.Layout && this.shouldSort) { this.shouldSort = false; this.Sort(); } EnumBtnStyle = EnumBtnStyle ?? new GUIStyle(EditorStyles.toolbarDropDown); EnumBtnStyle.stretchHeight = true; EnumBtnStyle.fixedHeight = this.Tree.Config.SearchToolbarHeight; GUILayout.BeginHorizontal(GUILayoutOptions.ExpandHeight()); { var rect = GUIHelper.GetCurrentLayoutRect(); var columnRect = rect.AddYMin(this.Tree.Config.SearchToolbarHeight); GUILayout.BeginVertical(GUILayoutOptions.Width(rect.width).ExpandHeight()); { EditorGUI.DrawRect(columnRect.AddYMin(this.Tree.Config.DefaultMenuStyle.Height), SirenixGUIStyles.EditorWindowBackgroundColor); GUILayout.BeginHorizontal(); this.Tree.DrawSearchToolbar(); var displayRect = GUILayoutUtility.GetRect(95, this.Tree.Config.SearchToolbarHeight, GUILayoutOptions.Width(95)); displayRect.height = this.Tree.Config.SearchToolbarHeight; displayRect.width -= 1; var newDisplay = EnumSelector <DisplayOptions> .DrawEnumField(displayRect, null, GUIHelper.TempContent("Data Columns"), this.Display, EnumBtnStyle); if (newDisplay != this.Display) { this.nextDisplay = newDisplay; } GUILayout.EndHorizontal(); GUITableUtilities.ResizeColumns(columnRect, this.columns); this.DrawColumnHeaders(); this.Tree.DrawMenuTree(); } GUILayout.EndVertical(); GUITableUtilities.DrawColumnHeaderSeperators(columnRect, this.columns, SirenixGUIStyles.BorderColor); GUILayout.Space(-5); } GUILayout.EndHorizontal(); }
/// <summary> /// Draws the property. /// </summary> protected override void DrawPropertyLayout(IPropertyValueEntry <T> entry, GUIContent label) { if (GeneralDrawerConfig.Instance.UseImprovedEnumDropDown) { entry.SmartValue = EnumSelector <T> .DrawEnumField(label, entry.SmartValue); } else { entry.WeakSmartValue = SirenixEditorFields.EnumDropdown(label, (Enum)entry.WeakSmartValue); } }