Ejemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            var property = new EditorEntry(label.text, prop);

            position.x     += 16;
            position.width -= 16;
            var pos = position;

            pos.width = position.width / MultiInLineAttribute.totalAmount;

            if (MultiInLineAttribute.index == 0)
            {
                property.Draw(pos);
                return;
            }

            pos.y     -= (singleLine + (2 * MultiInLineAttribute.index));
            pos.height = singleLine;
            pos.x     += (pos.width) * MultiInLineAttribute.index;
            if (MultiInLineAttribute.expandToWidth)
            {
                pos.width = position.width - (pos.width) * MultiInLineAttribute.index;
            }
            property.Draw(pos);
        }
        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.º 3
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var ValueInverted = new EditorEntry("Invert Result", property.FindPropertyRelative("ValueInverted"));
            var Axis          = new EditorEntry(string.Format("{0} Axis", property.FindPropertyRelative("Axis").stringValue), property.FindPropertyRelative("Axis"));
            var UAxis         = new EditorEntry(string.Format("{0} Unity Axis", property.FindPropertyRelative("UnityAxis").stringValue),
                                                property.FindPropertyRelative("UnityAxis"));
            var m_Value = new EditorEntry(string.Format("{0}Value", (ValueInverted.Property.boolValue? "Non Inverted " : "")), property.FindPropertyRelative("m_Value"));

            var AxisRect = position;

            AxisRect.height = singleLine;
            Axis.Draw(AxisRect, EditorEntry.SplitType.Normal);
            AxisRect.y += singleLine;
            UAxis.Draw(AxisRect, EditorEntry.SplitType.Normal);
            AxisRect.y += singleLine;
            m_Value.Draw(AxisRect, EditorEntry.SplitType.Normal);
            AxisRect.y += singleLine;
            ValueInverted.Draw(AxisRect, EditorEntry.SplitType.Normal);
        }