public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { using (var propScope = Disposables.PropertyScope(position, label, property)) { label = propScope.content; using (Disposables.LabelFieldSetWidth((position.width / GetAttribute.totalAmount) * 0.5f)) { using (var scope = Disposables.RectHorizontalScope(GetAttribute.totalAmount, position)) { for (var i = 0; i < GetAttribute.index; i++) { scope.GetNext(); } FoCsGUI.PropertyField(scope.GetNext(RectEdit.SubtractY(SingleLinePlusPadding * GetAttribute.index), RectEdit.SetHeight(SingleLine)), property, label); } } } }
public static eInt DrawActionWithMenu(bool disabled, Rect position, Action <Rect> draw, GUICon label, GUICon[] Options, int active) { var propRect = new Rect(position); var labelRect = new Rect(position); var menuRect = new Rect(position); labelRect = labelRect.Edit(RectEdit.SubtractY(1), RectEdit.SetWidth(EditorGUIUtility.labelWidth)); menuRect.xMin = menuRect.xMax - MENU_BUTTON_SIZE; menuRect.xMax = position.xMax; propRect.xMin = labelRect.xMax; propRect.xMax = menuRect.xMin - 2; Label(labelRect, label); using (Disposables.DisabledScope(disabled)) draw.Trigger(propRect); using (Disposables.SetIndent(0)) { var index = EditorGUI.Popup(menuRect, GUICon.none, active, Options, Styles.InLineOptionsMenu); return(GUIEvent.Create(position, index)); } }