Skip to content

Game.UI.Widgets.StringFieldBuilders

Assembly:
Assembly-CSharp (common assembly for game/mod code)

Namespace:
Game.UI.Widgets

Type:
public class

Base:
IFieldBuilderFactory

Summary:
Factory that creates FieldBuilder instances for string-typed fields. When asked to create a field builder for a member of type System.String, it returns a FieldBuilder for a StringInputField bound to string values via WidgetReflectionUtils.CreateFieldBuilder(). For any other member type the factory returns null. This is used by the UI/widget system to supply an appropriate input widget for string properties in inspected objects.


Fields

  • (none)
    This class does not declare any instance or static fields.

Properties

  • (none)
    No public or private properties are defined on this class.

Constructors

  • public StringFieldBuilders()
    Default parameterless constructor (compiler-generated if not explicitly declared). Creates an instance of the factory. No initialization logic is present in the class.

Methods

  • public FieldBuilder TryCreate(Type memberType, object[] attributes)
    Attempts to create a FieldBuilder for the requested member type.

  • Parameters:

    • memberType — The System.Type of the member for which a field builder is requested.
    • attributes — An array of attribute instances applied to the member (not used by this implementation).
  • Returns:
    • A FieldBuilder instance created by WidgetReflectionUtils.CreateFieldBuilder<StringInputField, string>() when memberType is typeof(string).
    • null when memberType is not string.
  • Behavior:
    • This implementation only recognizes the string type and delegates construction to WidgetReflectionUtils to produce the proper FieldBuilder wiring a StringInputField to a string value.
    • Attributes are ignored by this factory; if attribute-based behavior is required it would need to be implemented here.

Usage Example

// Create the factory
var factory = new Game.UI.Widgets.StringFieldBuilders();

// Request a FieldBuilder for a string member
FieldBuilder builder = factory.TryCreate(typeof(string), null);
if (builder != null)
{
    // builder can now be used by the UI system to create/configure a StringInputField bound to a string value
}

Additional notes: - The implementation depends on WidgetReflectionUtils.CreateFieldBuilder() and the existence of a StringInputField widget type. - If you need to support more types or honor custom attributes (e.g., max length, placeholder text), extend this factory or add another factory that checks the attributes array and returns a specialized FieldBuilder.