net.dreditor.backlog 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/BacklogHandler.cs +52 -52
- package/BacklogHandler.cs.meta +11 -11
- package/BacklogHandlerBase.cs +92 -92
- package/BacklogHandlerBase.cs.meta +11 -11
- package/BacklogLineHandler.cs +46 -46
- package/BacklogLineHandler.cs.meta +11 -11
- package/BacklogSlot.cs +251 -251
- package/BacklogSlot.cs.meta +11 -11
- package/BacklogUI.cs +349 -349
- package/BacklogUI.cs.meta +11 -11
- package/DREditor.Backlogging.asmdef +22 -22
- package/DREditor.Backlogging.asmdef.meta +7 -7
- package/{Samples → Samples~}/Backlog_Line_Handler.prefab +46 -46
- package/{Samples → Samples~}/Backlog_Line_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/Backlog_Slot_ETemplate.prefab +556 -556
- package/{Samples → Samples~}/Backlog_Slot_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Backlog_UI_Canvas_Shell.prefab +594 -594
- package/{Samples → Samples~}/Backlog_UI_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Backlog_UI_Canvas_Template.prefab +527 -527
- package/{Samples → Samples~}/Backlog_UI_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/DRE_Backlog_UI.unity +446 -446
- package/{Samples → Samples~}/DRE_Backlog_UI.unity.meta +7 -7
- package/{Samples → Samples~}/Open_Backlog_Conditions.prefab +63 -63
- package/{Samples → Samples~}/Open_Backlog_Conditions.prefab.meta +7 -7
- package/package.json +45 -40
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/BacklogUI.cs
CHANGED
|
@@ -1,350 +1,350 @@
|
|
|
1
|
-
// Completely Reworked Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
// Original Author: LeotheDev
|
|
3
|
-
using DREditor.Audio;
|
|
4
|
-
using DREditor.Dialogues;
|
|
5
|
-
using DREditor.EventObjects;
|
|
6
|
-
using DREditor.Services;
|
|
7
|
-
using DREditor.UI;
|
|
8
|
-
using DREditor.UIHandling;
|
|
9
|
-
using System.Collections;
|
|
10
|
-
using System.Linq;
|
|
11
|
-
using UnityEngine;
|
|
12
|
-
using UnityEngine.EventSystems;
|
|
13
|
-
using UnityEngine.InputSystem;
|
|
14
|
-
using static UnityEngine.InputSystem.InputAction;
|
|
15
|
-
|
|
16
|
-
namespace DREditor.Backlogging
|
|
17
|
-
{
|
|
18
|
-
/// <summary>
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
[ClassHeader(nameof(ScrollGridUI) +
|
|
22
|
-
"\n\n")]
|
|
23
|
-
public class BacklogUI : ScrollGridUI
|
|
24
|
-
{
|
|
25
|
-
/// <summary>
|
|
26
|
-
///
|
|
27
|
-
/// </summary>
|
|
28
|
-
[Divider]
|
|
29
|
-
[Space]
|
|
30
|
-
[Header("")]
|
|
31
|
-
[Divider]
|
|
32
|
-
[Tooltip("")]
|
|
33
|
-
[SerializeField] protected bool debugMode = false;
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
[Tooltip("")]
|
|
39
|
-
[SerializeField] protected InputActionReference backlogInput = null;
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
[Tooltip("")]
|
|
45
|
-
[SerializeField] protected InputActionReference submit = null;
|
|
46
|
-
|
|
47
|
-
/// <summary>
|
|
48
|
-
///
|
|
49
|
-
/// </summary>
|
|
50
|
-
[Tooltip("")]
|
|
51
|
-
[SerializeField] protected InputActionReference fastForward = null;
|
|
52
|
-
|
|
53
|
-
/// <summary>
|
|
54
|
-
///
|
|
55
|
-
/// </summary>
|
|
56
|
-
[Tooltip("")]
|
|
57
|
-
[SerializeField] protected Backlog backlog = null;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/// <summary>
|
|
61
|
-
///
|
|
62
|
-
/// </summary>
|
|
63
|
-
[Header("")]
|
|
64
|
-
[Divider]
|
|
65
|
-
[Tooltip("")]
|
|
66
|
-
[SerializeField] protected BoolWithEvent hasMenuAccess = null;
|
|
67
|
-
|
|
68
|
-
/// <summary>
|
|
69
|
-
///
|
|
70
|
-
/// </summary>
|
|
71
|
-
[Tooltip("")]
|
|
72
|
-
[SerializeField] protected BoolWithEvent inPause = null;
|
|
73
|
-
|
|
74
|
-
/// <summary>
|
|
75
|
-
///
|
|
76
|
-
/// </summary>
|
|
77
|
-
[Tooltip("")]
|
|
78
|
-
[SerializeField] protected BoolWithEvent inMenu = null;
|
|
79
|
-
|
|
80
|
-
/// <summary>
|
|
81
|
-
///
|
|
82
|
-
/// </summary>
|
|
83
|
-
[Tooltip("")]
|
|
84
|
-
[SerializeField] protected BoolWithEvent fastForwardModeEnabled = null;
|
|
85
|
-
|
|
86
|
-
/// <summary>
|
|
87
|
-
///
|
|
88
|
-
/// </summary>
|
|
89
|
-
[Tooltip("")]
|
|
90
|
-
[SerializeField] protected BoolWithEvent fastForwardModeWasEnabled = null;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/// <summary>
|
|
94
|
-
///
|
|
95
|
-
/// </summary>
|
|
96
|
-
[Header("")]
|
|
97
|
-
[Divider]
|
|
98
|
-
[Tooltip("")]
|
|
99
|
-
[SerializeField] protected EvaluateCondition openBacklogConditions = null;
|
|
100
|
-
|
|
101
|
-
/// <summary>
|
|
102
|
-
///
|
|
103
|
-
/// </summary>
|
|
104
|
-
[Tooltip("")]
|
|
105
|
-
[SerializeField] protected UIVisibilityComponent visibilityComponent = null;
|
|
106
|
-
|
|
107
|
-
/// <summary>
|
|
108
|
-
///
|
|
109
|
-
/// </summary>
|
|
110
|
-
[Tooltip("")]
|
|
111
|
-
[SerializeField] protected float voicelineCooldown = 1;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
/// <summary>
|
|
115
|
-
///
|
|
116
|
-
/// </summary>
|
|
117
|
-
protected CallbackContext backInputContext;
|
|
118
|
-
|
|
119
|
-
/// <summary>
|
|
120
|
-
///
|
|
121
|
-
/// </summary>
|
|
122
|
-
protected int lineCount = 0;
|
|
123
|
-
|
|
124
|
-
/// <summary>
|
|
125
|
-
///
|
|
126
|
-
/// </summary>
|
|
127
|
-
protected bool canPlayVoiceline = true;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
/// <inheritdoc/>
|
|
131
|
-
protected override void Start()
|
|
132
|
-
{
|
|
133
|
-
base.Start();
|
|
134
|
-
|
|
135
|
-
if (debugMode)
|
|
136
|
-
{
|
|
137
|
-
hasMenuAccess.Value = true;
|
|
138
|
-
|
|
139
|
-
backlog.CreateDebugBacklogLines();
|
|
140
|
-
|
|
141
|
-
UnityEngine.Debug.LogWarning($"ALERT: {nameof(BacklogUI)} is currently in debug mode! " +
|
|
142
|
-
$"Please ensure that it is turned off when you are no longer debugging!");
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/// <inheritdoc/>
|
|
147
|
-
protected override void OnEnable()
|
|
148
|
-
{
|
|
149
|
-
base.OnEnable();
|
|
150
|
-
|
|
151
|
-
backlogInput.action.started += AttemptShowBacklog;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/// <inheritdoc/>
|
|
155
|
-
protected override void OnDisable()
|
|
156
|
-
{
|
|
157
|
-
base.OnDisable();
|
|
158
|
-
|
|
159
|
-
backlogInput.action.started -= AttemptShowBacklog;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/// <summary>
|
|
163
|
-
///
|
|
164
|
-
/// </summary>
|
|
165
|
-
/// <param name="context"></param>
|
|
166
|
-
protected virtual void AttemptShowBacklog(CallbackContext context)
|
|
167
|
-
{
|
|
168
|
-
if (openBacklogConditions.Evaluate())
|
|
169
|
-
Show();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
/// <inheritdoc/>
|
|
174
|
-
protected override void SubscribeControls()
|
|
175
|
-
{
|
|
176
|
-
base.SubscribeControls();
|
|
177
|
-
|
|
178
|
-
AddBackInput();
|
|
179
|
-
|
|
180
|
-
submit.action.performed += OnSelect;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/// <inheritdoc/>
|
|
184
|
-
protected override void UnsubscribeControls()
|
|
185
|
-
{
|
|
186
|
-
base.UnsubscribeControls();
|
|
187
|
-
|
|
188
|
-
RemoveBackInput();
|
|
189
|
-
|
|
190
|
-
submit.action.performed -= OnSelect;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
/// <inheritdoc/>
|
|
195
|
-
public override void Show()
|
|
196
|
-
{
|
|
197
|
-
BeforeStart?.Invoke();
|
|
198
|
-
|
|
199
|
-
if (backGroup != null && backGroup.isActive)
|
|
200
|
-
backGroup.Hide();
|
|
201
|
-
|
|
202
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
203
|
-
|
|
204
|
-
Time.timeScale = 0;
|
|
205
|
-
|
|
206
|
-
inMenu.Value = true;
|
|
207
|
-
|
|
208
|
-
StartCoroutine(ShowProcess());
|
|
209
|
-
|
|
210
|
-
if (!inPause.Value && fastForwardModeEnabled.Value)
|
|
211
|
-
fastForwardModeWasEnabled.SetValue(true);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/// <summary>
|
|
215
|
-
///
|
|
216
|
-
/// </summary>
|
|
217
|
-
protected virtual IEnumerator ShowProcess()
|
|
218
|
-
{
|
|
219
|
-
if (visibilityComponent != null)
|
|
220
|
-
visibilityComponent.Show(); // We show before initialization so that the grid initializes properly.
|
|
221
|
-
|
|
222
|
-
InitializeScrollGrid();
|
|
223
|
-
|
|
224
|
-
RegenerateUI();
|
|
225
|
-
|
|
226
|
-
if (visibilityComponent != null)
|
|
227
|
-
yield return visibilityComponent.WaitForChangeToComplete();
|
|
228
|
-
|
|
229
|
-
SubscribeControls();
|
|
230
|
-
|
|
231
|
-
StartEvents?.Invoke();
|
|
232
|
-
|
|
233
|
-
SetActive(true);
|
|
234
|
-
|
|
235
|
-
ServiceLocator.GetService<MenuState>().SetChanging(false);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/// <inheritdoc/>
|
|
240
|
-
public override void BackGroup(CallbackContext context)
|
|
241
|
-
{
|
|
242
|
-
backInputContext = context;
|
|
243
|
-
|
|
244
|
-
if (backGroup != null && inPause.Value)
|
|
245
|
-
{
|
|
246
|
-
backGroup.SetEvaluateSelect();
|
|
247
|
-
|
|
248
|
-
backGroup.AddBackInput();
|
|
249
|
-
|
|
250
|
-
base.BackGroup(context);
|
|
251
|
-
}
|
|
252
|
-
else
|
|
253
|
-
{
|
|
254
|
-
OnBack?.Invoke();
|
|
255
|
-
|
|
256
|
-
Hide();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/// <inheritdoc/>
|
|
261
|
-
public override void Hide()
|
|
262
|
-
{
|
|
263
|
-
UnsubscribeControls();
|
|
264
|
-
|
|
265
|
-
EventSystem.current.SetSelectedGameObject(null);
|
|
266
|
-
|
|
267
|
-
Time.timeScale = 1;
|
|
268
|
-
|
|
269
|
-
EndEvents?.Invoke();
|
|
270
|
-
|
|
271
|
-
StartCoroutine(HideProcess());
|
|
272
|
-
|
|
273
|
-
if (ServiceLocator.HasService<VOManagerBase>(out var voManager))
|
|
274
|
-
voManager.StopVoiceLine();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/// <summary>
|
|
278
|
-
///
|
|
279
|
-
/// </summary>
|
|
280
|
-
/// <returns></returns>
|
|
281
|
-
protected virtual IEnumerator HideProcess()
|
|
282
|
-
{
|
|
283
|
-
if (visibilityComponent != null)
|
|
284
|
-
yield return visibilityComponent.HideTillComplete();
|
|
285
|
-
|
|
286
|
-
if (!inPause.Value && fastForwardModeWasEnabled.Value)
|
|
287
|
-
{
|
|
288
|
-
if (backInputContext.action == fastForward.action || fastForward.action.inProgress)
|
|
289
|
-
yield return new WaitUntil(() => !fastForward.action.inProgress);
|
|
290
|
-
|
|
291
|
-
fastForwardModeWasEnabled.SetValue(false);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (!inPause.Value)
|
|
295
|
-
inMenu.Value = false;
|
|
296
|
-
|
|
297
|
-
SetActive(false);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
/// <summary>
|
|
302
|
-
///
|
|
303
|
-
/// </summary>
|
|
304
|
-
/// <param name="context"></param>
|
|
305
|
-
protected virtual void OnSelect(CallbackContext context)
|
|
306
|
-
{
|
|
307
|
-
if (lineCount == 0)
|
|
308
|
-
return;
|
|
309
|
-
|
|
310
|
-
BacklogLines entry = backlog.Lines.ToArray().Reverse().ToArray()[selectedSlotIndex];
|
|
311
|
-
|
|
312
|
-
if (entry.Voice == null || entry.Voice == string.Empty || !canPlayVoiceline)
|
|
313
|
-
return;
|
|
314
|
-
|
|
315
|
-
canPlayVoiceline = false;
|
|
316
|
-
|
|
317
|
-
StartCoroutine(VoiceLineCooldown());
|
|
318
|
-
|
|
319
|
-
ServiceLocator.GetService<VOManagerBase>().PlayVoiceLine(entry.Voice);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/// <summary>
|
|
323
|
-
///
|
|
324
|
-
/// </summary>
|
|
325
|
-
/// <returns></returns>
|
|
326
|
-
protected virtual IEnumerator VoiceLineCooldown()
|
|
327
|
-
{
|
|
328
|
-
yield return new WaitForSecondsRealtime(voicelineCooldown);
|
|
329
|
-
|
|
330
|
-
canPlayVoiceline = true;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
/// <inheritdoc/>
|
|
335
|
-
public override void SetEvaluateSelect() => RegenerateUI();
|
|
336
|
-
|
|
337
|
-
/// <inheritdoc/>
|
|
338
|
-
protected override void ResetGroup() => UnsubscribeControls();
|
|
339
|
-
|
|
340
|
-
/// <inheritdoc/>
|
|
341
|
-
protected override int InitializeTotalObjectCount()
|
|
342
|
-
{
|
|
343
|
-
var lines = backlog.Lines.ToArray().Reverse().ToArray();
|
|
344
|
-
|
|
345
|
-
lineCount = lines.Length < backlog.Capacity ? lines.Length : backlog.Capacity;
|
|
346
|
-
|
|
347
|
-
return lineCount;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
1
|
+
// Completely Reworked Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
// Original Author: LeotheDev
|
|
3
|
+
using DREditor.Audio;
|
|
4
|
+
using DREditor.Dialogues;
|
|
5
|
+
using DREditor.EventObjects;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using DREditor.UI;
|
|
8
|
+
using DREditor.UIHandling;
|
|
9
|
+
using System.Collections;
|
|
10
|
+
using System.Linq;
|
|
11
|
+
using UnityEngine;
|
|
12
|
+
using UnityEngine.EventSystems;
|
|
13
|
+
using UnityEngine.InputSystem;
|
|
14
|
+
using static UnityEngine.InputSystem.InputAction;
|
|
15
|
+
|
|
16
|
+
namespace DREditor.Backlogging
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[ClassHeader(nameof(ScrollGridUI) +
|
|
22
|
+
"\n\n")]
|
|
23
|
+
public class BacklogUI : ScrollGridUI
|
|
24
|
+
{
|
|
25
|
+
/// <summary>
|
|
26
|
+
///
|
|
27
|
+
/// </summary>
|
|
28
|
+
[Divider]
|
|
29
|
+
[Space]
|
|
30
|
+
[Header("")]
|
|
31
|
+
[Divider]
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected bool debugMode = false;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
[Tooltip("")]
|
|
39
|
+
[SerializeField] protected InputActionReference backlogInput = null;
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
[Tooltip("")]
|
|
45
|
+
[SerializeField] protected InputActionReference submit = null;
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
[Tooltip("")]
|
|
51
|
+
[SerializeField] protected InputActionReference fastForward = null;
|
|
52
|
+
|
|
53
|
+
/// <summary>
|
|
54
|
+
///
|
|
55
|
+
/// </summary>
|
|
56
|
+
[Tooltip("")]
|
|
57
|
+
[SerializeField] protected Backlog backlog = null;
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
[Header("")]
|
|
64
|
+
[Divider]
|
|
65
|
+
[Tooltip("")]
|
|
66
|
+
[SerializeField] protected BoolWithEvent hasMenuAccess = null;
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
///
|
|
70
|
+
/// </summary>
|
|
71
|
+
[Tooltip("")]
|
|
72
|
+
[SerializeField] protected BoolWithEvent inPause = null;
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
///
|
|
76
|
+
/// </summary>
|
|
77
|
+
[Tooltip("")]
|
|
78
|
+
[SerializeField] protected BoolWithEvent inMenu = null;
|
|
79
|
+
|
|
80
|
+
/// <summary>
|
|
81
|
+
///
|
|
82
|
+
/// </summary>
|
|
83
|
+
[Tooltip("")]
|
|
84
|
+
[SerializeField] protected BoolWithEvent fastForwardModeEnabled = null;
|
|
85
|
+
|
|
86
|
+
/// <summary>
|
|
87
|
+
///
|
|
88
|
+
/// </summary>
|
|
89
|
+
[Tooltip("")]
|
|
90
|
+
[SerializeField] protected BoolWithEvent fastForwardModeWasEnabled = null;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/// <summary>
|
|
94
|
+
///
|
|
95
|
+
/// </summary>
|
|
96
|
+
[Header("")]
|
|
97
|
+
[Divider]
|
|
98
|
+
[Tooltip("")]
|
|
99
|
+
[SerializeField] protected EvaluateCondition openBacklogConditions = null;
|
|
100
|
+
|
|
101
|
+
/// <summary>
|
|
102
|
+
///
|
|
103
|
+
/// </summary>
|
|
104
|
+
[Tooltip("")]
|
|
105
|
+
[SerializeField] protected UIVisibilityComponent visibilityComponent = null;
|
|
106
|
+
|
|
107
|
+
/// <summary>
|
|
108
|
+
///
|
|
109
|
+
/// </summary>
|
|
110
|
+
[Tooltip("")]
|
|
111
|
+
[SerializeField] protected float voicelineCooldown = 1;
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/// <summary>
|
|
115
|
+
///
|
|
116
|
+
/// </summary>
|
|
117
|
+
protected CallbackContext backInputContext;
|
|
118
|
+
|
|
119
|
+
/// <summary>
|
|
120
|
+
///
|
|
121
|
+
/// </summary>
|
|
122
|
+
protected int lineCount = 0;
|
|
123
|
+
|
|
124
|
+
/// <summary>
|
|
125
|
+
///
|
|
126
|
+
/// </summary>
|
|
127
|
+
protected bool canPlayVoiceline = true;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/// <inheritdoc/>
|
|
131
|
+
protected override void Start()
|
|
132
|
+
{
|
|
133
|
+
base.Start();
|
|
134
|
+
|
|
135
|
+
if (debugMode)
|
|
136
|
+
{
|
|
137
|
+
hasMenuAccess.Value = true;
|
|
138
|
+
|
|
139
|
+
backlog.CreateDebugBacklogLines();
|
|
140
|
+
|
|
141
|
+
UnityEngine.Debug.LogWarning($"ALERT: {nameof(BacklogUI)} is currently in debug mode! " +
|
|
142
|
+
$"Please ensure that it is turned off when you are no longer debugging!");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// <inheritdoc/>
|
|
147
|
+
protected override void OnEnable()
|
|
148
|
+
{
|
|
149
|
+
base.OnEnable();
|
|
150
|
+
|
|
151
|
+
backlogInput.action.started += AttemptShowBacklog;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/// <inheritdoc/>
|
|
155
|
+
protected override void OnDisable()
|
|
156
|
+
{
|
|
157
|
+
base.OnDisable();
|
|
158
|
+
|
|
159
|
+
backlogInput.action.started -= AttemptShowBacklog;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/// <summary>
|
|
163
|
+
///
|
|
164
|
+
/// </summary>
|
|
165
|
+
/// <param name="context"></param>
|
|
166
|
+
protected virtual void AttemptShowBacklog(CallbackContext context)
|
|
167
|
+
{
|
|
168
|
+
if (openBacklogConditions.Evaluate())
|
|
169
|
+
Show();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
/// <inheritdoc/>
|
|
174
|
+
protected override void SubscribeControls()
|
|
175
|
+
{
|
|
176
|
+
base.SubscribeControls();
|
|
177
|
+
|
|
178
|
+
AddBackInput();
|
|
179
|
+
|
|
180
|
+
submit.action.performed += OnSelect;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/// <inheritdoc/>
|
|
184
|
+
protected override void UnsubscribeControls()
|
|
185
|
+
{
|
|
186
|
+
base.UnsubscribeControls();
|
|
187
|
+
|
|
188
|
+
RemoveBackInput();
|
|
189
|
+
|
|
190
|
+
submit.action.performed -= OnSelect;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
/// <inheritdoc/>
|
|
195
|
+
public override void Show()
|
|
196
|
+
{
|
|
197
|
+
BeforeStart?.Invoke();
|
|
198
|
+
|
|
199
|
+
if (backGroup != null && backGroup.isActive)
|
|
200
|
+
backGroup.Hide();
|
|
201
|
+
|
|
202
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
203
|
+
|
|
204
|
+
Time.timeScale = 0;
|
|
205
|
+
|
|
206
|
+
inMenu.Value = true;
|
|
207
|
+
|
|
208
|
+
StartCoroutine(ShowProcess());
|
|
209
|
+
|
|
210
|
+
if (!inPause.Value && fastForwardModeEnabled.Value)
|
|
211
|
+
fastForwardModeWasEnabled.SetValue(true);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/// <summary>
|
|
215
|
+
///
|
|
216
|
+
/// </summary>
|
|
217
|
+
protected virtual IEnumerator ShowProcess()
|
|
218
|
+
{
|
|
219
|
+
if (visibilityComponent != null)
|
|
220
|
+
visibilityComponent.Show(); // We show before initialization so that the grid initializes properly.
|
|
221
|
+
|
|
222
|
+
InitializeScrollGrid();
|
|
223
|
+
|
|
224
|
+
RegenerateUI();
|
|
225
|
+
|
|
226
|
+
if (visibilityComponent != null)
|
|
227
|
+
yield return visibilityComponent.WaitForChangeToComplete();
|
|
228
|
+
|
|
229
|
+
SubscribeControls();
|
|
230
|
+
|
|
231
|
+
StartEvents?.Invoke();
|
|
232
|
+
|
|
233
|
+
SetActive(true);
|
|
234
|
+
|
|
235
|
+
ServiceLocator.GetService<MenuState>().SetChanging(false);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
/// <inheritdoc/>
|
|
240
|
+
public override void BackGroup(CallbackContext context)
|
|
241
|
+
{
|
|
242
|
+
backInputContext = context;
|
|
243
|
+
|
|
244
|
+
if (backGroup != null && inPause.Value)
|
|
245
|
+
{
|
|
246
|
+
backGroup.SetEvaluateSelect();
|
|
247
|
+
|
|
248
|
+
backGroup.AddBackInput();
|
|
249
|
+
|
|
250
|
+
base.BackGroup(context);
|
|
251
|
+
}
|
|
252
|
+
else
|
|
253
|
+
{
|
|
254
|
+
OnBack?.Invoke();
|
|
255
|
+
|
|
256
|
+
Hide();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/// <inheritdoc/>
|
|
261
|
+
public override void Hide()
|
|
262
|
+
{
|
|
263
|
+
UnsubscribeControls();
|
|
264
|
+
|
|
265
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
266
|
+
|
|
267
|
+
Time.timeScale = 1;
|
|
268
|
+
|
|
269
|
+
EndEvents?.Invoke();
|
|
270
|
+
|
|
271
|
+
StartCoroutine(HideProcess());
|
|
272
|
+
|
|
273
|
+
if (ServiceLocator.HasService<VOManagerBase>(out var voManager))
|
|
274
|
+
voManager.StopVoiceLine();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/// <summary>
|
|
278
|
+
///
|
|
279
|
+
/// </summary>
|
|
280
|
+
/// <returns></returns>
|
|
281
|
+
protected virtual IEnumerator HideProcess()
|
|
282
|
+
{
|
|
283
|
+
if (visibilityComponent != null)
|
|
284
|
+
yield return visibilityComponent.HideTillComplete();
|
|
285
|
+
|
|
286
|
+
if (!inPause.Value && fastForwardModeWasEnabled.Value)
|
|
287
|
+
{
|
|
288
|
+
if (backInputContext.action == fastForward.action || fastForward.action.inProgress)
|
|
289
|
+
yield return new WaitUntil(() => !fastForward.action.inProgress);
|
|
290
|
+
|
|
291
|
+
fastForwardModeWasEnabled.SetValue(false);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (!inPause.Value)
|
|
295
|
+
inMenu.Value = false;
|
|
296
|
+
|
|
297
|
+
SetActive(false);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/// <summary>
|
|
302
|
+
///
|
|
303
|
+
/// </summary>
|
|
304
|
+
/// <param name="context"></param>
|
|
305
|
+
protected virtual void OnSelect(CallbackContext context)
|
|
306
|
+
{
|
|
307
|
+
if (lineCount == 0)
|
|
308
|
+
return;
|
|
309
|
+
|
|
310
|
+
BacklogLines entry = backlog.Lines.ToArray().Reverse().ToArray()[selectedSlotIndex];
|
|
311
|
+
|
|
312
|
+
if (entry.Voice == null || entry.Voice == string.Empty || !canPlayVoiceline)
|
|
313
|
+
return;
|
|
314
|
+
|
|
315
|
+
canPlayVoiceline = false;
|
|
316
|
+
|
|
317
|
+
StartCoroutine(VoiceLineCooldown());
|
|
318
|
+
|
|
319
|
+
ServiceLocator.GetService<VOManagerBase>().PlayVoiceLine(entry.Voice);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/// <summary>
|
|
323
|
+
///
|
|
324
|
+
/// </summary>
|
|
325
|
+
/// <returns></returns>
|
|
326
|
+
protected virtual IEnumerator VoiceLineCooldown()
|
|
327
|
+
{
|
|
328
|
+
yield return new WaitForSecondsRealtime(voicelineCooldown);
|
|
329
|
+
|
|
330
|
+
canPlayVoiceline = true;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
/// <inheritdoc/>
|
|
335
|
+
public override void SetEvaluateSelect() => RegenerateUI();
|
|
336
|
+
|
|
337
|
+
/// <inheritdoc/>
|
|
338
|
+
protected override void ResetGroup() => UnsubscribeControls();
|
|
339
|
+
|
|
340
|
+
/// <inheritdoc/>
|
|
341
|
+
protected override int InitializeTotalObjectCount()
|
|
342
|
+
{
|
|
343
|
+
var lines = backlog.Lines.ToArray().Reverse().ToArray();
|
|
344
|
+
|
|
345
|
+
lineCount = lines.Length < backlog.Capacity ? lines.Length : backlog.Capacity;
|
|
346
|
+
|
|
347
|
+
return lineCount;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
350
|
}
|