public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var showLabel = ShowLabel(label.text);

            using (var propScope = Disposables.PropertyScope(position, label, property)) {
                label = propScope.content;

                if (EditorGUI.indentLevel <= 1)
                {
                    position = position.Edit(RectEdit.ChangeX(16f));
                }

                var axisProp         = property.FindPropertyRelative("Axis");
                var ValueInverted    = new EditorEntry("Invert Result", property.FindPropertyRelative("ValueInverted"));
                var OnlyButtonEvents = new EditorEntry("Only Button Events", property.FindPropertyRelative("OnlyButtonEvents"));
                var UseSmoothInput   = new EditorEntry("Use Smooth Input", property.FindPropertyRelative("UseSmoothInput"));
                var Axis             = new EditorEntry($"Axis: {axisProp.stringValue}", axisProp);

                var value = new EditorEntry($"{(ValueInverted.Property.boolValue? "Non Inverted " : "")}Value",
                                            property.FindPropertyRelative(UseSmoothInput.Property.boolValue? "valueSmooth" : "valueRaw"));

                var deadZone = new EditorEntry("DeadZone", property.FindPropertyRelative("deadZone"));

                using (var horizontalScope = Disposables.RectHorizontalScope(2, position)) {
                    using (Disposables.LabelFieldSetWidth(horizontalScope.FirstRect.width * LABEL_SIZE)) {
                        using (var verticalScope = Disposables.RectVerticalScope(showLabel? 5 : 4, horizontalScope.GetNext())) {
                            if (showLabel)
                            {
                                FoCsGUI.Label(verticalScope.GetNext(RectEdit.SetHeight(SingleLine), RectEdit.SubtractX(16f)), label);
                            }

                            DrawDropDown(Axis, verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                            ProgressBar(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)), value);
                            deadZone.Draw(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                            OnlyButtonEvents.Draw(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                        }

                        using (var verticalScope = Disposables.RectVerticalScope(showLabel? 5 : 4, horizontalScope.GetNext(RectEdit.ChangeX(SingleLine)))) {
                            if (showLabel)
                            {
                                verticalScope.GetNext();
                            }

                            Axis.Draw(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                            value.Draw(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                            ValueInverted.Draw(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                            UseSmoothInput.Draw(verticalScope.GetNext(RectEdit.SetHeight(SingleLine)));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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);
                    }
                }
            }
        }