Skip to content

Game.UI.Menu.ModdingToolchainSettingItem

Assembly:
Game

Namespace:
Game.UI.Menu

Type:
class

Base:
AutomaticSettings.SettingItemData

Summary:
Represents a composite settings item used by the settings UI to expose a modding toolchain dependency. This item holds a collection of child setting items and, when asked for its widget, builds and returns a ModdingToolchainDependency widget configured with delegates and state from the base SettingItemData (path, display name/description, accessor, visibility/disabled state, and value version). It's intended to be used where a toolchain dependency needs a custom UI that can display or edit a dependency and its related child entries.


Fields

This class declares no private backing fields in its source. All publicly visible storage is exposed via the read-only property listed below.

Properties

  • public System.Collections.Generic.List<AutomaticSettings.SettingItemData> children { get; }
    A read-only list of child setting items. It is initialized to an empty List and is intended to hold related sub-items that will be passed as children widgets to the ModdingToolchainDependency widget created by GetWidget(). When the widget is created, each child’s widget (if non-null) is collected and provided to the ModdingToolchainDependency.children array.

Constructors

  • public ModdingToolchainSettingItem(Setting setting, AutomaticSettings.IProxyProperty property, string prefix)
    Constructs a new ModdingToolchainSettingItem and forwards parameters to the base AutomaticSettings.SettingItemData constructor using WidgetType.None. The constructor does not perform additional initialization beyond the base constructor and the automatic initialization of the children list.

Methods

  • protected override IWidget GetWidget() : Game.UI.Widgets.IWidget
    Creates and returns a ModdingToolchainDependency widget. The method configures the returned widget with:
  • path, displayName, description copied from the base SettingItemData,
  • displayNameAction and descriptionAction delegates from the base,
  • accessor set to a DelegateAccessor that reads the value from the proxied property (casting the returned object to IToolchainDependency),
  • valueVersion set from the base.valueVersionAction,
  • disabled and hidden delegates from the base,
  • children set to an array composed by selecting each child SettingItemData's widget (filtering out null widgets). This ties the settings item to the UI widget and ensures the widget reflects the same metadata and state logic provided by the AutomaticSettings infrastructure.

Usage Example

// Create the setting item (setting and proxyProperty are obtained from the settings system)
var toolchainItem = new ModdingToolchainSettingItem(setting, proxyProperty, "toolchainPrefix");

// Add child setting items (constructed elsewhere)
toolchainItem.children.Add(childSettingItem1);
toolchainItem.children.Add(childSettingItem2);

// Access the UI widget (lazily created via GetWidget in the base)
IWidget widget = toolchainItem.widget; // returns a ModdingToolchainDependency configured with children widgets

Additional notes: - The widget relies on ModdingToolchainDependency and DelegateAccessor types; ensure these types are available in the mod/UI environment. - The accessor delegate casts the proxied property value to IToolchainDependency — it assumes the property actually returns an object implementing IToolchainDependency.