AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
InteractiveTheme.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 using System.Collections;
6 
7 namespace HoloToolkit.Examples.InteractiveElements
8 {
13  public class InteractiveTheme<Type> : MonoBehaviour
14  {
15  [Tooltip("Tag to help distinguish themes")]
16  public string Tag = "default";
17 
18  [Tooltip("Default button state")]
19  public Type Default;
20  [Tooltip("Focus button state")]
21  public Type Focus;
22  [Tooltip("Pressed button state")]
23  public Type Press;
24  [Tooltip("Selected button state")]
25  public Type Selected;
26  [Tooltip("Focus Selected button state")]
27  public Type FocusSelected;
28  [Tooltip("Pressed Selected button state")]
29  public Type PressSelected;
30  [Tooltip("Disabled button state")]
31  public Type Disabled;
32  [Tooltip("Disabled Selected button state")]
33  public Type DisabledSelected;
34 
35  [Tooltip("Current value : read only")]
36  public Type CurrentValue;
37 
38  [Tooltip("Interactive host : optional")]
40  private void Awake()
41  {
42  if (Button == null)
43  {
44  Button = GetComponent<Interactive>();
45  }
46  }
47 
49  switch (state)
50  {
51  case Interactive.ButtonStateEnum.Default:
52  CurrentValue = Default;
53  break;
54  case Interactive.ButtonStateEnum.Focus:
55  CurrentValue = Focus;
56  break;
57  case Interactive.ButtonStateEnum.Press:
58  CurrentValue = Press;
59  break;
60  case Interactive.ButtonStateEnum.Selected:
61  CurrentValue = Selected;
62  break;
63  case Interactive.ButtonStateEnum.FocusSelected:
64  CurrentValue = FocusSelected;
65  break;
66  case Interactive.ButtonStateEnum.PressSelected:
67  CurrentValue = PressSelected;
68  break;
69  case Interactive.ButtonStateEnum.Disabled:
70  CurrentValue = Disabled;
71  break;
72  case Interactive.ButtonStateEnum.DisabledSelected:
73  CurrentValue = DisabledSelected;
74  break;
75  default:
76  CurrentValue = Default;
77  break;
78  }
79 
80  return CurrentValue;
81  }
82  }
83 }
Type GetThemeValue(Interactive.ButtonStateEnum state)
ButtonStateEnum
A button typically has 8 potential states. We can update visual feedback based on state change...
Definition: Interactive.cs:80
Generic base theme for buttons Button feedback can come in any form, scale, position, color, texture, etc...
Interactive exposes basic button type events to the Unity Editor and receives messages from the Gestu...
Definition: Interactive.cs:22