Component:ReferenceOptionDescriptionDriver: Difference between revisions

From Resonite Wiki
Automated: update Fields
add info
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=ReferenceOptionDescriptionDriver`1Component.png
|Image=ReferenceOptionDescriptionDriver`1Component.png
|Name=Reference Option Description Driver`1
|Name=Reference Option Description Driver`1
}}
}}
Reference Option Description Driver is a component that is used primarily to drive the description of a [[Component:ContextMenuItemSource|Context Menu Item Source]]. This component along with ContextMenuItemSource is used in context menus for toggles where the toggle controls a reference like a slot or object.


<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Reference|{{RootFieldType|RelayRef`1|[[Type:SyncRef`1|SyncRef`1]]&lt;T&gt;}}|TypeAdv0=true|
|Reference|{{RootFieldType|RelayRef`1|[[Type:SyncRef`1|SyncRef`1]]&lt;T&gt;}}|TypeAdv0=true| The reference field to compare against
|ForceDeselected|Bool|
|ForceDeselected|Bool| {{Stub}}
|Label|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv2=true|
|Label|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv2=true| The string to set to the chosen label in the list of <code>Options</code>
|Color|{{RootFieldType|FieldDrive`1|[[Type:ColorX|ColorX]]}}|TypeAdv3=true|
|Color|{{RootFieldType|FieldDrive`1|[[Type:ColorX|ColorX]]}}|TypeAdv3=true| The color to set to the chosen color in the list of <code>Options</code>
|Sprite|{{RootFieldType|RefDrive`1|[[Type:IAssetProvider`1|IAssetProvider`1]]&lt;[[Type:Sprite|Sprite]]&gt;}}|TypeAdv4=true|
|Sprite|{{RootFieldType|RefDrive`1|[[Type:IAssetProvider`1|IAssetProvider`1]]&lt;[[Type:Sprite|Sprite]]&gt;}}|TypeAdv4=true| The Sprite to set to the chosen Sprite in the list of <code>Options</code>
|DefaultOption|{{RootFieldType|(nested)|[[#Option|Option]]&lt;T&gt;}}|TypeAdv5=true|
|DefaultOption|{{RootFieldType|(nested)|[[#Option|Option]]&lt;T&gt;}}|TypeAdv5=true| The option to set <code>Label</code>, <code>Color</code>, and <code>Sprite</code> to when <code>Reference</code> doesn't match any <code>ReferenceTarget</code>s under the list of <code>Options</code>
|Options|{{RootFieldType|SyncList`1|[[#Option|Option]]&lt;T&gt;}}|TypeAdv6=true|
|Options|{{RootFieldType|SyncList`1|[[#Option|Option]]&lt;T&gt;}}|TypeAdv6=true| The list to search for a <code>ReferenceTarget</code> that matches <code>Reference</code>. once a match is found, the option's <code>Label</code>, <code>Color</code>, and <code>Sprite</code> is used to drive this section's drive targets of <code>Label</code>, <code>Color</code>, and <code>Sprite</code>.
}}
 
== Option ==
{{Table TypeFields
|ReferenceTarget|[[Type:SyncRef`1|SyncRef`1]]&lt;T&gt;|TypeAdv0=true| The values below should be used if <code>Reference</code> is equal to this.
|Label|[[Type:String|String]]|TypeAdv1=true| The label to use if <code>ReferenceTarget</code> matches <code>Reference</code>
|Color|[[Type:ColorX|ColorX]]|TypeAdv2=true| The color to use if <code>ReferenceTarget</code> matches <code>Reference</code>
|Sprite|[[Type:IAssetProvider`1|IAssetProvider`1]]&lt;[[Type:Sprite|Sprite]]|TypeAdv3=true| The sprite to use if <code>ReferenceTarget</code> matches <code>Reference</code>
}}
}}


<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
this component can be more efficient than using a bunch of reference equality driver and generating a number based on such, or using flux for a context menu.


<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
This is useful for managing toggles where you want to switch things like music and drive the description based on which music asset you chose in your context menu.


<!--T:5-->
<!--T:5-->
== Related Components ==
== Related Components ==
</translate>
</translate>
[[Category:ComponentStubs]]
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|Reference Option Description Driver`1]]
[[Category:Components{{#translation:}}|Reference Option Description Driver`1]]

Revision as of 17:33, 16 April 2024

Component image 
Reference Option Description Driver`1 component as seen in the Scene Inspector

Reference Option Description Driver is a component that is used primarily to drive the description of a Context Menu Item Source. This component along with ContextMenuItemSource is used in context menus for toggles where the toggle controls a reference like a slot or object.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
Reference direct RelayRef`1<SyncRef`1<T>> The reference field to compare against
ForceDeselected Bool This article or section is a Stub. You can help the Resonite Wiki by expanding it.
Label field drive of String The string to set to the chosen label in the list of Options
Color field drive of ColorX The color to set to the chosen color in the list of Options
Sprite direct RefDrive`1<IAssetProvider`1<Sprite>> The Sprite to set to the chosen Sprite in the list of Options
DefaultOption direct Option<T> The option to set Label, Color, and Sprite to when Reference doesn't match any ReferenceTargets under the list of Options
Options list of Option<T> The list to search for a ReferenceTarget that matches Reference. once a match is found, the option's Label, Color, and Sprite is used to drive this section's drive targets of Label, Color, and Sprite.

Option

Fields
Name Type Description
ReferenceTarget SyncRef`1<T> The values below should be used if Reference is equal to this.
Label String The label to use if ReferenceTarget matches Reference
Color ColorX The color to use if ReferenceTarget matches Reference
Sprite IAssetProvider`1<Sprite The sprite to use if ReferenceTarget matches Reference


Usage

this component can be more efficient than using a bunch of reference equality driver and generating a number based on such, or using flux for a context menu.


Examples

This is useful for managing toggles where you want to switch things like music and drive the description based on which music asset you chose in your context menu.

Related Components