Skip to content

Commit 60fd10d

Browse files
author
Stephen Hodgson
committed
fixed popup examples
1 parent 711b221 commit 60fd10d

File tree

2 files changed

+52
-27
lines changed

2 files changed

+52
-27
lines changed

Assets/HoloToolkit-Tests/Input/AnimationControllers/popup_test_ac.controller

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,27 @@ AnimatorStateTransition:
104104
m_InterruptionSource: 0
105105
m_OrderedInterruption: 1
106106
m_CanTransitionToSelf: 1
107+
--- !u!1101 &1101597836146319098
108+
AnimatorStateTransition:
109+
m_ObjectHideFlags: 1
110+
m_PrefabParentObject: {fileID: 0}
111+
m_PrefabInternal: {fileID: 0}
112+
m_Name:
113+
m_Conditions: []
114+
m_DstStateMachine: {fileID: 0}
115+
m_DstState: {fileID: 0}
116+
m_Solo: 0
117+
m_Mute: 0
118+
m_IsExit: 1
119+
serializedVersion: 3
120+
m_TransitionDuration: 0
121+
m_TransitionOffset: 0
122+
m_ExitTime: 0.5
123+
m_HasExitTime: 1
124+
m_HasFixedDuration: 0
125+
m_InterruptionSource: 0
126+
m_OrderedInterruption: 1
127+
m_CanTransitionToSelf: 1
107128
--- !u!1102 &1102000010492253350
108129
AnimatorState:
109130
serializedVersion: 5
@@ -185,7 +206,8 @@ AnimatorState:
185206
m_Name: Dehydrate Idle
186207
m_Speed: 1
187208
m_CycleOffset: 0
188-
m_Transitions: []
209+
m_Transitions:
210+
- {fileID: 1101597836146319098}
189211
m_StateMachineBehaviours:
190212
- {fileID: 114000011696158288}
191213
m_Position: {x: 50, y: 50, z: 0}
@@ -227,6 +249,6 @@ AnimatorStateMachine:
227249
m_StateMachineBehaviours: []
228250
m_AnyStatePosition: {x: 0, y: 0, z: 0}
229251
m_EntryPosition: {x: 0, y: 120, z: 0}
230-
m_ExitPosition: {x: 240, y: 0, z: 0}
252+
m_ExitPosition: {x: 264, y: 144, z: 0}
231253
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
232254
m_DefaultState: {fileID: 1102000011298420914}

Assets/HoloToolkit-Tests/Input/Scripts/PopupMenu.cs

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,27 @@ public class PopupMenu : MonoBehaviour, IInputClickHandler
1515
private Animator rootAnimator = null;
1616

1717
[SerializeField]
18-
private bool isModal = false;
18+
private bool isModal;
1919

2020
[SerializeField]
21-
private bool closeOnNonTargetedTap = false;
21+
private bool closeOnNonTargetedTap;
2222

23-
private Action activatedCallback; // called when 'place' is selected
24-
private Action cancelledCallback; // called when 'back' or 'hide' is selected
25-
private Action deactivatedCallback; // called when the user clicks outside of the menu
23+
/// <summary>
24+
/// alled when 'place' is selected
25+
/// </summary>
26+
private Action activatedCallback;
2627

27-
public PopupState CurrentPopupState = PopupState.Closed;
28+
/// <summary>
29+
/// Called when 'back' or 'hide' is selected
30+
/// </summary>
31+
private Action cancelledCallback;
2832

29-
public GameObject RootObject
30-
{
31-
get
32-
{
33-
return this.gameObject;
34-
}
35-
}
33+
/// <summary>
34+
/// Called when the user clicks outside of the menu
35+
/// </summary>
36+
private Action deactivatedCallback;
37+
38+
public PopupState CurrentPopupState = PopupState.Closed;
3639

3740
public enum PopupState { Open, Closed }
3841

@@ -77,9 +80,9 @@ public void Show(Action _activatedCallback = null, Action _cancelledCallback = n
7780
}
7881

7982
// the visual was activated via an interaction outside of the menu, let anyone who cares know
80-
if (this.activatedCallback != null)
83+
if (activatedCallback != null)
8184
{
82-
this.activatedCallback();
85+
activatedCallback();
8386
}
8487
}
8588

@@ -88,16 +91,6 @@ public void Show(Action _activatedCallback = null, Action _cancelledCallback = n
8891
/// </summary>
8992
public void Dismiss()
9093
{
91-
// Deactivates the game object
92-
if (rootAnimator.isInitialized)
93-
{
94-
rootAnimator.SetTrigger("Dehydrate");
95-
}
96-
else
97-
{
98-
gameObject.SetActive(false);
99-
}
100-
10194
if (deactivatedCallback != null)
10295
{
10396
deactivatedCallback();
@@ -123,6 +116,16 @@ public void Dismiss()
123116
{
124117
cancelButton.Selected = false;
125118
}
119+
120+
// Deactivates the game object
121+
if (rootAnimator.isInitialized)
122+
{
123+
rootAnimator.SetTrigger("Dehydrate");
124+
}
125+
else
126+
{
127+
gameObject.SetActive(false);
128+
}
126129
}
127130

128131
private void OnCancelPressed(TestButton source)

0 commit comments

Comments
 (0)