/// <summary> /// Helper to draw a foldout with additional properties. /// </summary> /// <typeparam name="TEnum">Type of the foldout mask used.</typeparam> /// <typeparam name="TState">Type of the persistent foldout state.</typeparam> /// <typeparam name="TAPEnum">Type of the additional properties mask used.</typeparam> /// <typeparam name="TAPState">Type of the persistent additional properties state.</typeparam> /// <param name="foldoutTitle">Title wanted for this foldout header</param> /// <param name="foldoutMask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param> /// <param name="foldoutState">The ExpandedState describing the component</param> /// <param name="additionalPropertiesMask">Bit mask (enum) used to define the boolean saving the state in AdditionalPropertiesState</param> /// <param name="additionalPropertiesState">The AdditionalPropertiesState describing the component</param> /// <param name="normalContent"> The content of the foldout header always visible if expended. </param> /// <param name="additionalContent">The content of the foldout header only visible if additional properties are shown and if foldout is expanded.</param> /// <param name="options">Drawing options</param> /// <returns>A IDrawer object</returns> public static IDrawer AdditionalPropertiesFoldoutGroup <TEnum, TState, TAPEnum, TAPState>(GUIContent foldoutTitle, TEnum foldoutMask, ExpandedState <TEnum, TState> foldoutState, TAPEnum additionalPropertiesMask, AdditionalPropertiesState <TAPEnum, TAPState> additionalPropertiesState, ActionDrawer normalContent, ActionDrawer additionalContent, FoldoutOption options = FoldoutOption.Indent) where TEnum : struct, IConvertible where TAPEnum : struct, IConvertible { bool Enabler(TData data, Editor owner) { return(additionalPropertiesState[additionalPropertiesMask]); } void SwitchEnabler(TData data, Editor owner) { additionalPropertiesState[additionalPropertiesMask] = !additionalPropertiesState[additionalPropertiesMask]; } return(FoldoutGroup(foldoutTitle, foldoutMask, foldoutState, options, Enabler, SwitchEnabler, normalContent, ConditionalWithAdditionalProperties((serialized, owner) => additionalPropertiesState[additionalPropertiesMask] && foldoutState[foldoutMask], additionalPropertiesState.GetAnimation(additionalPropertiesMask), additionalContent).Draw )); }
/// <summary> /// Helper to draw a foldout with additional properties. /// </summary> /// <typeparam name="TEnum">Type of the foldout mask used.</typeparam> /// <typeparam name="TState">Type of the persistent foldout state.</typeparam> /// <typeparam name="TAPEnum">Type of the additional properties mask used.</typeparam> /// <typeparam name="TAPState">Type of the persistent additional properties state.</typeparam> /// <param name="foldoutTitle">Title wanted for this foldout header</param> /// <param name="foldoutMask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param> /// <param name="foldoutState">The ExpandedState describing the component</param> /// <param name="additionalPropertiesMask">Bit mask (enum) used to define the boolean saving the state in AdditionalPropertiesState</param> /// <param name="additionalPropertiesState">The AdditionalPropertiesState describing the component</param> /// <param name="normalContent"> The content of the foldout header always visible if expended. </param> /// <param name="additionalContent">The content of the foldout header only visible if additional properties are shown and if foldout is expanded.</param> /// <param name="options">Drawing options</param> /// <returns>A IDrawer object</returns> public static IDrawer AdditionalPropertiesFoldoutGroup <TEnum, TState, TAPEnum, TAPState>(GUIContent foldoutTitle, TEnum foldoutMask, ExpandedState <TEnum, TState> foldoutState, TAPEnum additionalPropertiesMask, AdditionalPropertiesState <TAPEnum, TAPState> additionalPropertiesState, IDrawer normalContent, ActionDrawer additionalContent, FoldoutOption options = FoldoutOption.Indent) where TEnum : struct, IConvertible where TAPEnum : struct, IConvertible { return(AdditionalPropertiesFoldoutGroup(foldoutTitle, foldoutMask, foldoutState, additionalPropertiesMask, additionalPropertiesState, normalContent.Draw, additionalContent, options)); }