Пример #1
0
        protected override void EnableSerializeFieldDrawer(MightySerializedField serializedField, T attribute)
        {
            var property = serializedField.Property;

            if (!serializedField.GetInfoFromMember <ArrayOption>(attribute.Target, attribute.OptionsCallback, out var optionsInfo))
            {
                optionsInfo = new MightyInfo <ArrayOption>(attribute.Options);
            }

            if (!serializedField.TryGetAttributes <BaseArrayDecoratorAttribute>(out var decoratorAttributes))
            {
                decoratorAttributes = new BaseArrayDecoratorAttribute[0];
            }

            m_optionsCache[serializedField]     = optionsInfo;
            m_decorationsCache[serializedField] = decoratorAttributes;
        }
Пример #2
0
        public void DrawArray(MightySerializedField serializedField, T attribute, IArrayElementDrawer drawer,
                              BasePropertyDrawerAttribute drawerAttribute)
        {
            var property = serializedField.Property;

            if (!property.IsCollection())
            {
                MightyGUIUtilities.DrawHelpBox($"{attribute.GetType().Name} can be used only on arrays or lists");

                MightyGUIUtilities.DrawPropertyField(property);
                return;
            }

            var options = GetOptionsForMember(serializedField, attribute);

            var decoratorAttributes = GetDecorationsForMember(serializedField, attribute);

            DrawArrayImpl(serializedField, attribute, options, decoratorAttributes, drawer, drawerAttribute);
        }
Пример #3
0
        protected override InitState InitPropertyImpl(MightySerializedField serializedField, ArraySizeAttribute attribute)
        {
            var property = serializedField.Property;

            if (!property.IsCollection())
            {
                return(new InitState(false, "\"" + property.displayName + "\" should be an array"));
            }

            if (!serializedField.GetValueFromMember(attribute.Target, attribute.SizeCallback, out int size))
            {
                size = attribute.Size;
            }

            if (size != property.arraySize)
            {
                property.arraySize = size;
                property.serializedObject.ApplyModifiedProperties();
            }
            return(new InitState(true));
        }
Пример #4
0
 protected abstract void EndChangeCheck(bool changed, MightySerializedField serializedField, T attribute);
Пример #5
0
 protected abstract void BeginChangeCheck(MightySerializedField serializedField, T attribute);
Пример #6
0
 public void EndChangeCheck(bool changed, MightySerializedField serializedField, BaseChangeCheckAttribute baseAttribute) =>
 EndChangeCheck(changed, serializedField, (T)baseAttribute);
Пример #7
0
 public void BeginChangeCheck(MightySerializedField serializedField, BaseChangeCheckAttribute baseAttribute) =>
 BeginChangeCheck(serializedField, (T)baseAttribute);
Пример #8
0
 protected abstract void DrawArrayImpl(MightySerializedField serializedField, T attribute, ArrayOption options,
                                       BaseArrayDecoratorAttribute[] decoratorAttributes, IArrayElementDrawer drawer, BasePropertyDrawerAttribute drawerAttribute);
Пример #9
0
 public void DrawArray(MightySerializedField serializedField, BaseArrayAttribute attribute,
                       IArrayElementDrawer drawerAttributeDrawer, BasePropertyDrawerAttribute drawerAttribute) =>
 DrawArray(serializedField, (T)attribute, drawerAttributeDrawer, drawerAttribute);
Пример #10
0
 protected abstract void ValidateProperty(MightySerializedField serializedField, T attribute);
Пример #11
0
 public void ValidateProperty(MightySerializedField serializedField, BaseValidatorAttribute baseAttribute) =>
 ValidateProperty(serializedField, (T)baseAttribute);
Пример #12
0
 protected abstract void EnableSerializeFieldDrawer(MightySerializedField serializedField, T attribute);