Class InteractableColorTheme
Theme Engine that can set colors on a Renderer or text object based on state changes This Theme will try to set color on first available text object in order of TextMesh, Text, TextMeshPro, and TextMeshProUGUI If no text-based component can be found, then will fall back to first Renderer component found on the initialized GameObject and target the color shader property provided in the ThemeDefinition.
Inheritance
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
public class InteractableColorTheme : InteractableShaderTheme
Constructors
InteractableColorTheme()
Declaration
public InteractableColorTheme()
Fields
DefaultShaderProperty
Declaration
protected const string DefaultShaderProperty = "_Color"
Field Value
Type | Description |
---|---|
String |
Methods
GetDefaultThemeDefinition()
Generates the default theme definition configuration for the current theme implementation
Declaration
public override ThemeDefinition GetDefaultThemeDefinition()
Returns
Type | Description |
---|---|
ThemeDefinition | Default ThemeDefinition to initialize with the current theme engine implemenetation |
Overrides
GetProperty(ThemeStateProperty)
Get the current property value for the provided state property
Declaration
public override ThemePropertyValue GetProperty(ThemeStateProperty property)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | state property to access |
Returns
Type | Description |
---|---|
ThemePropertyValue | Value currently for given state property |
Overrides
HasTextComponentOnObject(GameObject)
Looks to see if a text component exists on the host
Declaration
public static bool HasTextComponentOnObject(GameObject host)
Parameters
Type | Name | Description |
---|---|---|
GameObject | host | GameObject to test |
Returns
Type | Description |
---|---|
Boolean | true if host is not null and contains a text-type component, false otherwise |
Init(GameObject, ThemeDefinition)
Initialize current Theme Engine with given configuration and target the provided GameObject
Declaration
public override void Init(GameObject host, ThemeDefinition settings)
Parameters
Type | Name | Description |
---|---|---|
GameObject | host | GameObject to target changes against |
ThemeDefinition | settings |
Overrides
SetValue(ThemeStateProperty, Int32, Single)
Instruct theme to set value for current property with given index state and at given lerp percentage
Declaration
public override void SetValue(ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | property to update value |
Int32 | index | index of state to access array of values |
Single | percentage | percentage transition between values |
Overrides
TryGetRendererColor(ThemeStateProperty, out Color)
Try to get color from the renderer return true, no text components exists, so falling back to base
Declaration
protected bool TryGetRendererColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to set |
Returns
Type | Description |
---|---|
Boolean | true if succesfully set color on Renderer |
TryGetTextColor(ThemeStateProperty, out Color)
Try to get a color from UI Text if no color is found, a text component does not exist on this object
Declaration
protected bool TryGetTextColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no Text component found |
Returns
Type | Description |
---|---|
Boolean | true if succesfully get color on Text |
TryGetTextMeshColor(ThemeStateProperty, out Color)
Try to get color from TextMesh If no color is found, not TextMesh on this object
Declaration
protected bool TryGetTextMeshColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMesh component found |
Returns
Type | Description |
---|---|
Boolean | true if succesfully get color on TextMesh |
TryGetTextMeshProColor(ThemeStateProperty, out Color)
Try to get color from TextMeshPro If no color is found, TextMeshPro is not on the object
Declaration
protected bool TryGetTextMeshProColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMesh component found |
Returns
Type | Description |
---|---|
Boolean | true if succesfully get color on TextMeshPro |
TryGetTextMeshProUGUIColor(ThemeStateProperty, out Color)
Try to get color from TextMeshProUGUI If no color is found, TextMeshProUGUI is not on the object
Declaration
protected bool TryGetTextMeshProUGUIColor(ThemeStateProperty property, out Color color)
Parameters
Type | Name | Description |
---|---|---|
ThemeStateProperty | property | |
Color | color | Color to try to get, returns white if no TextMeshProUGUI component found |
Returns
Type | Description |
---|---|
Boolean | true if succesfully get color on TextMeshProUGUI |
TrySetRendererColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on a renderer should just return true - falling back to base
Declaration
protected bool TrySetRendererColor(Color colour, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | colour | |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if succesfully set color on Renderer |
TrySetTextColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on UI Text If false, no UI Text was found
Declaration
protected bool TrySetTextColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if succesfully set color on Text |
TrySetTextMeshColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMesh If false, no TextMesh was found
Declaration
protected bool TrySetTextMeshColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if succesfully set color on TextMesh |
TrySetTextMeshProColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMeshPro If false, no TextMeshPro was found
Declaration
protected bool TrySetTextMeshProColor(Color colour, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | colour | |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if succesfully set color on TextMeshPro |
TrySetTextMeshProUGUIColor(Color, ThemeStateProperty, Int32, Single)
Try to set color on TextMeshProUGUI If false, no TextMeshProUGUI was found
Declaration
protected bool TrySetTextMeshProUGUIColor(Color color, ThemeStateProperty property, int index, float percentage)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color to try to set |
ThemeStateProperty | property | |
Int32 | index | |
Single | percentage |
Returns
Type | Description |
---|---|
Boolean | true if succesfully set color on TextMeshProUGUI |