AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
TogglePopupMenu.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
.Unity.InputModule.Tests
8
{
9
public
class
TogglePopupMenu
: MonoBehaviour
10
{
11
12
[SerializeField]
13
private
PopupMenu
popupMenu = null;
14
15
[SerializeField]
16
private
TestButton
button = null;
17
18
private
void
Awake()
19
{
20
if
(button)
21
{
22
button.
Activated
+= ShowPopup;
23
}
24
}
25
26
private
void
OnDisable()
27
{
28
if
(button)
29
{
30
button.
Activated
-= ShowPopup;
31
}
32
}
33
34
private
void
ShowPopup(
TestButton
source)
35
{
36
if
(popupMenu != null)
37
{
38
if
(popupMenu.
CurrentPopupState
==
PopupMenu
.
PopupState
.Closed)
39
{
40
popupMenu.
Show
();
41
42
StartCoroutine(WaitForPopupToClose());
43
}
44
}
45
}
46
47
private
IEnumerator WaitForPopupToClose()
48
{
49
if
(popupMenu)
50
{
51
while
(popupMenu.
CurrentPopupState
==
PopupMenu
.
PopupState
.Open)
52
{
53
yield
return
null;
54
}
55
}
56
57
if
(button)
58
{
59
button.
Selected
=
false
;
60
}
61
}
62
}
63
}
HoloToolkit.Unity.InputModule.Tests.PopupMenu.Show
void Show(Action _activatedCallback=null, Action _cancelledCallback=null, Action _deactivatedCallback=null)
Definition:
PopupMenu.cs:70
System
HoloToolkit.Unity.InputModule.Tests.PopupMenu.PopupState
PopupState
Definition:
PopupMenu.cs:42
HoloToolkit.Unity.InputModule.Tests.TogglePopupMenu
Definition:
TogglePopupMenu.cs:9
HoloToolkit.Unity.InputModule.Tests.TestButton.Activated
ActivateDelegate Activated
Definition:
TestButton.cs:32
HoloToolkit.Unity.InputModule.Tests.TestButton
Test button that can be added to any object to make it gaze interactable and receive pressed and rele...
Definition:
TestButton.cs:13
HoloToolkit.Unity.InputModule.Tests.PopupMenu.CurrentPopupState
PopupState CurrentPopupState
Definition:
PopupMenu.cs:40
HoloToolkit
HoloToolkit.Unity.InputModule.Tests.TestButton.Selected
bool Selected
Definition:
TestButton.cs:69
UnityEngine
HoloToolkit.Unity.InputModule.Tests.PopupMenu
Definition:
PopupMenu.cs:9
Assets
HoloToolkit-Examples
Input
Scripts
TogglePopupMenu.cs
Generated by
1.8.12