Exemplo n.º 1
0
        public static void DoDraw(Rect position, SerializedProperty property, GUIContent label)
        {
            using (var propScope = Disposables.PropertyScope(position, label, property)) {
                position.height = SingleLine;
                label           = propScope.content;
                var labelPos = position.Edit(RectEdit.SetWidth(EditorGUIUtility.labelWidth));
                FoCsGUI.Label(labelPos, label);

                using (var scope = Disposables.RectHorizontalScope(6, position.Edit(RectEdit.AddX(labelPos.width), RectEdit.SetWidth(position.width - labelPos.width)))) {
                    using (Disposables.IndentSet(0)) {
                        using (var innerScope = Disposables.RectHorizontalScope(3, scope.GetNext(2))) {
                            FoCsGUI.Label(innerScope.GetNext(), KEY_LABEL);
                            FoCsGUI.PropertyField(innerScope.GetNext(2), property.FindPropertyRelative(KEY), GUIContent.none);
                        }

                        using (var innerScope = Disposables.RectHorizontalScope(5, scope.GetNext(2))) {
                            FoCsGUI.Label(innerScope.GetNext(2), KEY_TYPE_LABEL);
                            FoCsGUI.PropertyField(innerScope.GetNext(3), property.FindPropertyRelative(KEY_TYPE), GUIContent.none);
                        }

                        using (var innerScope = Disposables.RectHorizontalScope(5, scope.GetNext(2))) {
                            var key     = property.GetTargetObjectOfProperty <AnimatorKey>();
                            var typeStr = GetDisplayString(key);
                            FoCsGUI.Label(innerScope.GetNext(2), LABEL);
                            FoCsGUI.PropertyField(innerScope.GetNext(3), property.FindPropertyRelative(typeStr), GUIContent.none);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            using (var propScope = Disposables.PropertyScope(position, label, property)) {
                var rect = position;
                label = propScope.content;
                property.isExpanded = true;

                if (GetAttribute.ShowVariableName)
                {
                    rect.height = SingleLine;
                    EditorGUI.LabelField(rect, label);
                    rect.y += SingleLine;
                }

                property.NextVisible(true);

                using (Disposables.Indent()) {
                    foreach (var child in property.GetChildren())
                    {
                        FoCsGUI.PropertyField(rect, child, true, FoCsGUI.AttributeCheck.DoCheck);
                        rect.y += FoCsGUI.GetPropertyHeight(child, GUIContent.none, true, FoCsGUI.AttributeCheck.DoCheck);
                    }
                }
            }
        }
Exemplo n.º 3
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);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            using (var cc = FoCsEditor.Disposables.ChangeCheck())
            {
                var itemProp   = property.FindPropertyRelative("item");
                var amountProp = property.FindPropertyRelative("amount");

                using (var hScope = FoCsEditor.Disposables.RectHorizontalScope(4, position.Edit(RectEdit.SetHeight(SingleLine))))
                {
                    using (var propScope = FoCsEditor.Disposables.PropertyScope(position, label, property))
                    {
                        if (itemProp.objectReferenceValue == null)
                        {
                            FoCsGUI.Label(hScope.GetNext(), propScope.content);
                        }
                        else
                        {
                            FoCsGUI.Label(hScope.GetNext(RectEdit.ChangeX(16)), propScope.content);
                        }

                        FoCsGUI.PropertyField(hScope.GetNext(2), itemProp);
                        FoCsGUI.PropertyField(hScope.GetNext(), amountProp);
                    }
                }

                if (cc.changed)
                {
                    serializedObject = null;
                }

                if (itemProp.objectReferenceValue == null)
                {
                    return;
                }

                if (serializedObject == null)
                {
                    serializedObject = new SerializedObject(itemProp.objectReferenceValue);
                }
            }

            foldout = DrawReference(position, serializedObject, foldout);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            using (var propScope = Disposables.PropertyScope(position, label, property)) {
                label = propScope.content;

                if (GetAttribute.AllowConfirmedEdit)
                {
                    GetAttribute.CurrentlyEditable =
                        FoCsGUI.DrawDisabledPropertyWithMenu(!GetAttribute.CurrentlyEditable, position, property, label, OPTIONS_ARRAY, GetAttribute.CurrentlyEditable? 0 : 1)
                        .Value ==
                        0;
                }
                else
                {
                    using (Disposables.DisabledScope())
                        FoCsGUI.PropertyField(position, property, label, true, false);
                }
            }
        }