Skip to content

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 wrapping the provided IValueAccessor. If the requested memberType is not AnimationCurve, TryCreate returns null.


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(accessor). - If memberType is any other type: returns null.

Notes: - Relies on types: AnimationCurveField (a UI widget class for editing AnimationCurve), CastAccessor (wraps an IValueAccessor to a specific typed accessor), and IValueAccessor (abstraction for getting/setting member values). - There is no special handling of attributes in the provided implementation — attributes are accepted but unused.

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.
}