AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
InteractiveWidgetStateTest.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  {
14  public TextMesh TextField;
15 
16  private void Start()
17  {
18  if(TextField == null)
19  {
20  TextField = GetComponent<TextMesh>();
21  }
22 
23  }
38  public override void SetState(Interactive.ButtonStateEnum state)
39  {
40  string stateString = "Default";
41  switch (state)
42  {
43  case Interactive.ButtonStateEnum.Default:
44  stateString = "Default";
45  break;
46  case Interactive.ButtonStateEnum.Focus:
47  stateString = "Focus";
48  break;
49  case Interactive.ButtonStateEnum.Press:
50  stateString = "Press";
51  break;
52  case Interactive.ButtonStateEnum.Selected:
53  stateString = "Selected";
54  break;
55  case Interactive.ButtonStateEnum.FocusSelected:
56  stateString = "FocusSelected";
57  break;
58  case Interactive.ButtonStateEnum.PressSelected:
59  stateString = "PressSelected";
60  break;
61  case Interactive.ButtonStateEnum.Disabled:
62  stateString = "Disabled";
63  break;
64  case Interactive.ButtonStateEnum.DisabledSelected:
65  stateString = "DisabledSelected";
66  break;
67  default:
68  break;
69  }
70 
71  TextField.text = stateString;
72  }
73  }
74 }
Sample InteractiveWidget for displaying the current ButtonState
InteractiveState can exist on a child element of the game object containing the Interactive component...
ButtonStateEnum
A button typically has 8 potential states. We can update visual feedback based on state change...
Definition: Interactive.cs:80
override void SetState(Interactive.ButtonStateEnum state)
Interactive calls this method on state change
Interactive exposes basic button type events to the Unity Editor and receives messages from the Gestu...
Definition: Interactive.cs:22