Game.UI.Widgets.AnimationCurveFieldBuilders
Assembly:
Assembly-CSharp (typical for game code / modding; class found in the game's main assembly)
Namespace:
Game.UI.Widgets
Type:
public class
Base:
IFieldBuilderFactory
Summary:
Factory class that produces FieldBuilder delegates for members of type UnityEngine.AnimationCurve. When asked to create a builder for an AnimationCurve member, it returns a delegate that ensures the accessor's value is non-null (creates a new AnimationCurve if necessary) and returns an AnimationCurveField whose accessor is a CastAccessor
Fields
None
This class declares no fields.
Properties
None
This class declares no properties.
Constructors
public AnimationCurveFieldBuilders()
Default public parameterless constructor (implicit in the source — no custom construction logic).
Methods
public FieldBuilder TryCreate(System.Type memberType, object[] attributes)
Tries to create a FieldBuilder for the given memberType and attributes.
Behavior:
- If memberType == typeof(UnityEngine.AnimationCurve):
- Returns a FieldBuilder delegate: FieldBuilder is a delegate that takes an IValueAccessor and returns a field widget (here, AnimationCurveField).
- The delegate first ensures accessor.GetValue() is not null; if it is null, it sets a new AnimationCurve instance on the accessor.
- Then it creates and returns a new AnimationCurveField with its accessor set to a CastAccessor
Notes:
- Relies on types: AnimationCurveField (a UI widget class for editing AnimationCurve), CastAccessor
Usage Example
// Example usage: creating a FieldBuilder and building a field widget for an AnimationCurve member.
var factory = new Game.UI.Widgets.AnimationCurveFieldBuilders();
// Ask the factory for a builder for AnimationCurve members
FieldBuilder builder = factory.TryCreate(typeof(UnityEngine.AnimationCurve), new object[0]);
if (builder != null)
{
// Suppose 'accessor' is an IValueAccessor for the inspected member (provided by the UI system)
IValueAccessor accessor = /* obtain accessor from UI/property system */ null;
// The returned builder will ensure the accessor value is non-null and create an AnimationCurveField.
var fieldWidget = builder(accessor); // returns AnimationCurveField
// fieldWidget can now be added to the UI layout.
}