net.dreditor.minigames.ss 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attestation.p7m +0 -0
- package/DREditor.Minigames.SS.asmdef +20 -20
- package/DREditor.Minigames.SS.asmdef.meta +7 -7
- package/{Samples → Samples~}/SS_CG.prefab +116 -116
- package/{Samples → Samples~}/SS_CG.prefab.meta +7 -7
- package/{Samples → Samples~}/SS_Canvas_Shell.prefab +99 -99
- package/{Samples → Samples~}/SS_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/SS_Canvas_Template.prefab +841 -841
- package/{Samples → Samples~}/SS_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/SS_Intro_Template.prefab +79 -79
- package/{Samples → Samples~}/SS_Intro_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/SS_Manager_Template.prefab +530 -530
- package/{Samples → Samples~}/SS_Manager_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/SS_Reticle_Template.prefab +244 -244
- package/{Samples → Samples~}/SS_Reticle_Template.prefab.meta +7 -7
- package/Spot.cs +85 -85
- package/Spot.cs.meta +11 -11
- package/SpotColliderHandler.cs +67 -67
- package/SpotColliderHandler.cs.meta +11 -11
- package/SpotSelectionBuilder.cs +88 -88
- package/SpotSelectionBuilder.cs.meta +11 -11
- package/SpotSelectionBuilderEditor.cs +134 -134
- package/SpotSelectionBuilderEditor.cs.meta +11 -11
- package/SpotSelectionComponent.cs +26 -26
- package/SpotSelectionComponent.cs.meta +11 -11
- package/SpotSelectionDisplayer.cs +28 -28
- package/SpotSelectionDisplayer.cs.meta +11 -11
- package/SpotSelectionEditorComponentBase.cs +24 -24
- package/SpotSelectionEditorComponentBase.cs.meta +11 -11
- package/SpotSelectionImageDisplayer.cs +29 -29
- package/SpotSelectionImageDisplayer.cs.meta +11 -11
- package/SpotSelectionManager.cs +308 -308
- package/SpotSelectionManager.cs.meta +11 -11
- package/SpotSelectionManagerBase.cs +83 -83
- package/SpotSelectionManagerBase.cs.meta +1 -1
- package/SpotSelectionReticle.cs +45 -45
- package/SpotSelectionReticle.cs.meta +11 -11
- package/SpotSelectionToolEditor.cs +171 -171
- package/SpotSelectionToolEditor.cs.meta +11 -11
- package/SpotsEditor.cs +190 -190
- package/SpotsEditor.cs.meta +11 -11
- package/package.json +43 -38
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/SpotSelectionManager.cs
CHANGED
|
@@ -1,309 +1,309 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.EventObjects;
|
|
3
|
-
using DREditor.UI;
|
|
4
|
-
using DREditor.UIHandling;
|
|
5
|
-
using DREditor.UIHandling.Reticles;
|
|
6
|
-
using System.Collections;
|
|
7
|
-
using System.Collections.Generic;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
using UnityEngine.Events;
|
|
10
|
-
using UnityEngine.EventSystems;
|
|
11
|
-
using static UnityEngine.InputSystem.InputAction;
|
|
12
|
-
|
|
13
|
-
namespace DREditor.Minigames.SS
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
[ClassHeader(nameof(MinigameManagerBase) + ", " +
|
|
19
|
-
"\n\n")]
|
|
20
|
-
public class SpotSelectionManager : SpotSelectionManagerBase
|
|
21
|
-
{
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected BoolWithEvent displayNameVisible = null;
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
[Tooltip("")]
|
|
32
|
-
[SerializeField] protected QuestionToggle questionToggle = null;
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
///
|
|
36
|
-
/// </summary>
|
|
37
|
-
[Tooltip("")]
|
|
38
|
-
[SerializeField] protected HoverReticle reticle = null;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
[Header("")]
|
|
45
|
-
[Divider]
|
|
46
|
-
[Tooltip("")]
|
|
47
|
-
[SerializeField] protected bool debugMode = false;
|
|
48
|
-
|
|
49
|
-
/// <summary>
|
|
50
|
-
///
|
|
51
|
-
/// </summary>
|
|
52
|
-
[Tooltip("")]
|
|
53
|
-
[SerializeField] protected SpotSelectionBuilder builder = null;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/// <summary>
|
|
57
|
-
///
|
|
58
|
-
/// </summary>
|
|
59
|
-
[Header("")]
|
|
60
|
-
[Divider]
|
|
61
|
-
[Tooltip("")]
|
|
62
|
-
[SerializeField] protected UIVisibilityComponent introUI = null;
|
|
63
|
-
|
|
64
|
-
/// <summary>
|
|
65
|
-
///
|
|
66
|
-
/// </summary>
|
|
67
|
-
[Tooltip("")]
|
|
68
|
-
[SerializeField] protected MenuGroupBase confirmUI = null;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/// <summary>
|
|
72
|
-
///
|
|
73
|
-
/// </summary>
|
|
74
|
-
[Tooltip("")]
|
|
75
|
-
[SerializeField] protected UIVisibilityComponent answerUI = null;
|
|
76
|
-
|
|
77
|
-
/// <summary>
|
|
78
|
-
///
|
|
79
|
-
/// </summary>
|
|
80
|
-
[Tooltip("")]
|
|
81
|
-
[SerializeField] protected float menuFadeWaitTime = 0.5f;
|
|
82
|
-
|
|
83
|
-
/// <summary>
|
|
84
|
-
///
|
|
85
|
-
/// </summary>
|
|
86
|
-
[Tooltip("")]
|
|
87
|
-
[SerializeField] protected float postIntroBufferDuration = 0.25f;
|
|
88
|
-
|
|
89
|
-
/// <summary>
|
|
90
|
-
///
|
|
91
|
-
/// </summary>
|
|
92
|
-
[Tooltip("")]
|
|
93
|
-
[SerializeField] protected float resolveRestartBufferDuration = 1;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/// <summary>
|
|
97
|
-
///
|
|
98
|
-
/// </summary>
|
|
99
|
-
[Header("")]
|
|
100
|
-
[Divider]
|
|
101
|
-
[Tooltip("")]
|
|
102
|
-
[SerializeField] protected List<SpotSelectionComponent> spotSelectionComponents = new();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
[Header("")]
|
|
106
|
-
[SerializeField] protected UnityEvent OnMinigameStarted;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/// <summary>
|
|
110
|
-
///
|
|
111
|
-
/// </summary>
|
|
112
|
-
protected bool wasVisible = false;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
/// <summary>
|
|
116
|
-
///
|
|
117
|
-
/// </summary>
|
|
118
|
-
protected Collider2D selectedCollider = null;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/// <summary>
|
|
124
|
-
///
|
|
125
|
-
/// </summary>
|
|
126
|
-
protected virtual void Start()
|
|
127
|
-
{
|
|
128
|
-
if (debugMode)
|
|
129
|
-
StartSelection(builder);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/// <summary>
|
|
133
|
-
///
|
|
134
|
-
/// </summary>
|
|
135
|
-
/// <param name="asset"></param>
|
|
136
|
-
public void PlaySpotSelect(ScriptableObject asset)
|
|
137
|
-
=> FindAnyObjectByType<SpotSelectionManager>().StartSelection((SpotSelectionBuilder)asset);
|
|
138
|
-
|
|
139
|
-
/// <summary>
|
|
140
|
-
///
|
|
141
|
-
/// </summary>
|
|
142
|
-
/// <param name="builder"></param>
|
|
143
|
-
public virtual void StartSelection(SpotSelectionBuilder builder)
|
|
144
|
-
{
|
|
145
|
-
this.builder = builder;
|
|
146
|
-
|
|
147
|
-
StartCoroutine(BeginSelection());
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/// <summary>
|
|
151
|
-
///
|
|
152
|
-
/// </summary>
|
|
153
|
-
protected virtual IEnumerator BeginSelection()
|
|
154
|
-
{
|
|
155
|
-
spotSelectionComponents.ForEach(component => component.Initialize(builder));
|
|
156
|
-
|
|
157
|
-
OnMinigameStarted?.Invoke();
|
|
158
|
-
|
|
159
|
-
yield return introUI.ShowTillComplete();
|
|
160
|
-
|
|
161
|
-
if (TrialTimer != null)
|
|
162
|
-
TrialTimer.ShowInitialize(builder.times, false);
|
|
163
|
-
|
|
164
|
-
yield return new WaitForSecondsRealtime(postIntroBufferDuration);
|
|
165
|
-
|
|
166
|
-
questionToggle.Initialize(builder.question);
|
|
167
|
-
|
|
168
|
-
if (TrialTimer != null)
|
|
169
|
-
TrialTimer.ResumeTimer();
|
|
170
|
-
|
|
171
|
-
reticle.SetLock(false);
|
|
172
|
-
|
|
173
|
-
EnableSubmit();
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/// <inheritdoc/>
|
|
177
|
-
protected override void SubmitSpot(CallbackContext ctx)
|
|
178
|
-
{
|
|
179
|
-
selectedCollider = reticle.GetHoveredObject<Collider2D>();
|
|
180
|
-
|
|
181
|
-
if (selectedCollider != null && !confirmUI.isActive)
|
|
182
|
-
EnterConfirmUI();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/// <summary>
|
|
186
|
-
///
|
|
187
|
-
/// </summary>
|
|
188
|
-
protected virtual void EnterConfirmUI()
|
|
189
|
-
{
|
|
190
|
-
DisableSubmit();
|
|
191
|
-
|
|
192
|
-
// Below used to be a coroutine where a frame was waited before calling below code.
|
|
193
|
-
UnityEngine.Debug.Log(nameof(SpotSelectionManager) + ": On box: " + selectedCollider.gameObject.name);
|
|
194
|
-
|
|
195
|
-
reticle.SetLock(true);
|
|
196
|
-
|
|
197
|
-
confirmUI.Show();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/// <inheritdoc/>
|
|
201
|
-
public override void LeaveConfirmUI()
|
|
202
|
-
{
|
|
203
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
204
|
-
|
|
205
|
-
confirmUI.Hide();
|
|
206
|
-
|
|
207
|
-
// Below used to be a coroutine where a frame was waited before calling below code.
|
|
208
|
-
reticle.SetLock(false);
|
|
209
|
-
|
|
210
|
-
EnableSubmit();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/// <inheritdoc/>
|
|
214
|
-
public override void ConfirmSelection()
|
|
215
|
-
{
|
|
216
|
-
TrialTimer.PauseTimer();
|
|
217
|
-
|
|
218
|
-
HideVisuals();
|
|
219
|
-
|
|
220
|
-
Spot chosenSpot = builder.GetSpotWithName(selectedCollider.gameObject.name);
|
|
221
|
-
|
|
222
|
-
if (chosenSpot.isAnswer)
|
|
223
|
-
StartCoroutine(ResolveMinigame());
|
|
224
|
-
else
|
|
225
|
-
TrialMistake(chosenSpot.wrongDialogue);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/// <inheritdoc/>
|
|
229
|
-
public override IEnumerator ResolveMinigame()
|
|
230
|
-
{
|
|
231
|
-
yield return new WaitForSeconds(menuFadeWaitTime);
|
|
232
|
-
|
|
233
|
-
if (answerUI != null)
|
|
234
|
-
yield return answerUI.ShowTillComplete();
|
|
235
|
-
|
|
236
|
-
yield return base.ResolveMinigame();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/// <summary>
|
|
240
|
-
///
|
|
241
|
-
/// </summary>
|
|
242
|
-
protected virtual void HideVisuals()
|
|
243
|
-
{
|
|
244
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
245
|
-
|
|
246
|
-
confirmUI.Hide();
|
|
247
|
-
|
|
248
|
-
if (displayNameVisible.Value)
|
|
249
|
-
wasVisible = true;
|
|
250
|
-
|
|
251
|
-
reticle.SetLock(true);
|
|
252
|
-
|
|
253
|
-
reticle.enabled = false;
|
|
254
|
-
|
|
255
|
-
spotSelectionComponents.ForEach(component => component.Hide());
|
|
256
|
-
|
|
257
|
-
TrialTimer.Hide();
|
|
258
|
-
|
|
259
|
-
questionToggle.Deactivate();
|
|
260
|
-
|
|
261
|
-
displayNameVisible.SetValue(false);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/// <inheritdoc/>
|
|
265
|
-
protected override void Restart()
|
|
266
|
-
{
|
|
267
|
-
spotSelectionComponents.ForEach(component => component.Show());
|
|
268
|
-
|
|
269
|
-
TrialTimer.Show();
|
|
270
|
-
|
|
271
|
-
questionToggle.Activate();
|
|
272
|
-
|
|
273
|
-
StartCoroutine(ResolveRestart());
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/// <summary>
|
|
277
|
-
///
|
|
278
|
-
/// </summary>
|
|
279
|
-
protected virtual IEnumerator ResolveRestart()
|
|
280
|
-
{
|
|
281
|
-
yield return new WaitForSecondsRealtime(resolveRestartBufferDuration);
|
|
282
|
-
|
|
283
|
-
TrialTimer.ResumeTimer();
|
|
284
|
-
|
|
285
|
-
reticle.enabled = true;
|
|
286
|
-
|
|
287
|
-
reticle.SetLock(false);
|
|
288
|
-
|
|
289
|
-
if (wasVisible)
|
|
290
|
-
{
|
|
291
|
-
wasVisible = false;
|
|
292
|
-
|
|
293
|
-
displayNameVisible.SetValue(true);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
EnableSubmit();
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/// <inheritdoc/>
|
|
300
|
-
protected override void OnTimeUp()
|
|
301
|
-
{
|
|
302
|
-
DisableSubmit();
|
|
303
|
-
|
|
304
|
-
HideVisuals();
|
|
305
|
-
|
|
306
|
-
base.OnTimeUp();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.UI;
|
|
4
|
+
using DREditor.UIHandling;
|
|
5
|
+
using DREditor.UIHandling.Reticles;
|
|
6
|
+
using System.Collections;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using UnityEngine.Events;
|
|
10
|
+
using UnityEngine.EventSystems;
|
|
11
|
+
using static UnityEngine.InputSystem.InputAction;
|
|
12
|
+
|
|
13
|
+
namespace DREditor.Minigames.SS
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[ClassHeader(nameof(MinigameManagerBase) + ", " +
|
|
19
|
+
"\n\n")]
|
|
20
|
+
public class SpotSelectionManager : SpotSelectionManagerBase
|
|
21
|
+
{
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected BoolWithEvent displayNameVisible = null;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
[Tooltip("")]
|
|
32
|
+
[SerializeField] protected QuestionToggle questionToggle = null;
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
[Tooltip("")]
|
|
38
|
+
[SerializeField] protected HoverReticle reticle = null;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
[Header("")]
|
|
45
|
+
[Divider]
|
|
46
|
+
[Tooltip("")]
|
|
47
|
+
[SerializeField] protected bool debugMode = false;
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
[Tooltip("")]
|
|
53
|
+
[SerializeField] protected SpotSelectionBuilder builder = null;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
///
|
|
58
|
+
/// </summary>
|
|
59
|
+
[Header("")]
|
|
60
|
+
[Divider]
|
|
61
|
+
[Tooltip("")]
|
|
62
|
+
[SerializeField] protected UIVisibilityComponent introUI = null;
|
|
63
|
+
|
|
64
|
+
/// <summary>
|
|
65
|
+
///
|
|
66
|
+
/// </summary>
|
|
67
|
+
[Tooltip("")]
|
|
68
|
+
[SerializeField] protected MenuGroupBase confirmUI = null;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/// <summary>
|
|
72
|
+
///
|
|
73
|
+
/// </summary>
|
|
74
|
+
[Tooltip("")]
|
|
75
|
+
[SerializeField] protected UIVisibilityComponent answerUI = null;
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
///
|
|
79
|
+
/// </summary>
|
|
80
|
+
[Tooltip("")]
|
|
81
|
+
[SerializeField] protected float menuFadeWaitTime = 0.5f;
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
///
|
|
85
|
+
/// </summary>
|
|
86
|
+
[Tooltip("")]
|
|
87
|
+
[SerializeField] protected float postIntroBufferDuration = 0.25f;
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
[Tooltip("")]
|
|
93
|
+
[SerializeField] protected float resolveRestartBufferDuration = 1;
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/// <summary>
|
|
97
|
+
///
|
|
98
|
+
/// </summary>
|
|
99
|
+
[Header("")]
|
|
100
|
+
[Divider]
|
|
101
|
+
[Tooltip("")]
|
|
102
|
+
[SerializeField] protected List<SpotSelectionComponent> spotSelectionComponents = new();
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
[Header("")]
|
|
106
|
+
[SerializeField] protected UnityEvent OnMinigameStarted;
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
///
|
|
111
|
+
/// </summary>
|
|
112
|
+
protected bool wasVisible = false;
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/// <summary>
|
|
116
|
+
///
|
|
117
|
+
/// </summary>
|
|
118
|
+
protected Collider2D selectedCollider = null;
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
///
|
|
125
|
+
/// </summary>
|
|
126
|
+
protected virtual void Start()
|
|
127
|
+
{
|
|
128
|
+
if (debugMode)
|
|
129
|
+
StartSelection(builder);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/// <summary>
|
|
133
|
+
///
|
|
134
|
+
/// </summary>
|
|
135
|
+
/// <param name="asset"></param>
|
|
136
|
+
public void PlaySpotSelect(ScriptableObject asset)
|
|
137
|
+
=> FindAnyObjectByType<SpotSelectionManager>().StartSelection((SpotSelectionBuilder)asset);
|
|
138
|
+
|
|
139
|
+
/// <summary>
|
|
140
|
+
///
|
|
141
|
+
/// </summary>
|
|
142
|
+
/// <param name="builder"></param>
|
|
143
|
+
public virtual void StartSelection(SpotSelectionBuilder builder)
|
|
144
|
+
{
|
|
145
|
+
this.builder = builder;
|
|
146
|
+
|
|
147
|
+
StartCoroutine(BeginSelection());
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// <summary>
|
|
151
|
+
///
|
|
152
|
+
/// </summary>
|
|
153
|
+
protected virtual IEnumerator BeginSelection()
|
|
154
|
+
{
|
|
155
|
+
spotSelectionComponents.ForEach(component => component.Initialize(builder));
|
|
156
|
+
|
|
157
|
+
OnMinigameStarted?.Invoke();
|
|
158
|
+
|
|
159
|
+
yield return introUI.ShowTillComplete();
|
|
160
|
+
|
|
161
|
+
if (TrialTimer != null)
|
|
162
|
+
TrialTimer.ShowInitialize(builder.times, false);
|
|
163
|
+
|
|
164
|
+
yield return new WaitForSecondsRealtime(postIntroBufferDuration);
|
|
165
|
+
|
|
166
|
+
questionToggle.Initialize(builder.question);
|
|
167
|
+
|
|
168
|
+
if (TrialTimer != null)
|
|
169
|
+
TrialTimer.ResumeTimer();
|
|
170
|
+
|
|
171
|
+
reticle.SetLock(false);
|
|
172
|
+
|
|
173
|
+
EnableSubmit();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/// <inheritdoc/>
|
|
177
|
+
protected override void SubmitSpot(CallbackContext ctx)
|
|
178
|
+
{
|
|
179
|
+
selectedCollider = reticle.GetHoveredObject<Collider2D>();
|
|
180
|
+
|
|
181
|
+
if (selectedCollider != null && !confirmUI.isActive)
|
|
182
|
+
EnterConfirmUI();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/// <summary>
|
|
186
|
+
///
|
|
187
|
+
/// </summary>
|
|
188
|
+
protected virtual void EnterConfirmUI()
|
|
189
|
+
{
|
|
190
|
+
DisableSubmit();
|
|
191
|
+
|
|
192
|
+
// Below used to be a coroutine where a frame was waited before calling below code.
|
|
193
|
+
UnityEngine.Debug.Log(nameof(SpotSelectionManager) + ": On box: " + selectedCollider.gameObject.name);
|
|
194
|
+
|
|
195
|
+
reticle.SetLock(true);
|
|
196
|
+
|
|
197
|
+
confirmUI.Show();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/// <inheritdoc/>
|
|
201
|
+
public override void LeaveConfirmUI()
|
|
202
|
+
{
|
|
203
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
204
|
+
|
|
205
|
+
confirmUI.Hide();
|
|
206
|
+
|
|
207
|
+
// Below used to be a coroutine where a frame was waited before calling below code.
|
|
208
|
+
reticle.SetLock(false);
|
|
209
|
+
|
|
210
|
+
EnableSubmit();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/// <inheritdoc/>
|
|
214
|
+
public override void ConfirmSelection()
|
|
215
|
+
{
|
|
216
|
+
TrialTimer.PauseTimer();
|
|
217
|
+
|
|
218
|
+
HideVisuals();
|
|
219
|
+
|
|
220
|
+
Spot chosenSpot = builder.GetSpotWithName(selectedCollider.gameObject.name);
|
|
221
|
+
|
|
222
|
+
if (chosenSpot.isAnswer)
|
|
223
|
+
StartCoroutine(ResolveMinigame());
|
|
224
|
+
else
|
|
225
|
+
TrialMistake(chosenSpot.wrongDialogue);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/// <inheritdoc/>
|
|
229
|
+
public override IEnumerator ResolveMinigame()
|
|
230
|
+
{
|
|
231
|
+
yield return new WaitForSeconds(menuFadeWaitTime);
|
|
232
|
+
|
|
233
|
+
if (answerUI != null)
|
|
234
|
+
yield return answerUI.ShowTillComplete();
|
|
235
|
+
|
|
236
|
+
yield return base.ResolveMinigame();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/// <summary>
|
|
240
|
+
///
|
|
241
|
+
/// </summary>
|
|
242
|
+
protected virtual void HideVisuals()
|
|
243
|
+
{
|
|
244
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
245
|
+
|
|
246
|
+
confirmUI.Hide();
|
|
247
|
+
|
|
248
|
+
if (displayNameVisible.Value)
|
|
249
|
+
wasVisible = true;
|
|
250
|
+
|
|
251
|
+
reticle.SetLock(true);
|
|
252
|
+
|
|
253
|
+
reticle.enabled = false;
|
|
254
|
+
|
|
255
|
+
spotSelectionComponents.ForEach(component => component.Hide());
|
|
256
|
+
|
|
257
|
+
TrialTimer.Hide();
|
|
258
|
+
|
|
259
|
+
questionToggle.Deactivate();
|
|
260
|
+
|
|
261
|
+
displayNameVisible.SetValue(false);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/// <inheritdoc/>
|
|
265
|
+
protected override void Restart()
|
|
266
|
+
{
|
|
267
|
+
spotSelectionComponents.ForEach(component => component.Show());
|
|
268
|
+
|
|
269
|
+
TrialTimer.Show();
|
|
270
|
+
|
|
271
|
+
questionToggle.Activate();
|
|
272
|
+
|
|
273
|
+
StartCoroutine(ResolveRestart());
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/// <summary>
|
|
277
|
+
///
|
|
278
|
+
/// </summary>
|
|
279
|
+
protected virtual IEnumerator ResolveRestart()
|
|
280
|
+
{
|
|
281
|
+
yield return new WaitForSecondsRealtime(resolveRestartBufferDuration);
|
|
282
|
+
|
|
283
|
+
TrialTimer.ResumeTimer();
|
|
284
|
+
|
|
285
|
+
reticle.enabled = true;
|
|
286
|
+
|
|
287
|
+
reticle.SetLock(false);
|
|
288
|
+
|
|
289
|
+
if (wasVisible)
|
|
290
|
+
{
|
|
291
|
+
wasVisible = false;
|
|
292
|
+
|
|
293
|
+
displayNameVisible.SetValue(true);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
EnableSubmit();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/// <inheritdoc/>
|
|
300
|
+
protected override void OnTimeUp()
|
|
301
|
+
{
|
|
302
|
+
DisableSubmit();
|
|
303
|
+
|
|
304
|
+
HideVisuals();
|
|
305
|
+
|
|
306
|
+
base.OnTimeUp();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
309
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: d5724b11e9cf6884e9b1e54955f8da97
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d5724b11e9cf6884e9b1e54955f8da97
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|