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; }
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); }
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)); }
protected abstract void EndChangeCheck(bool changed, MightySerializedField serializedField, T attribute);
protected abstract void BeginChangeCheck(MightySerializedField serializedField, T attribute);
public void EndChangeCheck(bool changed, MightySerializedField serializedField, BaseChangeCheckAttribute baseAttribute) => EndChangeCheck(changed, serializedField, (T)baseAttribute);
public void BeginChangeCheck(MightySerializedField serializedField, BaseChangeCheckAttribute baseAttribute) => BeginChangeCheck(serializedField, (T)baseAttribute);
protected abstract void DrawArrayImpl(MightySerializedField serializedField, T attribute, ArrayOption options, BaseArrayDecoratorAttribute[] decoratorAttributes, IArrayElementDrawer drawer, BasePropertyDrawerAttribute drawerAttribute);
public void DrawArray(MightySerializedField serializedField, BaseArrayAttribute attribute, IArrayElementDrawer drawerAttributeDrawer, BasePropertyDrawerAttribute drawerAttribute) => DrawArray(serializedField, (T)attribute, drawerAttributeDrawer, drawerAttribute);
protected abstract void ValidateProperty(MightySerializedField serializedField, T attribute);
public void ValidateProperty(MightySerializedField serializedField, BaseValidatorAttribute baseAttribute) => ValidateProperty(serializedField, (T)baseAttribute);
protected abstract void EnableSerializeFieldDrawer(MightySerializedField serializedField, T attribute);