Class InteractableThemeBase
Base abstract class for all Theme Engines. Extend to create custom Theme logic
Inheritance
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
public abstract class InteractableThemeBase
Fields
originalStateValues
Declaration
protected Dictionary<ThemeStateProperty, ThemePropertyValue> originalStateValues
Field Value
| Type | Description |
|---|---|
| Dictionary<ThemeStateProperty, ThemePropertyValue> |
Properties
AreShadersSupported
Indicates whether the current Theme engine implementation supports shader targeting on state properties
Declaration
public virtual bool AreShadersSupported { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Ease
Defines how to ease between values during state changes
Declaration
public Easing Ease { get; set; }
Property Value
| Type | Description |
|---|---|
| Easing |
Host
GameObject initialized with this ThemeEngine and being targeted based on state changes
Declaration
public GameObject Host { get; set; }
Property Value
| Type | Description |
|---|---|
| GameObject |
IsEasingSupported
Indicates whether the current Theme engine implementation supports easing between state values
Declaration
public virtual bool IsEasingSupported { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Loaded
True if Theme Engine has been initialized, false otherwise
Declaration
public bool Loaded { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Name
Name of Theme Engine
Declaration
public string Name { get; protected set; }
Property Value
| Type | Description |
|---|---|
| String |
Properties
List of global Theme Engine properties
Declaration
public List<ThemeProperty> Properties { get; set; }
Property Value
| Type | Description |
|---|---|
| List<ThemeProperty> |
StateProperties
List of Properties with values per state
Declaration
public List<ThemeStateProperty> StateProperties { get; set; }
Property Value
| Type | Description |
|---|---|
| List<ThemeStateProperty> |
Types
Types of component this Theme Engine will target on the initialized GameObject or related GameObjects
Declaration
public Type[] Types { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Type[] |
Methods
CreateAndInitTheme(ThemeDefinition, GameObject)
Helper method to create and initialize a Theme Engine for given configuration and targeted GameObject
Declaration
public static InteractableThemeBase CreateAndInitTheme(ThemeDefinition definition, GameObject host = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ThemeDefinition | definition | Theme configuration with type information and properties to initialize ThemeEngine with |
| GameObject | host | GameObject for Theme Engine to target |
Returns
| Type | Description |
|---|---|
| InteractableThemeBase | Instance of Theme Engine initialized |
CreateTheme(Type)
Helper method to instantiate a Theme Engine of provided type. Type must extend InteractableThemeBase
Declaration
public static InteractableThemeBase CreateTheme(Type themeType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | themeType | Type of ThemeEngine to create |
Returns
| Type | Description |
|---|---|
| InteractableThemeBase | Instance of ThemeEngine of given type |
GetDefaultThemeDefinition()
Generates the default theme definition configuration for the current theme implementation
Declaration
public abstract ThemeDefinition GetDefaultThemeDefinition()
Returns
| Type | Description |
|---|---|
| ThemeDefinition | Default ThemeDefinition to initialize with the current theme engine implementation |
GetProperty(ThemeStateProperty)
Get the current property value for the provided state property
Declaration
public abstract ThemePropertyValue GetProperty(ThemeStateProperty property)
Parameters
| Type | Name | Description |
|---|---|---|
| ThemeStateProperty | property | state property to access |
Returns
| Type | Description |
|---|---|
| ThemePropertyValue | Value currently for given state property |
GetThemeProperty(Int32)
Declaration
protected ThemeProperty GetThemeProperty(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
Returns
| Type | Description |
|---|---|
| ThemeProperty |
Init(GameObject, ThemeDefinition)
Initialize current Theme Engine with given configuration and target the provided GameObject
Declaration
public virtual void Init(GameObject host, ThemeDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | host | GameObject to target changes against |
| ThemeDefinition | definition | Configuration information to initialize Theme Engine |
LerpFloat(Single, Single, Single)
Declaration
protected float LerpFloat(float s, float e, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | s | |
| Single | e | |
| Single | t |
Returns
| Type | Description |
|---|---|
| Single |
LerpInt(Int32, Int32, Single)
Declaration
protected int LerpInt(int s, int e, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | s | |
| Int32 | e | |
| Single | t |
Returns
| Type | Description |
|---|---|
| Int32 |
OnUpdate(Int32, Boolean)
Update ThemeEngine for given state based on Theme logic. Check, sets, and possibly eases values based on given state
Declaration
public virtual void OnUpdate(int state, bool force = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | state | current state to target |
| Boolean | force | force update call even if state is not new |
Reset()
Resets properties on Host GameObject to their original values when Init() was called for this theme engine. Useful for reverting changes done by this theme engine.
Declaration
public virtual void Reset()
SetValue(ThemeStateProperty, ThemePropertyValue)
Instruct theme to set value for current property with ThemePropertyValue value provided
Declaration
protected abstract void SetValue(ThemeStateProperty property, ThemePropertyValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| ThemeStateProperty | property | property to update value |
| ThemePropertyValue | value | Value for theme to set |
SetValue(ThemeStateProperty, Int32, Single)
Instruct theme to set value for current property with given index state and at given lerp percentage
Declaration
public abstract 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 |