AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
InteractiveWidgetEnabledTest.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  private bool mIsEnabled = true;
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  switch (state)
41  {
42  case Interactive.ButtonStateEnum.Default:
43  mIsEnabled = true;
44  break;
45  case Interactive.ButtonStateEnum.Focus:
46  mIsEnabled = true;
47  break;
48  case Interactive.ButtonStateEnum.Press:
49  mIsEnabled = true;
50  break;
51  case Interactive.ButtonStateEnum.Selected:
52  mIsEnabled = true;
53  break;
54  case Interactive.ButtonStateEnum.FocusSelected:
55  mIsEnabled = true;
56  break;
57  case Interactive.ButtonStateEnum.PressSelected:
58  mIsEnabled = true;
59  break;
60  case Interactive.ButtonStateEnum.Disabled:
61  mIsEnabled = false;
62  break;
63  case Interactive.ButtonStateEnum.DisabledSelected:
64  mIsEnabled = false;
65  break;
66  default:
67  break;
68  }
69 
70  TextField.text = mIsEnabled ? "(Enabled)" : "(Disabled)";
71  }
72  }
73 }
Sample InteractiveWidget for displaying text indicating if the button is enabled or disabled ...
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