net.dreditor.minigames 0.1.6 → 0.1.7
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/BulletDifficulty.cs +36 -36
- package/BulletDifficulty.cs.meta +11 -11
- package/BulletDifficultyEditor.cs +380 -380
- package/BulletDifficultyEditor.cs.meta +11 -11
- package/DREditor.Minigames.asmdef +36 -36
- package/DREditor.Minigames.asmdef.meta +7 -7
- package/DifficultyEditorBase.cs +60 -60
- package/DifficultyEditorBase.cs.meta +11 -11
- package/IShatterGraphic.cs +32 -32
- package/IShatterGraphic.cs.meta +11 -11
- package/IShatterText.cs +33 -33
- package/IShatterText.cs.meta +11 -11
- package/InitializeTrialOffsets.cs +51 -51
- package/InitializeTrialOffsets.cs.meta +11 -11
- package/MinigameBuilderBase.cs +28 -28
- package/MinigameBuilderBase.cs.meta +11 -11
- package/MinigameControlsUIHandler.cs +94 -94
- package/MinigameControlsUIHandler.cs.meta +11 -11
- package/MinigameManagerBase.cs +197 -197
- package/MinigameManagerBase.cs.meta +11 -11
- package/QuestionToggle.cs +154 -154
- package/QuestionToggle.cs.meta +11 -11
- package/RestoreControlsUIPostDialogue.cs +100 -100
- package/RestoreControlsUIPostDialogue.cs.meta +1 -1
- package/{Samples → Samples~}/Bullet Shatter Mesh Generator.asset +23 -23
- package/{Samples → Samples~}/Bullet Shatter Mesh Generator.asset.meta +8 -8
- package/{Samples → Samples~}/HasStamina.asset +21 -21
- package/{Samples → Samples~}/HasStamina.asset.meta +8 -8
- package/{Samples → Samples~}/IsDrainingStamina.asset +21 -21
- package/{Samples → Samples~}/IsDrainingStamina.asset.meta +8 -8
- package/{Samples → Samples~}/MinigameInputAllowed.asset +21 -21
- package/{Samples → Samples~}/MinigameInputAllowed.asset.meta +8 -8
- package/{Samples → Samples~}/Minigame_Controls_UI_Handler.prefab +53 -53
- package/{Samples → Samples~}/Minigame_Controls_UI_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/Quad Shatter.asset +31 -31
- package/{Samples → Samples~}/Quad Shatter.asset.meta +8 -8
- package/{Samples → Samples~}/ShatterCameraEnabled.asset +21 -21
- package/{Samples → Samples~}/ShatterCameraEnabled.asset.meta +8 -8
- package/{Samples → Samples~}/Shatter_Graphic.prefab +98 -98
- package/{Samples → Samples~}/Shatter_Graphic.prefab.meta +7 -7
- package/{Samples → Samples~}/Stamina_Handler.prefab +59 -59
- package/{Samples → Samples~}/Stamina_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/TBS_Manager_Shell.prefab +60 -60
- package/{Samples → Samples~}/TBS_Manager_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/TBS_Manager_Template.prefab +504 -504
- package/{Samples → Samples~}/TBS_Manager_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Shell.prefab +289 -289
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Template.prefab +449 -449
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Triangle Shatter.asset +31 -31
- package/{Samples → Samples~}/Triangle Shatter.asset.meta +8 -8
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Shell.prefab +221 -221
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Template.prefab +525 -525
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Shell.prefab +38 -38
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Template.prefab +1159 -1159
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Minigame_Canvas_Template.prefab +494 -494
- package/{Samples → Samples~}/Truth_Bullet_Minigame_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Option_ETemplate.prefab +294 -294
- package/{Samples → Samples~}/Truth_Bullet_Option_ETemplate.prefab.meta +7 -7
- package/Shattering/BreakTex.renderTexture +39 -39
- package/Shattering/BreakTex.renderTexture.meta +8 -8
- package/Shattering/BulletShatter.cs +176 -176
- package/Shattering/BulletShatter.cs.meta +11 -11
- package/Shattering/IShatterableCanvas.cs +20 -20
- package/Shattering/IShatterableCanvas.cs.meta +11 -11
- package/Shattering/MeshGenerator.cs +178 -178
- package/Shattering/MeshGenerator.cs.meta +11 -11
- package/Shattering/RenderCanvasOnShatter.cs +47 -47
- package/Shattering/RenderCanvasOnShatter.cs.meta +11 -11
- package/Shattering/ShatterCameraRender.cs +79 -79
- package/Shattering/ShatterCameraRender.cs.meta +11 -11
- package/Shattering/ShatterGraphic.cs +135 -135
- package/Shattering/ShatterGraphic.cs.meta +11 -11
- package/Shattering/ShatterMeshGraphic.cs +304 -304
- package/Shattering/ShatterMeshGraphic.cs.meta +11 -11
- package/Shattering/ShatterProcess.cs +282 -282
- package/Shattering/ShatterProcess.cs.meta +11 -11
- package/Shattering/ShatterProcessBase.cs +51 -51
- package/Shattering/ShatterProcessBase.cs.meta +11 -11
- package/Shattering/ShatterQuad.cs +56 -56
- package/Shattering/ShatterQuad.cs.meta +11 -11
- package/Shattering/ShatterQuadProcess.cs +65 -65
- package/Shattering/ShatterQuadProcess.cs.meta +11 -11
- package/Shattering/ShatterShape.cs +84 -84
- package/Shattering/ShatterShape.cs.meta +11 -11
- package/Shattering/ShatterTri.cs +27 -27
- package/Shattering/ShatterTri.cs.meta +11 -11
- package/Shattering/ShatterTriProcess.cs +179 -179
- package/Shattering/ShatterTriProcess.cs.meta +11 -11
- package/Shattering/ShatterWithUI.cs +68 -68
- package/Shattering/ShatterWithUI.cs.meta +11 -11
- package/Shattering/SplitShatter.cs +114 -114
- package/Shattering/SplitShatter.cs.meta +11 -11
- package/Shattering/TMPTextShatter.cs +243 -243
- package/Shattering/TMPTextShatter.cs.meta +11 -11
- package/Shattering/UIBreakVisibility.cs +172 -172
- package/Shattering/UIBreakVisibility.cs.meta +11 -11
- package/Shattering.meta +8 -8
- package/ShuffleUtility.cs +32 -32
- package/ShuffleUtility.cs.meta +11 -11
- package/SimpleRandom.cs +32 -32
- package/SimpleRandom.cs.meta +11 -11
- package/Stats/ColorHealthBar.cs +56 -56
- package/Stats/ColorHealthBar.cs.meta +11 -11
- package/Stats/ColorHealthModifier.cs +138 -138
- package/Stats/ColorHealthModifier.cs.meta +11 -11
- package/Stats/GaugeHandler.cs +72 -72
- package/Stats/GaugeHandler.cs.meta +1 -1
- package/Stats/HealthBarModifier.cs +89 -89
- package/Stats/HealthBarModifier.cs.meta +11 -11
- package/Stats/HealthStat.cs +77 -77
- package/Stats/HealthStat.cs.meta +11 -11
- package/Stats/HealthStatBase.cs +26 -26
- package/Stats/HealthStatBase.cs.meta +11 -11
- package/Stats/IGauge.cs +36 -36
- package/Stats/IGauge.cs.meta +1 -1
- package/Stats/InfluenceGauge.cs +107 -107
- package/Stats/InfluenceGauge.cs.meta +11 -11
- package/Stats/InfluenceGaugeBase.cs +42 -42
- package/Stats/InfluenceGaugeBase.cs.meta +11 -11
- package/Stats/SimpleGauge.cs +46 -46
- package/Stats/SimpleGauge.cs.meta +1 -1
- package/Stats/StaminaHandler.cs +153 -153
- package/Stats/StaminaHandler.cs.meta +11 -11
- package/Stats/TrialStats.cs +140 -140
- package/Stats/TrialStats.cs.meta +11 -11
- package/Stats/TrialStatsBase.cs +36 -36
- package/Stats/TrialStatsBase.cs.meta +11 -11
- package/Stats.meta +8 -8
- package/TBS/TBSelectBuilder.cs +59 -59
- package/TBS/TBSelectBuilder.cs.meta +11 -11
- package/TBS/TBSelectBuilderEditor.cs +166 -166
- package/TBS/TBSelectBuilderEditor.cs.meta +11 -11
- package/TBS/TBSelectManager.cs +315 -315
- package/TBS/TBSelectManager.cs.meta +11 -11
- package/TBS/TBSelection.cs +46 -46
- package/TBS/TBSelection.cs.meta +11 -11
- package/TBS/TrialTruthBulletMenu.cs +24 -24
- package/TBS/TrialTruthBulletMenu.cs.meta +11 -11
- package/TBS.meta +8 -8
- package/ThreadSafeSimpleRandom.cs +29 -29
- package/ThreadSafeSimpleRandom.cs.meta +11 -11
- package/TimedDifficultyEditor.cs +56 -56
- package/TimedDifficultyEditor.cs.meta +11 -11
- package/TimedMinigameEditor.cs +31 -31
- package/TimedMinigameEditor.cs.meta +11 -11
- package/TimerBase.cs +189 -189
- package/TimerBase.cs.meta +11 -11
- package/TimerDifficulty.cs +45 -45
- package/TimerDifficulty.cs.meta +11 -11
- package/TrialDialogueMinigame.cs +276 -276
- package/TrialDialogueMinigame.cs.meta +11 -11
- package/TrialDiscussion.cs +68 -68
- package/TrialDiscussion.cs.meta +11 -11
- package/TrialTimer.cs +113 -113
- package/TrialTimer.cs.meta +11 -11
- package/TrialTimerBase.cs +129 -129
- package/TrialTimerBase.cs.meta +11 -11
- package/package.json +56 -51
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/TBS/TBSelectManager.cs
CHANGED
|
@@ -1,316 +1,316 @@
|
|
|
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 System.Collections;
|
|
6
|
-
using System.Linq;
|
|
7
|
-
using TMPro;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
using UnityEngine.EventSystems;
|
|
10
|
-
using UnityEngine.Serialization;
|
|
11
|
-
using UnityEngine.UI;
|
|
12
|
-
|
|
13
|
-
namespace DREditor.Minigames.TBS
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
[ClassHeader(nameof(MinigameManagerBase) + ", " +
|
|
19
|
-
"\n\n")]
|
|
20
|
-
public class TBSelectManager : MinigameManagerBase
|
|
21
|
-
{
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected IntWithEvent currentChapterIndex = null;
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
[Tooltip("")]
|
|
32
|
-
[SerializeField] protected QuestionToggle questionToggle = null;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
[Header("")]
|
|
39
|
-
[Divider]
|
|
40
|
-
[Tooltip("")]
|
|
41
|
-
[SerializeField] protected bool debug = false;
|
|
42
|
-
|
|
43
|
-
/// <summary>
|
|
44
|
-
///
|
|
45
|
-
/// </summary>
|
|
46
|
-
[Tooltip("")]
|
|
47
|
-
[SerializeField] protected TBSelectBuilder builder = null;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/// <summary>
|
|
51
|
-
///
|
|
52
|
-
/// </summary>
|
|
53
|
-
[Header("")]
|
|
54
|
-
[Divider]
|
|
55
|
-
[Tooltip("")]
|
|
56
|
-
[FormerlySerializedAs("menu")]
|
|
57
|
-
[SerializeField] protected MenuGroupBase truthBulletMenu = null;
|
|
58
|
-
|
|
59
|
-
/// <summary>
|
|
60
|
-
///
|
|
61
|
-
/// </summary>
|
|
62
|
-
[Tooltip("")]
|
|
63
|
-
[SerializeField] protected MenuGroupBase confirmUI = null;
|
|
64
|
-
|
|
65
|
-
/// <summary>
|
|
66
|
-
///
|
|
67
|
-
/// </summary>
|
|
68
|
-
[Tooltip("")]
|
|
69
|
-
[SerializeField] protected UIVisibilityComponent answerUI = null;
|
|
70
|
-
|
|
71
|
-
/// <summary>
|
|
72
|
-
///
|
|
73
|
-
/// </summary>
|
|
74
|
-
[Tooltip("")]
|
|
75
|
-
[SerializeField] protected float menuFadeWaitTime = 0.5f;
|
|
76
|
-
|
|
77
|
-
/// <summary>
|
|
78
|
-
///
|
|
79
|
-
/// </summary>
|
|
80
|
-
[Tooltip("")]
|
|
81
|
-
[SerializeField] protected float postIntroBufferDuration = 0.75f;
|
|
82
|
-
|
|
83
|
-
/// <summary>
|
|
84
|
-
///
|
|
85
|
-
/// </summary>
|
|
86
|
-
[Tooltip("")]
|
|
87
|
-
[SerializeField] protected float resolveRestartBufferDuration = 1;
|
|
88
|
-
|
|
89
|
-
/// <summary>
|
|
90
|
-
///
|
|
91
|
-
/// </summary>
|
|
92
|
-
[Tooltip("")]
|
|
93
|
-
[SerializeField] protected bool lastSelectedOnRestart = false;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/// <summary>
|
|
97
|
-
///
|
|
98
|
-
/// </summary>
|
|
99
|
-
protected Button lastButton = null;
|
|
100
|
-
|
|
101
|
-
/// <summary>
|
|
102
|
-
///
|
|
103
|
-
/// </summary>
|
|
104
|
-
protected bool inConfirmUI = false;
|
|
105
|
-
|
|
106
|
-
/// <summary>
|
|
107
|
-
///
|
|
108
|
-
/// </summary>
|
|
109
|
-
protected Button[] buttons;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/// <summary>
|
|
113
|
-
///
|
|
114
|
-
/// </summary>
|
|
115
|
-
protected virtual void Awake()
|
|
116
|
-
{
|
|
117
|
-
if (debug)
|
|
118
|
-
currentChapterIndex.SetValue(builder.chapter);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/// <inheritdoc/>
|
|
122
|
-
protected override void OnMinigameDisable()
|
|
123
|
-
{
|
|
124
|
-
base.OnMinigameDisable();
|
|
125
|
-
|
|
126
|
-
foreach (var button in buttons)
|
|
127
|
-
button.onClick.RemoveAllListeners();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/// <summary>
|
|
131
|
-
///
|
|
132
|
-
/// </summary>
|
|
133
|
-
protected virtual void Start()
|
|
134
|
-
{
|
|
135
|
-
if (debug)
|
|
136
|
-
StartSelection(builder);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/// <summary>
|
|
140
|
-
///
|
|
141
|
-
/// </summary>
|
|
142
|
-
/// <param name="asset"></param>
|
|
143
|
-
public void PlayTBSelect(ScriptableObject asset) => FindAnyObjectByType<TBSelectManager>().StartSelection((TBSelectBuilder)asset);
|
|
144
|
-
|
|
145
|
-
/// <summary>
|
|
146
|
-
///
|
|
147
|
-
/// </summary>
|
|
148
|
-
/// <param name="builder"></param>
|
|
149
|
-
public virtual void StartSelection(TBSelectBuilder builder)
|
|
150
|
-
{
|
|
151
|
-
this.builder = builder;
|
|
152
|
-
|
|
153
|
-
StartCoroutine(BeginSelection());
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/// <summary>
|
|
157
|
-
///
|
|
158
|
-
/// </summary>
|
|
159
|
-
protected virtual IEnumerator BeginSelection()
|
|
160
|
-
{
|
|
161
|
-
yield return new WaitForSecondsRealtime(Time.unscaledDeltaTime);
|
|
162
|
-
|
|
163
|
-
truthBulletMenu.Show();
|
|
164
|
-
|
|
165
|
-
EventSystem.current.SetSelectedGameObject(GetComponentsInChildren<Selectable>().First().gameObject);
|
|
166
|
-
|
|
167
|
-
if (TrialTimer != null)
|
|
168
|
-
TrialTimer.ShowInitialize(builder.times, true);
|
|
169
|
-
|
|
170
|
-
yield return new WaitForSecondsRealtime(postIntroBufferDuration);
|
|
171
|
-
|
|
172
|
-
questionToggle.Initialize(builder.question);
|
|
173
|
-
|
|
174
|
-
buttons = GetComponentsInChildren<Button>();
|
|
175
|
-
|
|
176
|
-
foreach (var button in buttons)
|
|
177
|
-
button.onClick.AddListener(EnterConfirmUI);
|
|
178
|
-
|
|
179
|
-
yield break;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/// <summary>
|
|
184
|
-
///
|
|
185
|
-
/// </summary>
|
|
186
|
-
protected virtual void EnterConfirmUI()
|
|
187
|
-
{
|
|
188
|
-
if (inConfirmUI)
|
|
189
|
-
return;
|
|
190
|
-
|
|
191
|
-
inConfirmUI = true;
|
|
192
|
-
|
|
193
|
-
lastButton = EventSystem.current.currentSelectedGameObject.GetComponent<Button>();
|
|
194
|
-
|
|
195
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
196
|
-
|
|
197
|
-
confirmUI.Show(); // The Menu Group will auto select it for us
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/// <summary>
|
|
202
|
-
///
|
|
203
|
-
/// </summary>
|
|
204
|
-
/// <remarks></remarks>
|
|
205
|
-
public virtual void LeaveConfirmUI() => StartCoroutine(BufferLeaveConfirmUI());
|
|
206
|
-
|
|
207
|
-
/// <summary>
|
|
208
|
-
///
|
|
209
|
-
/// </summary>
|
|
210
|
-
protected virtual IEnumerator BufferLeaveConfirmUI()
|
|
211
|
-
{
|
|
212
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
213
|
-
|
|
214
|
-
confirmUI.Hide();
|
|
215
|
-
|
|
216
|
-
yield return confirmUI.WaitForChangeToComplete();
|
|
217
|
-
|
|
218
|
-
EventSystem.current.SetSelectedGameObject(lastButton.gameObject);
|
|
219
|
-
|
|
220
|
-
inConfirmUI = false;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
/// <summary>
|
|
225
|
-
///
|
|
226
|
-
/// </summary>
|
|
227
|
-
/// <remarks></remarks>
|
|
228
|
-
public void ConfirmSelection()
|
|
229
|
-
{
|
|
230
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
231
|
-
|
|
232
|
-
confirmUI.Hide();
|
|
233
|
-
|
|
234
|
-
TrialTimer.PauseTimer();
|
|
235
|
-
|
|
236
|
-
HideVisuals();
|
|
237
|
-
|
|
238
|
-
var selectionText = lastButton.GetComponentInChildren<TextMeshProUGUI>();
|
|
239
|
-
|
|
240
|
-
TBSelection selection = builder.GetSelection(selectionText.text);
|
|
241
|
-
|
|
242
|
-
if (selection != null && selection.isAnswer)
|
|
243
|
-
StartCoroutine(ResolveMinigame());
|
|
244
|
-
else
|
|
245
|
-
TrialMistake(selection.wrongDialogue);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/// <inheritdoc/>
|
|
249
|
-
public override IEnumerator ResolveMinigame()
|
|
250
|
-
{
|
|
251
|
-
yield return new WaitForSeconds(menuFadeWaitTime);
|
|
252
|
-
|
|
253
|
-
if (answerUI != null)
|
|
254
|
-
yield return answerUI.ShowTillComplete();
|
|
255
|
-
|
|
256
|
-
yield return base.ResolveMinigame();
|
|
257
|
-
|
|
258
|
-
yield break;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/// <summary>
|
|
262
|
-
///
|
|
263
|
-
/// </summary>
|
|
264
|
-
protected virtual void HideVisuals()
|
|
265
|
-
{
|
|
266
|
-
truthBulletMenu.Hide();
|
|
267
|
-
|
|
268
|
-
TrialTimer.Hide();
|
|
269
|
-
|
|
270
|
-
questionToggle.Deactivate();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/// <inheritdoc/>
|
|
274
|
-
protected override void Restart()
|
|
275
|
-
{
|
|
276
|
-
truthBulletMenu.Show();
|
|
277
|
-
|
|
278
|
-
var selected = lastButton != null && lastSelectedOnRestart ?
|
|
279
|
-
lastButton.gameObject : GetComponentsInChildren<Selectable>().First().gameObject;
|
|
280
|
-
|
|
281
|
-
EventSystem.current.SetSelectedGameObject(selected);
|
|
282
|
-
|
|
283
|
-
TrialTimer.Show();
|
|
284
|
-
|
|
285
|
-
questionToggle.Activate();
|
|
286
|
-
|
|
287
|
-
StartCoroutine(ResolveRestart());
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/// <summary>
|
|
291
|
-
///
|
|
292
|
-
/// </summary>
|
|
293
|
-
protected virtual IEnumerator ResolveRestart()
|
|
294
|
-
{
|
|
295
|
-
yield return new WaitForSecondsRealtime(resolveRestartBufferDuration);
|
|
296
|
-
|
|
297
|
-
TrialTimer.ResumeTimer();
|
|
298
|
-
|
|
299
|
-
inConfirmUI = false;
|
|
300
|
-
|
|
301
|
-
yield break;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/// <inheritdoc/>
|
|
305
|
-
protected override void OnTimeUp()
|
|
306
|
-
{
|
|
307
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
308
|
-
|
|
309
|
-
confirmUI.Hide();
|
|
310
|
-
|
|
311
|
-
HideVisuals();
|
|
312
|
-
|
|
313
|
-
base.OnTimeUp();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
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 System.Collections;
|
|
6
|
+
using System.Linq;
|
|
7
|
+
using TMPro;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using UnityEngine.EventSystems;
|
|
10
|
+
using UnityEngine.Serialization;
|
|
11
|
+
using UnityEngine.UI;
|
|
12
|
+
|
|
13
|
+
namespace DREditor.Minigames.TBS
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[ClassHeader(nameof(MinigameManagerBase) + ", " +
|
|
19
|
+
"\n\n")]
|
|
20
|
+
public class TBSelectManager : MinigameManagerBase
|
|
21
|
+
{
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected IntWithEvent currentChapterIndex = null;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
[Tooltip("")]
|
|
32
|
+
[SerializeField] protected QuestionToggle questionToggle = null;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
[Header("")]
|
|
39
|
+
[Divider]
|
|
40
|
+
[Tooltip("")]
|
|
41
|
+
[SerializeField] protected bool debug = false;
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
[Tooltip("")]
|
|
47
|
+
[SerializeField] protected TBSelectBuilder builder = null;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Header("")]
|
|
54
|
+
[Divider]
|
|
55
|
+
[Tooltip("")]
|
|
56
|
+
[FormerlySerializedAs("menu")]
|
|
57
|
+
[SerializeField] protected MenuGroupBase truthBulletMenu = null;
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
///
|
|
61
|
+
/// </summary>
|
|
62
|
+
[Tooltip("")]
|
|
63
|
+
[SerializeField] protected MenuGroupBase confirmUI = null;
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
///
|
|
67
|
+
/// </summary>
|
|
68
|
+
[Tooltip("")]
|
|
69
|
+
[SerializeField] protected UIVisibilityComponent answerUI = null;
|
|
70
|
+
|
|
71
|
+
/// <summary>
|
|
72
|
+
///
|
|
73
|
+
/// </summary>
|
|
74
|
+
[Tooltip("")]
|
|
75
|
+
[SerializeField] protected float menuFadeWaitTime = 0.5f;
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
///
|
|
79
|
+
/// </summary>
|
|
80
|
+
[Tooltip("")]
|
|
81
|
+
[SerializeField] protected float postIntroBufferDuration = 0.75f;
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
///
|
|
85
|
+
/// </summary>
|
|
86
|
+
[Tooltip("")]
|
|
87
|
+
[SerializeField] protected float resolveRestartBufferDuration = 1;
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
[Tooltip("")]
|
|
93
|
+
[SerializeField] protected bool lastSelectedOnRestart = false;
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/// <summary>
|
|
97
|
+
///
|
|
98
|
+
/// </summary>
|
|
99
|
+
protected Button lastButton = null;
|
|
100
|
+
|
|
101
|
+
/// <summary>
|
|
102
|
+
///
|
|
103
|
+
/// </summary>
|
|
104
|
+
protected bool inConfirmUI = false;
|
|
105
|
+
|
|
106
|
+
/// <summary>
|
|
107
|
+
///
|
|
108
|
+
/// </summary>
|
|
109
|
+
protected Button[] buttons;
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/// <summary>
|
|
113
|
+
///
|
|
114
|
+
/// </summary>
|
|
115
|
+
protected virtual void Awake()
|
|
116
|
+
{
|
|
117
|
+
if (debug)
|
|
118
|
+
currentChapterIndex.SetValue(builder.chapter);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// <inheritdoc/>
|
|
122
|
+
protected override void OnMinigameDisable()
|
|
123
|
+
{
|
|
124
|
+
base.OnMinigameDisable();
|
|
125
|
+
|
|
126
|
+
foreach (var button in buttons)
|
|
127
|
+
button.onClick.RemoveAllListeners();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// <summary>
|
|
131
|
+
///
|
|
132
|
+
/// </summary>
|
|
133
|
+
protected virtual void Start()
|
|
134
|
+
{
|
|
135
|
+
if (debug)
|
|
136
|
+
StartSelection(builder);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// <summary>
|
|
140
|
+
///
|
|
141
|
+
/// </summary>
|
|
142
|
+
/// <param name="asset"></param>
|
|
143
|
+
public void PlayTBSelect(ScriptableObject asset) => FindAnyObjectByType<TBSelectManager>().StartSelection((TBSelectBuilder)asset);
|
|
144
|
+
|
|
145
|
+
/// <summary>
|
|
146
|
+
///
|
|
147
|
+
/// </summary>
|
|
148
|
+
/// <param name="builder"></param>
|
|
149
|
+
public virtual void StartSelection(TBSelectBuilder builder)
|
|
150
|
+
{
|
|
151
|
+
this.builder = builder;
|
|
152
|
+
|
|
153
|
+
StartCoroutine(BeginSelection());
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/// <summary>
|
|
157
|
+
///
|
|
158
|
+
/// </summary>
|
|
159
|
+
protected virtual IEnumerator BeginSelection()
|
|
160
|
+
{
|
|
161
|
+
yield return new WaitForSecondsRealtime(Time.unscaledDeltaTime);
|
|
162
|
+
|
|
163
|
+
truthBulletMenu.Show();
|
|
164
|
+
|
|
165
|
+
EventSystem.current.SetSelectedGameObject(GetComponentsInChildren<Selectable>().First().gameObject);
|
|
166
|
+
|
|
167
|
+
if (TrialTimer != null)
|
|
168
|
+
TrialTimer.ShowInitialize(builder.times, true);
|
|
169
|
+
|
|
170
|
+
yield return new WaitForSecondsRealtime(postIntroBufferDuration);
|
|
171
|
+
|
|
172
|
+
questionToggle.Initialize(builder.question);
|
|
173
|
+
|
|
174
|
+
buttons = GetComponentsInChildren<Button>();
|
|
175
|
+
|
|
176
|
+
foreach (var button in buttons)
|
|
177
|
+
button.onClick.AddListener(EnterConfirmUI);
|
|
178
|
+
|
|
179
|
+
yield break;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
/// <summary>
|
|
184
|
+
///
|
|
185
|
+
/// </summary>
|
|
186
|
+
protected virtual void EnterConfirmUI()
|
|
187
|
+
{
|
|
188
|
+
if (inConfirmUI)
|
|
189
|
+
return;
|
|
190
|
+
|
|
191
|
+
inConfirmUI = true;
|
|
192
|
+
|
|
193
|
+
lastButton = EventSystem.current.currentSelectedGameObject.GetComponent<Button>();
|
|
194
|
+
|
|
195
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
196
|
+
|
|
197
|
+
confirmUI.Show(); // The Menu Group will auto select it for us
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
/// <summary>
|
|
202
|
+
///
|
|
203
|
+
/// </summary>
|
|
204
|
+
/// <remarks></remarks>
|
|
205
|
+
public virtual void LeaveConfirmUI() => StartCoroutine(BufferLeaveConfirmUI());
|
|
206
|
+
|
|
207
|
+
/// <summary>
|
|
208
|
+
///
|
|
209
|
+
/// </summary>
|
|
210
|
+
protected virtual IEnumerator BufferLeaveConfirmUI()
|
|
211
|
+
{
|
|
212
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
213
|
+
|
|
214
|
+
confirmUI.Hide();
|
|
215
|
+
|
|
216
|
+
yield return confirmUI.WaitForChangeToComplete();
|
|
217
|
+
|
|
218
|
+
EventSystem.current.SetSelectedGameObject(lastButton.gameObject);
|
|
219
|
+
|
|
220
|
+
inConfirmUI = false;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
/// <summary>
|
|
225
|
+
///
|
|
226
|
+
/// </summary>
|
|
227
|
+
/// <remarks></remarks>
|
|
228
|
+
public void ConfirmSelection()
|
|
229
|
+
{
|
|
230
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
231
|
+
|
|
232
|
+
confirmUI.Hide();
|
|
233
|
+
|
|
234
|
+
TrialTimer.PauseTimer();
|
|
235
|
+
|
|
236
|
+
HideVisuals();
|
|
237
|
+
|
|
238
|
+
var selectionText = lastButton.GetComponentInChildren<TextMeshProUGUI>();
|
|
239
|
+
|
|
240
|
+
TBSelection selection = builder.GetSelection(selectionText.text);
|
|
241
|
+
|
|
242
|
+
if (selection != null && selection.isAnswer)
|
|
243
|
+
StartCoroutine(ResolveMinigame());
|
|
244
|
+
else
|
|
245
|
+
TrialMistake(selection.wrongDialogue);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/// <inheritdoc/>
|
|
249
|
+
public override IEnumerator ResolveMinigame()
|
|
250
|
+
{
|
|
251
|
+
yield return new WaitForSeconds(menuFadeWaitTime);
|
|
252
|
+
|
|
253
|
+
if (answerUI != null)
|
|
254
|
+
yield return answerUI.ShowTillComplete();
|
|
255
|
+
|
|
256
|
+
yield return base.ResolveMinigame();
|
|
257
|
+
|
|
258
|
+
yield break;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/// <summary>
|
|
262
|
+
///
|
|
263
|
+
/// </summary>
|
|
264
|
+
protected virtual void HideVisuals()
|
|
265
|
+
{
|
|
266
|
+
truthBulletMenu.Hide();
|
|
267
|
+
|
|
268
|
+
TrialTimer.Hide();
|
|
269
|
+
|
|
270
|
+
questionToggle.Deactivate();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/// <inheritdoc/>
|
|
274
|
+
protected override void Restart()
|
|
275
|
+
{
|
|
276
|
+
truthBulletMenu.Show();
|
|
277
|
+
|
|
278
|
+
var selected = lastButton != null && lastSelectedOnRestart ?
|
|
279
|
+
lastButton.gameObject : GetComponentsInChildren<Selectable>().First().gameObject;
|
|
280
|
+
|
|
281
|
+
EventSystem.current.SetSelectedGameObject(selected);
|
|
282
|
+
|
|
283
|
+
TrialTimer.Show();
|
|
284
|
+
|
|
285
|
+
questionToggle.Activate();
|
|
286
|
+
|
|
287
|
+
StartCoroutine(ResolveRestart());
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/// <summary>
|
|
291
|
+
///
|
|
292
|
+
/// </summary>
|
|
293
|
+
protected virtual IEnumerator ResolveRestart()
|
|
294
|
+
{
|
|
295
|
+
yield return new WaitForSecondsRealtime(resolveRestartBufferDuration);
|
|
296
|
+
|
|
297
|
+
TrialTimer.ResumeTimer();
|
|
298
|
+
|
|
299
|
+
inConfirmUI = false;
|
|
300
|
+
|
|
301
|
+
yield break;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/// <inheritdoc/>
|
|
305
|
+
protected override void OnTimeUp()
|
|
306
|
+
{
|
|
307
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
308
|
+
|
|
309
|
+
confirmUI.Hide();
|
|
310
|
+
|
|
311
|
+
HideVisuals();
|
|
312
|
+
|
|
313
|
+
base.OnTimeUp();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
316
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 7ca1c3e6ca1ef9f4facf1b6d3dcfeeb6
|
|
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: 7ca1c3e6ca1ef9f4facf1b6d3dcfeeb6
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|