Automated: create new component page |
Added description, added field descriptions, added usage description. added option table. this is no longer a stub. |
||
Line 3: | Line 3: | ||
|Name=Value Option Description Driver`1 | |Name=Value Option Description Driver`1 | ||
}} | }} | ||
The '''ValueOptionDescriptionDriver''' component is used primarily to [[Drive|drive]] the parts that make up a [[Component:ContextMenuItemSource|Context Menu Item Source]]. This component along with ContextMenuItemSource is used in [[Context menu|context menus]] for toggles where the toggle controls a [[Value Type|value]]. | |||
{{Table ComponentFields | {{Table ComponentFields | ||
|Value|{{RootFieldType|RelayRef`1|[[Type:IField`1|IField`1]]<T>}}|TypeAdv0=true| | |Value|{{RootFieldType|RelayRef`1|[[Type:IField`1|IField`1]]<T>}}|TypeAdv0=true| The value field to compare against. | ||
|ForceDeselected|Bool| | |ForceDeselected|Bool| Forces any context menu item source to change regardless if it is deselected. | ||
|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]]<[[Type:Sprite|Sprite]]>}}|TypeAdv4=true| | |Sprite|{{RootFieldType|RefDrive`1|[[Type:IAssetProvider`1|IAssetProvider`1]]<[[Type:Sprite|Sprite]]>}}|TypeAdv4=true| The Sprite to set to the chosen Sprite in the list of <code>Options</code>. | ||
|SpriteURL|{{RootFieldType|FieldDrive`1|[[Type:Uri|Uri]]}}|TypeAdv5=true| | |SpriteURL|{{RootFieldType|FieldDrive`1|[[Type:Uri|Uri]]}}|TypeAdv5=true| The sprite url. | ||
|SpriteTint|{{RootFieldType|FieldDrive`1|[[Type:ColorX|ColorX]]}}|TypeAdv6=true| | |SpriteTint|{{RootFieldType|FieldDrive`1|[[Type:ColorX|ColorX]]}}|TypeAdv6=true| The sprite tint. | ||
|DefaultOption|{{RootFieldType|(nested)|[[#Option|Option]]<T>}}|TypeAdv7=true| | |DefaultOption|{{RootFieldType|(nested)|[[#Option|Option]]<T>}}|TypeAdv7=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]]<T>}}|TypeAdv8=true| | |Options|{{RootFieldType|SyncList`1|[[#Option|Option]]<T>}}|TypeAdv8=true| The list to search for a <code>ReferenceTarget</code> that matches <code>Value</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>. | ||
|SpriteTintBase|ColorX| | |SpriteTintBase|ColorX| Tints the entire sprite with a ColorX. | ||
}} | }} | ||
== | == Option == | ||
{{Table TypeFields | |||
|ReferenceValue|[[Type:SyncRef`1|SyncRef`1]]<T>|TypeAdv0=true| The values below should be used if <code>Value</code> is equal to this. | |||
|Label|[[Type:String|String]]|TypeAdv1=true| The label to use if <code>ReferenceValue</code> matches <code>Value</code> | |||
|Color|[[Type:ColorX|ColorX]]|TypeAdv2=true| The color to use if <code>ReferenceValue</code> matches <code>Value</code> | |||
|Sprite|[[Type:IAssetProvider`1|IAssetProvider`1]]<[[Type:Sprite|Sprite]]>|TypeAdv3=true| The sprite to use if <code>ReferenceValue</code> matches <code>Value</code> | |||
|SpriteTint|[[Type:ColorX|ColorX]]|TypeAdv4=true|The tint color for this sprite. | |||
}} | |||
== Usage == | |||
This component can be more efficient than using a bunch of [[Component:ValueEqualityDriver|Value Equality Drivers]] and generating a number based on such, or using [[ProtoFlux]] for a context menu. | |||
== Examples == | == Examples == | ||
Line 29: | Line 39: | ||
[[Category:Generic Components{{#translation:}}|Value Option Description Driver`1]] | [[Category:Generic Components{{#translation:}}|Value Option Description Driver`1]] | ||
[[Category:Components With Nested Types{{#translation:}}|Value Option Description Driver`1]] | [[Category:Components With Nested Types{{#translation:}}|Value Option Description Driver`1]] | ||
Latest revision as of 21:57, 12 September 2024
Component image
The ValueOptionDescriptionDriver component is used primarily to drive the parts that make up a Context Menu Item Source. This component along with ContextMenuItemSource is used in context menus for toggles where the toggle controls a value.
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. |
Value
|
direct RelayRef`1<IField`1<T>> | The value field to compare against. |
ForceDeselected
|
Bool | Forces any context menu item source to change regardless if it is deselected. |
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 .
|
SpriteURL
|
field drive of Uri | The sprite url. |
SpriteTint
|
field drive of ColorX | The sprite tint. |
DefaultOption
|
direct Option<T> | The option to set Label , Color , and Sprite to when Reference doesn't match any ReferenceTarget s under the list of Options .
|
Options
|
list of Option<T> | The list to search for a ReferenceTarget that matches Value . 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 .
|
SpriteTintBase
|
ColorX | Tints the entire sprite with a ColorX. |
Option
Name | Type | Description |
---|---|---|
ReferenceValue
|
SyncRef`1<T> | The values below should be used if Value is equal to this.
|
Label
|
String | The label to use if ReferenceValue matches Value
|
Color
|
ColorX | The color to use if ReferenceValue matches Value
|
Sprite
|
IAssetProvider`1<Sprite> | The sprite to use if ReferenceValue matches Value
|
SpriteTint
|
ColorX | The tint color for this sprite. |
Usage
This component can be more efficient than using a bunch of Value Equality Drivers and generating a number based on such, or using ProtoFlux for a context menu.