AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
InteractiveWidget.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 InteractiveWidget : MonoBehaviour
14  {
15  [Tooltip("The Interactive that will update the widget, optional: use if the widget is a sibling of the Interactive or if the parent Interactive is child of another Interactive")]
17 
18  // the Interactive state
20 
24  protected virtual void OnEnable()
25  {
26  if (InteractiveHost != null)
27  {
28  InteractiveHost.RegisterWidget(this);
29  }
30  }
31 
35  protected virtual void OnDisable()
36  {
37  if (InteractiveHost != null)
38  {
39  InteractiveHost.UnregisterWidget(this);
40  }
41  }
42 
57  public virtual void SetState(Interactive.ButtonStateEnum state)
58  {
59 
60  switch (state)
61  {
62  case Interactive.ButtonStateEnum.Default:
63  break;
64  case Interactive.ButtonStateEnum.Focus:
65  break;
66  case Interactive.ButtonStateEnum.Press:
67  break;
68  case Interactive.ButtonStateEnum.Selected:
69  break;
70  case Interactive.ButtonStateEnum.FocusSelected:
71  break;
72  case Interactive.ButtonStateEnum.PressSelected:
73  break;
74  case Interactive.ButtonStateEnum.Disabled:
75  break;
76  case Interactive.ButtonStateEnum.DisabledSelected:
77  break;
78  default:
79  break;
80  }
81 
82  State = state;
83  }
84  }
85 }
void UnregisterWidget(InteractiveWidget widget)
Definition: Interactive.cs:388
InteractiveState can exist on a child element of the game object containing the Interactive component...
virtual void SetState(Interactive.ButtonStateEnum state)
Interactive calls this method on state change
ButtonStateEnum
A button typically has 8 potential states. We can update visual feedback based on state change...
Definition: Interactive.cs:80
virtual void OnDisable()
Unregister when disabled
virtual void OnEnable()
register if the InteractiveHost was not manually set
void RegisterWidget(InteractiveWidget widget)
Definition: Interactive.cs:376
Interactive exposes basic button type events to the Unity Editor and receives messages from the Gestu...
Definition: Interactive.cs:22