net.dreditor.dialogues.implementation 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.Dialogues.Implementation.asmdef +15 -15
- package/DREditor.Dialogues.Implementation.asmdef.meta +7 -7
- package/DialogueAssetDataClearer.cs +49 -49
- package/DialogueAssetDataClearer.cs.meta +11 -11
- package/DialogueAssetEndEventHandler.cs +57 -57
- package/DialogueAssetEndEventHandler.cs.meta +11 -11
- package/DialogueAssetEnder.cs +239 -239
- package/DialogueAssetEnder.cs.meta +11 -11
- package/DialogueAssetFinisher.cs +89 -89
- package/DialogueAssetFinisher.cs.meta +11 -11
- package/DialogueAssetFinisherBase.cs +82 -82
- package/DialogueAssetFinisherBase.cs.meta +11 -11
- package/DialogueAssetManager.cs +65 -65
- package/DialogueAssetManager.cs.meta +11 -11
- package/DialogueAssetReader.cs +377 -377
- package/DialogueAssetReader.cs.meta +11 -11
- package/DialogueAssetStarter.cs +254 -254
- package/DialogueAssetStarter.cs.meta +11 -11
- package/DialogueAssetStarterDebugger.cs +40 -40
- package/DialogueAssetStarterDebugger.cs.meta +11 -11
- package/DialogueAssetWaiter.cs +93 -93
- package/DialogueAssetWaiter.cs.meta +11 -11
- package/DialogueLineReader.cs +391 -391
- package/DialogueLineReader.cs.meta +11 -11
- package/DialogueManager.cs +83 -83
- package/DialogueManager.cs.meta +11 -11
- package/DialogueNameSaver.cs +45 -45
- package/DialogueNameSaver.cs.meta +11 -11
- package/FastForwardToLine.cs +102 -102
- package/FastForwardToLine.cs.meta +11 -11
- package/InstantDialogueEnder.cs +91 -91
- package/InstantDialogueEnder.cs.meta +11 -11
- package/InstantDialogueFinisher.cs +132 -132
- package/InstantDialogueFinisher.cs.meta +11 -11
- package/InstantDialogueStarter.cs +82 -82
- package/InstantDialogueStarter.cs.meta +11 -11
- package/NotLeavingOnDialogueFinish.cs +44 -44
- package/NotLeavingOnDialogueFinish.cs.meta +11 -11
- package/PreparableDialogueStarter.cs +88 -88
- package/PreparableDialogueStarter.cs.meta +11 -11
- package/{Samples → Samples~}/Dialogue_Asset_End_Event_Handler.prefab +685 -685
- package/{Samples → Samples~}/Dialogue_Asset_End_Event_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Ender.prefab +858 -858
- package/{Samples → Samples~}/Dialogue_Asset_Ender.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Finisher.prefab +301 -301
- package/{Samples → Samples~}/Dialogue_Asset_Finisher.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Load_Identifier.prefab +48 -48
- package/{Samples → Samples~}/Dialogue_Asset_Load_Identifier.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Loader.prefab +231 -231
- package/{Samples → Samples~}/Dialogue_Asset_Loader.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Reader_DRE.prefab +511 -511
- package/{Samples → Samples~}/Dialogue_Asset_Reader_DRE.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Reader_Shell.prefab +252 -252
- package/{Samples → Samples~}/Dialogue_Asset_Reader_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Reader_Template.prefab +193 -193
- package/{Samples → Samples~}/Dialogue_Asset_Reader_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Starter.prefab +613 -613
- package/{Samples → Samples~}/Dialogue_Asset_Starter.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Asset_Waiter.prefab +50 -50
- package/{Samples → Samples~}/Dialogue_Asset_Waiter.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Events_Shell.prefab +458 -458
- package/{Samples → Samples~}/Dialogue_Events_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Events_Template.prefab +302 -302
- package/{Samples → Samples~}/Dialogue_Events_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Line_Loader.prefab +1282 -1282
- package/{Samples → Samples~}/Dialogue_Line_Loader.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Line_Reader.prefab +3688 -3688
- package/{Samples → Samples~}/Dialogue_Line_Reader.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Name_Saver.prefab +48 -48
- package/{Samples → Samples~}/Dialogue_Name_Saver.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_System_Shell.prefab +325 -325
- package/{Samples → Samples~}/Dialogue_System_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_System_Template.prefab +1138 -1138
- package/{Samples → Samples~}/Dialogue_System_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Fast_Forward_To_Line_Tool.prefab +53 -53
- package/{Samples → Samples~}/Fast_Forward_To_Line_Tool.prefab.meta +7 -7
- package/{Samples → Samples~}/Instant_Dialogue_Ender.prefab +141 -141
- package/{Samples → Samples~}/Instant_Dialogue_Ender.prefab.meta +7 -7
- package/{Samples → Samples~}/Instant_Dialogue_Finisher.prefab +172 -172
- package/{Samples → Samples~}/Instant_Dialogue_Finisher.prefab.meta +7 -7
- package/{Samples → Samples~}/Instant_Dialogue_Starter.prefab +55 -55
- package/{Samples → Samples~}/Instant_Dialogue_Starter.prefab.meta +7 -7
- package/{Samples → Samples~}/On_Loading_Through_Scene_Transition.prefab +48 -48
- package/{Samples → Samples~}/On_Loading_Through_Scene_Transition.prefab.meta +7 -7
- package/{Samples → Samples~}/Scene_Event_On_Text_Display.prefab +47 -47
- package/{Samples → Samples~}/Scene_Event_On_Text_Display.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_Dialogue_Asset_Reader.prefab +561 -561
- package/{Samples → Samples~}/Trial_Dialogue_Asset_Reader.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_Dialogue_Asset_Starter.prefab +239 -239
- package/{Samples → Samples~}/Trial_Dialogue_Asset_Starter.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_Dialogue_Line_Loader.prefab +941 -941
- package/{Samples → Samples~}/Trial_Dialogue_Line_Loader.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_Dialogue_Loader.prefab +232 -232
- package/{Samples → Samples~}/Trial_Dialogue_Loader.prefab.meta +7 -7
- package/{Samples → Samples~}/Tween_Waiter_Handler.prefab +46 -46
- package/{Samples → Samples~}/Tween_Waiter_Handler.prefab.meta +7 -7
- package/package.json +39 -34
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/DialogueLineReader.cs
CHANGED
|
@@ -1,392 +1,392 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues.LineReading;
|
|
3
|
-
using DREditor.EventObjects;
|
|
4
|
-
using DREditor.Saving;
|
|
5
|
-
using DREditor.Services;
|
|
6
|
-
using System;
|
|
7
|
-
using System.Collections;
|
|
8
|
-
using System.Collections.Generic;
|
|
9
|
-
using System.Linq;
|
|
10
|
-
using UnityEngine;
|
|
11
|
-
|
|
12
|
-
namespace DREditor.Dialogues.Implementation
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[ClassHeader(nameof(LineReader) + ", " + nameof(ILineReader) + ", " + nameof(IDRESaveable) + ", " + nameof(IDRELoadable) +
|
|
18
|
-
"\n\n")]
|
|
19
|
-
public class DialogueLineReader : LineReader, ILineReader, IDRESaveable, IDRELoadable
|
|
20
|
-
{
|
|
21
|
-
#region Fields
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Header("")]
|
|
27
|
-
[Divider]
|
|
28
|
-
[Tooltip("")]
|
|
29
|
-
[SerializeField] protected BoolWithEvent dialogueLoaded = null;
|
|
30
|
-
|
|
31
|
-
/// <summary>
|
|
32
|
-
///
|
|
33
|
-
/// </summary>
|
|
34
|
-
[Tooltip("")]
|
|
35
|
-
[SerializeField] protected BoolWithEvent isLoadingFile = null;
|
|
36
|
-
|
|
37
|
-
/// <summary>
|
|
38
|
-
///
|
|
39
|
-
/// </summary>
|
|
40
|
-
[Tooltip("")]
|
|
41
|
-
[SerializeField] protected BoolWithEvent hasMenuAccess = null;
|
|
42
|
-
|
|
43
|
-
/// <summary>
|
|
44
|
-
///
|
|
45
|
-
/// </summary>
|
|
46
|
-
[Tooltip("")]
|
|
47
|
-
[SerializeField] protected BoolWithEvent inFastForwardMode = null;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/// <summary>
|
|
51
|
-
///
|
|
52
|
-
/// </summary>
|
|
53
|
-
[Header("")]
|
|
54
|
-
[Divider]
|
|
55
|
-
[Tooltip("")]
|
|
56
|
-
[SerializeField] protected List<DialogueComponent> LineStartComponents = new();
|
|
57
|
-
|
|
58
|
-
/// <summary>
|
|
59
|
-
///
|
|
60
|
-
/// </summary>
|
|
61
|
-
[Tooltip("")]
|
|
62
|
-
[SerializeField] protected List<DialogueComponent> LineLastingEventComponents = new();
|
|
63
|
-
|
|
64
|
-
/// <summary>
|
|
65
|
-
///
|
|
66
|
-
/// </summary>
|
|
67
|
-
[Tooltip("")]
|
|
68
|
-
[SerializeField] protected List<DialogueComponent> LineProcessComponents = new();
|
|
69
|
-
|
|
70
|
-
/// <summary>
|
|
71
|
-
///
|
|
72
|
-
/// </summary>
|
|
73
|
-
[Tooltip("")]
|
|
74
|
-
[SerializeField] protected List<DialogueComponent> LineTextDisplayComponents = new();
|
|
75
|
-
|
|
76
|
-
/// <summary>
|
|
77
|
-
///
|
|
78
|
-
/// </summary>
|
|
79
|
-
[Tooltip("")]
|
|
80
|
-
[SerializeField] protected List<DialogueComponent> LinePostTextDisplayComponents = new();
|
|
81
|
-
|
|
82
|
-
/// <summary>
|
|
83
|
-
///
|
|
84
|
-
/// </summary>
|
|
85
|
-
[Tooltip("")]
|
|
86
|
-
[SerializeField] protected List<DialogueComponent> LineWaitForClickComponents = new();
|
|
87
|
-
|
|
88
|
-
/// <summary>
|
|
89
|
-
///
|
|
90
|
-
/// </summary>
|
|
91
|
-
[Tooltip("")]
|
|
92
|
-
[SerializeField] protected List<DialogueComponent> LineEndComponents = new();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/// <summary>
|
|
96
|
-
///
|
|
97
|
-
/// </summary>
|
|
98
|
-
[Header("")]
|
|
99
|
-
[Divider]
|
|
100
|
-
[Tooltip("")]
|
|
101
|
-
[SerializeField] protected string currentLineNumberSaveKey = "LineNum";
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
public event Action OnLineStart;
|
|
105
|
-
|
|
106
|
-
public event Action OnLineEndEvent;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/// <summary>
|
|
110
|
-
///
|
|
111
|
-
/// </summary>
|
|
112
|
-
protected int saveLineNum = 0;
|
|
113
|
-
|
|
114
|
-
#endregion
|
|
115
|
-
|
|
116
|
-
#region Dialogue Line Reading
|
|
117
|
-
|
|
118
|
-
/// <inheritdoc/>
|
|
119
|
-
public override IEnumerator PlayDialogueLine<T2>(DialogueBase<T2> currentDialogueCore, Line currentLine,
|
|
120
|
-
Action exitParentRoutine = null, Action continueLine = null)
|
|
121
|
-
{
|
|
122
|
-
OnLineStart?.Invoke();
|
|
123
|
-
|
|
124
|
-
InvokeLineStartProcesses(currentLine);
|
|
125
|
-
|
|
126
|
-
bool skipLine = false;
|
|
127
|
-
|
|
128
|
-
yield return InvokeLineLastingEvents(currentLine, () => { skipLine = true; });
|
|
129
|
-
|
|
130
|
-
if (skipLine)
|
|
131
|
-
{
|
|
132
|
-
UpdateAndContinueLine(continueLine);
|
|
133
|
-
|
|
134
|
-
yield break;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
yield return InvokeLineProcesses(currentLine);
|
|
139
|
-
|
|
140
|
-
if (DialogueLineIsEmpty(currentLine))
|
|
141
|
-
{
|
|
142
|
-
UpdateAndContinueLine(continueLine);
|
|
143
|
-
|
|
144
|
-
yield break;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
yield return InvokeLineTextDisplayComponents(currentLine);
|
|
148
|
-
|
|
149
|
-
if (isLoadingFile.Value)
|
|
150
|
-
yield return WaitForGameFileToFinishLoading();
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
InvokeLinePostTextDisplayComponents(currentLine);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
bool exitParent = false;
|
|
157
|
-
|
|
158
|
-
yield return InvokeWaitForClickComponents(currentDialogueCore, currentLine, () => { exitParent = true; });
|
|
159
|
-
|
|
160
|
-
if (exitParent)
|
|
161
|
-
{
|
|
162
|
-
exitParentRoutine?.Invoke();
|
|
163
|
-
|
|
164
|
-
yield break;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
hasMenuAccess.SetValue(false);
|
|
169
|
-
|
|
170
|
-
yield return InvokeLineEndComponents(currentLine);
|
|
171
|
-
|
|
172
|
-
SetSaveLineNumber(saveLineNum + 1);
|
|
173
|
-
|
|
174
|
-
OnLineEndEvent?.Invoke();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/// <summary>
|
|
178
|
-
///
|
|
179
|
-
/// </summary>
|
|
180
|
-
/// <param name="continueLine"></param>
|
|
181
|
-
protected virtual void UpdateAndContinueLine(Action continueLine)
|
|
182
|
-
{
|
|
183
|
-
SetSaveLineNumber(saveLineNum + 1);
|
|
184
|
-
|
|
185
|
-
continueLine?.Invoke();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/// <summary>
|
|
189
|
-
///
|
|
190
|
-
/// </summary>
|
|
191
|
-
/// <param name="saveLineNum"></param>
|
|
192
|
-
protected virtual void SetSaveLineNumber(int saveLineNum) => this.saveLineNum = saveLineNum;
|
|
193
|
-
|
|
194
|
-
/// <summary>
|
|
195
|
-
///
|
|
196
|
-
/// </summary>
|
|
197
|
-
/// <param name="currentLine"></param>
|
|
198
|
-
protected virtual void InvokeLineStartProcesses(Line currentLine)
|
|
199
|
-
{
|
|
200
|
-
foreach (var starter in LineStartComponents)
|
|
201
|
-
if (starter is ILineStarter lineStarter)
|
|
202
|
-
lineStarter.LineStartProcess(currentLine);
|
|
203
|
-
else
|
|
204
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {starter.GetType().Name} on {starter.gameObject.name} " +
|
|
205
|
-
$"was not a valid {nameof(ILineStarter)}!" +
|
|
206
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LineStartComponents)} list on the line reader.");
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/// <summary>
|
|
210
|
-
///
|
|
211
|
-
/// </summary>
|
|
212
|
-
/// <param name="currentLine"></param>
|
|
213
|
-
/// <param name="continueLine"></param>
|
|
214
|
-
protected virtual IEnumerator InvokeLineLastingEvents(Line currentLine, Action continueLine)
|
|
215
|
-
{
|
|
216
|
-
foreach (var lastingEvent in LineLastingEventComponents)
|
|
217
|
-
{
|
|
218
|
-
if (lastingEvent is ILineLastingEvent lineLastingEvent)
|
|
219
|
-
{
|
|
220
|
-
bool skipLine = false;
|
|
221
|
-
|
|
222
|
-
yield return lineLastingEvent.LineLastingEvaluation(currentLine, () => { skipLine = true; });
|
|
223
|
-
|
|
224
|
-
if (skipLine)
|
|
225
|
-
{
|
|
226
|
-
continueLine?.Invoke();
|
|
227
|
-
|
|
228
|
-
yield break;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
else
|
|
232
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {lastingEvent.GetType().Name} on " +
|
|
233
|
-
$"{lastingEvent.gameObject.name} was not a valid {nameof(ILineLastingEvent)}!" +
|
|
234
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LineLastingEventComponents)} list on the line reader.");
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/// <summary>
|
|
239
|
-
///
|
|
240
|
-
/// </summary>
|
|
241
|
-
/// <param name="currentLine"></param>
|
|
242
|
-
/// <returns></returns>
|
|
243
|
-
protected virtual bool DialogueLineIsEmpty(Line currentLine) => currentLine.Text == "" && !isLoadingFile.Value;
|
|
244
|
-
|
|
245
|
-
/// <summary>
|
|
246
|
-
///
|
|
247
|
-
/// </summary>
|
|
248
|
-
/// <param name="currentLine"></param>
|
|
249
|
-
protected virtual IEnumerator InvokeLineProcesses(Line currentLine)
|
|
250
|
-
{
|
|
251
|
-
foreach (var processor in LineProcessComponents)
|
|
252
|
-
{
|
|
253
|
-
if (processor is ILineProcessor lineProcessor)
|
|
254
|
-
lineProcessor.LineProcess(currentLine);
|
|
255
|
-
|
|
256
|
-
if (processor is ILineProcessorRoutine lineRoutine && lineRoutine.ShouldProcess(currentLine))
|
|
257
|
-
yield return lineRoutine.LineProcessRoutine(currentLine);
|
|
258
|
-
|
|
259
|
-
if (processor is not ILineProcessor && processor is not ILineProcessorRoutine)
|
|
260
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {processor.GetType().Name} on {processor.gameObject.name} " +
|
|
261
|
-
$"was not a valid {nameof(ILineProcessor)} or {nameof(ILineProcessorRoutine)}!" +
|
|
262
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LineProcessComponents)} list on the line reader.");
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/// <summary>
|
|
267
|
-
///
|
|
268
|
-
/// </summary>
|
|
269
|
-
/// <param name="currentLine"></param>
|
|
270
|
-
/// <remarks></remarks>
|
|
271
|
-
protected virtual IEnumerator InvokeLineTextDisplayComponents(Line currentLine)
|
|
272
|
-
{
|
|
273
|
-
foreach (var processor in LineTextDisplayComponents)
|
|
274
|
-
if (processor is ILineTextDisplay lineProcessor)
|
|
275
|
-
lineProcessor.LineTextDisplay(currentLine);
|
|
276
|
-
else if (processor is ILineTextDisplayRoutine lineRoutine && lineRoutine.ShouldProcess(currentLine))
|
|
277
|
-
yield return lineRoutine.LineTextDisplay(currentLine);
|
|
278
|
-
else if (processor is not ILineTextDisplay && processor is not ILineTextDisplayRoutine)
|
|
279
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {processor.GetType().Name} on {processor.gameObject.name} " +
|
|
280
|
-
$"was not a valid {nameof(ILineTextDisplay)} or {nameof(ILineTextDisplayRoutine)}!" +
|
|
281
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LineTextDisplayComponents)} list on the line reader.");
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/// <summary>
|
|
285
|
-
///
|
|
286
|
-
/// </summary>
|
|
287
|
-
protected virtual IEnumerator WaitForGameFileToFinishLoading()
|
|
288
|
-
{
|
|
289
|
-
UnityEngine.Debug.LogWarning($"REPORT: {ToString()}: Noticed Dialogue has Finished Loading.");
|
|
290
|
-
|
|
291
|
-
dialogueLoaded.SetValue(true);
|
|
292
|
-
|
|
293
|
-
yield return new WaitUntil(() => !isLoadingFile.Value);
|
|
294
|
-
|
|
295
|
-
AudioListener.volume = 1;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/// <summary>
|
|
299
|
-
///
|
|
300
|
-
/// </summary>
|
|
301
|
-
/// <param name="currentLine"></param>
|
|
302
|
-
protected virtual void InvokeLinePostTextDisplayComponents(Line currentLine)
|
|
303
|
-
{
|
|
304
|
-
foreach (var postTextDisplay in LinePostTextDisplayComponents)
|
|
305
|
-
if (postTextDisplay is ILinePostTextDisplay linePostTextDisplay)
|
|
306
|
-
linePostTextDisplay.LinePostTextProcess(currentLine);
|
|
307
|
-
else
|
|
308
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {postTextDisplay.GetType().Name} on " +
|
|
309
|
-
$"{postTextDisplay.gameObject.name} was not a valid {nameof(ILinePostTextDisplay)}!" +
|
|
310
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LinePostTextDisplayComponents)} list on the line reader.");
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/// <summary>
|
|
314
|
-
///
|
|
315
|
-
/// </summary>
|
|
316
|
-
/// <param name="currentDialogue"></param>
|
|
317
|
-
/// <param name="currentLine"></param>
|
|
318
|
-
/// <param name="exitParentRoutine"></param>
|
|
319
|
-
protected virtual IEnumerator InvokeWaitForClickComponents<T>(DialogueBase<T> currentDialogue,
|
|
320
|
-
Line currentLine, Action exitParentRoutine)
|
|
321
|
-
where T : Line
|
|
322
|
-
{
|
|
323
|
-
foreach (var waitForClick in LineWaitForClickComponents)
|
|
324
|
-
{
|
|
325
|
-
if (waitForClick is ILineWaitForClick lineWaitForClick)
|
|
326
|
-
{
|
|
327
|
-
if (inFastForwardMode.Value && lineWaitForClick.SkipOnFastForward)
|
|
328
|
-
continue;
|
|
329
|
-
|
|
330
|
-
bool exitParent = false;
|
|
331
|
-
|
|
332
|
-
yield return lineWaitForClick.LineWaitForClick(currentDialogue, currentLine, () => { exitParent = true; });
|
|
333
|
-
|
|
334
|
-
if (exitParent)
|
|
335
|
-
{
|
|
336
|
-
exitParentRoutine?.Invoke();
|
|
337
|
-
|
|
338
|
-
yield break;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
else
|
|
342
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {waitForClick.GetType().Name} on " +
|
|
343
|
-
$"{waitForClick.gameObject.name} was not a valid {nameof(ILineWaitForClick)}!" +
|
|
344
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LineWaitForClickComponents)} list on the line reader.");
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/// <summary>
|
|
349
|
-
///
|
|
350
|
-
/// </summary>
|
|
351
|
-
/// <param name="currentLine"></param>
|
|
352
|
-
/// <remarks></remarks>
|
|
353
|
-
protected virtual IEnumerator InvokeLineEndComponents(Line currentLine)
|
|
354
|
-
{
|
|
355
|
-
foreach (var endProcessor in LineEndComponents)
|
|
356
|
-
if (endProcessor is ILineEndProcess lineProcessor)
|
|
357
|
-
lineProcessor.LineEndProcess(currentLine);
|
|
358
|
-
else if (endProcessor is ILineEndProcessRoutine lineRoutine)
|
|
359
|
-
yield return lineRoutine.LineEndProcess(currentLine);
|
|
360
|
-
else if (endProcessor is not ILineTextDisplay && endProcessor is not ILineTextDisplayRoutine)
|
|
361
|
-
UnityEngine.Debug.LogWarning($"ALERT: The component: {endProcessor.GetType().Name} on " +
|
|
362
|
-
$"{endProcessor.gameObject.name} was not a valid " +
|
|
363
|
-
$"{nameof(ILineEndProcess)} or {nameof(ILineEndProcessRoutine)}!" +
|
|
364
|
-
$"\nPROPOSAL: Remove this object from the {nameof(LineEndComponents)} list on the line reader.");
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
#endregion
|
|
368
|
-
|
|
369
|
-
#region Additional public Functions
|
|
370
|
-
|
|
371
|
-
/// <inheritdoc/>
|
|
372
|
-
public override void ClearSaveDataOnDialogueStart() => SetSaveLineNumber(0);
|
|
373
|
-
|
|
374
|
-
/// <inheritdoc/>
|
|
375
|
-
public override void ClearSaveData() => ClearSaveDataOnDialogueStart();
|
|
376
|
-
|
|
377
|
-
/// <inheritdoc/>
|
|
378
|
-
public virtual void Save(Dictionary<string, object> saveDatas)
|
|
379
|
-
{
|
|
380
|
-
if (!ServiceLocator.GetService<IDialogueManager>().GetComponentsInChildren<DialogueComponent>().Contains(this))
|
|
381
|
-
return;
|
|
382
|
-
|
|
383
|
-
saveDatas.Set(currentLineNumberSaveKey, saveLineNum);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/// <inheritdoc/>
|
|
387
|
-
public virtual void Load(Dictionary<string, object> saveDatas)
|
|
388
|
-
=> SetSaveLineNumber(saveDatas.Get<int>(currentLineNumberSaveKey));
|
|
389
|
-
|
|
390
|
-
#endregion
|
|
391
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues.LineReading;
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using DREditor.Saving;
|
|
5
|
+
using DREditor.Services;
|
|
6
|
+
using System;
|
|
7
|
+
using System.Collections;
|
|
8
|
+
using System.Collections.Generic;
|
|
9
|
+
using System.Linq;
|
|
10
|
+
using UnityEngine;
|
|
11
|
+
|
|
12
|
+
namespace DREditor.Dialogues.Implementation
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[ClassHeader(nameof(LineReader) + ", " + nameof(ILineReader) + ", " + nameof(IDRESaveable) + ", " + nameof(IDRELoadable) +
|
|
18
|
+
"\n\n")]
|
|
19
|
+
public class DialogueLineReader : LineReader, ILineReader, IDRESaveable, IDRELoadable
|
|
20
|
+
{
|
|
21
|
+
#region Fields
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Header("")]
|
|
27
|
+
[Divider]
|
|
28
|
+
[Tooltip("")]
|
|
29
|
+
[SerializeField] protected BoolWithEvent dialogueLoaded = null;
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
[Tooltip("")]
|
|
35
|
+
[SerializeField] protected BoolWithEvent isLoadingFile = null;
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
///
|
|
39
|
+
/// </summary>
|
|
40
|
+
[Tooltip("")]
|
|
41
|
+
[SerializeField] protected BoolWithEvent hasMenuAccess = null;
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
[Tooltip("")]
|
|
47
|
+
[SerializeField] protected BoolWithEvent inFastForwardMode = null;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Header("")]
|
|
54
|
+
[Divider]
|
|
55
|
+
[Tooltip("")]
|
|
56
|
+
[SerializeField] protected List<DialogueComponent> LineStartComponents = new();
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
///
|
|
60
|
+
/// </summary>
|
|
61
|
+
[Tooltip("")]
|
|
62
|
+
[SerializeField] protected List<DialogueComponent> LineLastingEventComponents = new();
|
|
63
|
+
|
|
64
|
+
/// <summary>
|
|
65
|
+
///
|
|
66
|
+
/// </summary>
|
|
67
|
+
[Tooltip("")]
|
|
68
|
+
[SerializeField] protected List<DialogueComponent> LineProcessComponents = new();
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
///
|
|
72
|
+
/// </summary>
|
|
73
|
+
[Tooltip("")]
|
|
74
|
+
[SerializeField] protected List<DialogueComponent> LineTextDisplayComponents = new();
|
|
75
|
+
|
|
76
|
+
/// <summary>
|
|
77
|
+
///
|
|
78
|
+
/// </summary>
|
|
79
|
+
[Tooltip("")]
|
|
80
|
+
[SerializeField] protected List<DialogueComponent> LinePostTextDisplayComponents = new();
|
|
81
|
+
|
|
82
|
+
/// <summary>
|
|
83
|
+
///
|
|
84
|
+
/// </summary>
|
|
85
|
+
[Tooltip("")]
|
|
86
|
+
[SerializeField] protected List<DialogueComponent> LineWaitForClickComponents = new();
|
|
87
|
+
|
|
88
|
+
/// <summary>
|
|
89
|
+
///
|
|
90
|
+
/// </summary>
|
|
91
|
+
[Tooltip("")]
|
|
92
|
+
[SerializeField] protected List<DialogueComponent> LineEndComponents = new();
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
///
|
|
97
|
+
/// </summary>
|
|
98
|
+
[Header("")]
|
|
99
|
+
[Divider]
|
|
100
|
+
[Tooltip("")]
|
|
101
|
+
[SerializeField] protected string currentLineNumberSaveKey = "LineNum";
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
public event Action OnLineStart;
|
|
105
|
+
|
|
106
|
+
public event Action OnLineEndEvent;
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
///
|
|
111
|
+
/// </summary>
|
|
112
|
+
protected int saveLineNum = 0;
|
|
113
|
+
|
|
114
|
+
#endregion
|
|
115
|
+
|
|
116
|
+
#region Dialogue Line Reading
|
|
117
|
+
|
|
118
|
+
/// <inheritdoc/>
|
|
119
|
+
public override IEnumerator PlayDialogueLine<T2>(DialogueBase<T2> currentDialogueCore, Line currentLine,
|
|
120
|
+
Action exitParentRoutine = null, Action continueLine = null)
|
|
121
|
+
{
|
|
122
|
+
OnLineStart?.Invoke();
|
|
123
|
+
|
|
124
|
+
InvokeLineStartProcesses(currentLine);
|
|
125
|
+
|
|
126
|
+
bool skipLine = false;
|
|
127
|
+
|
|
128
|
+
yield return InvokeLineLastingEvents(currentLine, () => { skipLine = true; });
|
|
129
|
+
|
|
130
|
+
if (skipLine)
|
|
131
|
+
{
|
|
132
|
+
UpdateAndContinueLine(continueLine);
|
|
133
|
+
|
|
134
|
+
yield break;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
yield return InvokeLineProcesses(currentLine);
|
|
139
|
+
|
|
140
|
+
if (DialogueLineIsEmpty(currentLine))
|
|
141
|
+
{
|
|
142
|
+
UpdateAndContinueLine(continueLine);
|
|
143
|
+
|
|
144
|
+
yield break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
yield return InvokeLineTextDisplayComponents(currentLine);
|
|
148
|
+
|
|
149
|
+
if (isLoadingFile.Value)
|
|
150
|
+
yield return WaitForGameFileToFinishLoading();
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
InvokeLinePostTextDisplayComponents(currentLine);
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
bool exitParent = false;
|
|
157
|
+
|
|
158
|
+
yield return InvokeWaitForClickComponents(currentDialogueCore, currentLine, () => { exitParent = true; });
|
|
159
|
+
|
|
160
|
+
if (exitParent)
|
|
161
|
+
{
|
|
162
|
+
exitParentRoutine?.Invoke();
|
|
163
|
+
|
|
164
|
+
yield break;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
hasMenuAccess.SetValue(false);
|
|
169
|
+
|
|
170
|
+
yield return InvokeLineEndComponents(currentLine);
|
|
171
|
+
|
|
172
|
+
SetSaveLineNumber(saveLineNum + 1);
|
|
173
|
+
|
|
174
|
+
OnLineEndEvent?.Invoke();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/// <summary>
|
|
178
|
+
///
|
|
179
|
+
/// </summary>
|
|
180
|
+
/// <param name="continueLine"></param>
|
|
181
|
+
protected virtual void UpdateAndContinueLine(Action continueLine)
|
|
182
|
+
{
|
|
183
|
+
SetSaveLineNumber(saveLineNum + 1);
|
|
184
|
+
|
|
185
|
+
continueLine?.Invoke();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/// <summary>
|
|
189
|
+
///
|
|
190
|
+
/// </summary>
|
|
191
|
+
/// <param name="saveLineNum"></param>
|
|
192
|
+
protected virtual void SetSaveLineNumber(int saveLineNum) => this.saveLineNum = saveLineNum;
|
|
193
|
+
|
|
194
|
+
/// <summary>
|
|
195
|
+
///
|
|
196
|
+
/// </summary>
|
|
197
|
+
/// <param name="currentLine"></param>
|
|
198
|
+
protected virtual void InvokeLineStartProcesses(Line currentLine)
|
|
199
|
+
{
|
|
200
|
+
foreach (var starter in LineStartComponents)
|
|
201
|
+
if (starter is ILineStarter lineStarter)
|
|
202
|
+
lineStarter.LineStartProcess(currentLine);
|
|
203
|
+
else
|
|
204
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {starter.GetType().Name} on {starter.gameObject.name} " +
|
|
205
|
+
$"was not a valid {nameof(ILineStarter)}!" +
|
|
206
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LineStartComponents)} list on the line reader.");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/// <summary>
|
|
210
|
+
///
|
|
211
|
+
/// </summary>
|
|
212
|
+
/// <param name="currentLine"></param>
|
|
213
|
+
/// <param name="continueLine"></param>
|
|
214
|
+
protected virtual IEnumerator InvokeLineLastingEvents(Line currentLine, Action continueLine)
|
|
215
|
+
{
|
|
216
|
+
foreach (var lastingEvent in LineLastingEventComponents)
|
|
217
|
+
{
|
|
218
|
+
if (lastingEvent is ILineLastingEvent lineLastingEvent)
|
|
219
|
+
{
|
|
220
|
+
bool skipLine = false;
|
|
221
|
+
|
|
222
|
+
yield return lineLastingEvent.LineLastingEvaluation(currentLine, () => { skipLine = true; });
|
|
223
|
+
|
|
224
|
+
if (skipLine)
|
|
225
|
+
{
|
|
226
|
+
continueLine?.Invoke();
|
|
227
|
+
|
|
228
|
+
yield break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else
|
|
232
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {lastingEvent.GetType().Name} on " +
|
|
233
|
+
$"{lastingEvent.gameObject.name} was not a valid {nameof(ILineLastingEvent)}!" +
|
|
234
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LineLastingEventComponents)} list on the line reader.");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/// <summary>
|
|
239
|
+
///
|
|
240
|
+
/// </summary>
|
|
241
|
+
/// <param name="currentLine"></param>
|
|
242
|
+
/// <returns></returns>
|
|
243
|
+
protected virtual bool DialogueLineIsEmpty(Line currentLine) => currentLine.Text == "" && !isLoadingFile.Value;
|
|
244
|
+
|
|
245
|
+
/// <summary>
|
|
246
|
+
///
|
|
247
|
+
/// </summary>
|
|
248
|
+
/// <param name="currentLine"></param>
|
|
249
|
+
protected virtual IEnumerator InvokeLineProcesses(Line currentLine)
|
|
250
|
+
{
|
|
251
|
+
foreach (var processor in LineProcessComponents)
|
|
252
|
+
{
|
|
253
|
+
if (processor is ILineProcessor lineProcessor)
|
|
254
|
+
lineProcessor.LineProcess(currentLine);
|
|
255
|
+
|
|
256
|
+
if (processor is ILineProcessorRoutine lineRoutine && lineRoutine.ShouldProcess(currentLine))
|
|
257
|
+
yield return lineRoutine.LineProcessRoutine(currentLine);
|
|
258
|
+
|
|
259
|
+
if (processor is not ILineProcessor && processor is not ILineProcessorRoutine)
|
|
260
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {processor.GetType().Name} on {processor.gameObject.name} " +
|
|
261
|
+
$"was not a valid {nameof(ILineProcessor)} or {nameof(ILineProcessorRoutine)}!" +
|
|
262
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LineProcessComponents)} list on the line reader.");
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/// <summary>
|
|
267
|
+
///
|
|
268
|
+
/// </summary>
|
|
269
|
+
/// <param name="currentLine"></param>
|
|
270
|
+
/// <remarks></remarks>
|
|
271
|
+
protected virtual IEnumerator InvokeLineTextDisplayComponents(Line currentLine)
|
|
272
|
+
{
|
|
273
|
+
foreach (var processor in LineTextDisplayComponents)
|
|
274
|
+
if (processor is ILineTextDisplay lineProcessor)
|
|
275
|
+
lineProcessor.LineTextDisplay(currentLine);
|
|
276
|
+
else if (processor is ILineTextDisplayRoutine lineRoutine && lineRoutine.ShouldProcess(currentLine))
|
|
277
|
+
yield return lineRoutine.LineTextDisplay(currentLine);
|
|
278
|
+
else if (processor is not ILineTextDisplay && processor is not ILineTextDisplayRoutine)
|
|
279
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {processor.GetType().Name} on {processor.gameObject.name} " +
|
|
280
|
+
$"was not a valid {nameof(ILineTextDisplay)} or {nameof(ILineTextDisplayRoutine)}!" +
|
|
281
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LineTextDisplayComponents)} list on the line reader.");
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/// <summary>
|
|
285
|
+
///
|
|
286
|
+
/// </summary>
|
|
287
|
+
protected virtual IEnumerator WaitForGameFileToFinishLoading()
|
|
288
|
+
{
|
|
289
|
+
UnityEngine.Debug.LogWarning($"REPORT: {ToString()}: Noticed Dialogue has Finished Loading.");
|
|
290
|
+
|
|
291
|
+
dialogueLoaded.SetValue(true);
|
|
292
|
+
|
|
293
|
+
yield return new WaitUntil(() => !isLoadingFile.Value);
|
|
294
|
+
|
|
295
|
+
AudioListener.volume = 1;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/// <summary>
|
|
299
|
+
///
|
|
300
|
+
/// </summary>
|
|
301
|
+
/// <param name="currentLine"></param>
|
|
302
|
+
protected virtual void InvokeLinePostTextDisplayComponents(Line currentLine)
|
|
303
|
+
{
|
|
304
|
+
foreach (var postTextDisplay in LinePostTextDisplayComponents)
|
|
305
|
+
if (postTextDisplay is ILinePostTextDisplay linePostTextDisplay)
|
|
306
|
+
linePostTextDisplay.LinePostTextProcess(currentLine);
|
|
307
|
+
else
|
|
308
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {postTextDisplay.GetType().Name} on " +
|
|
309
|
+
$"{postTextDisplay.gameObject.name} was not a valid {nameof(ILinePostTextDisplay)}!" +
|
|
310
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LinePostTextDisplayComponents)} list on the line reader.");
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/// <summary>
|
|
314
|
+
///
|
|
315
|
+
/// </summary>
|
|
316
|
+
/// <param name="currentDialogue"></param>
|
|
317
|
+
/// <param name="currentLine"></param>
|
|
318
|
+
/// <param name="exitParentRoutine"></param>
|
|
319
|
+
protected virtual IEnumerator InvokeWaitForClickComponents<T>(DialogueBase<T> currentDialogue,
|
|
320
|
+
Line currentLine, Action exitParentRoutine)
|
|
321
|
+
where T : Line
|
|
322
|
+
{
|
|
323
|
+
foreach (var waitForClick in LineWaitForClickComponents)
|
|
324
|
+
{
|
|
325
|
+
if (waitForClick is ILineWaitForClick lineWaitForClick)
|
|
326
|
+
{
|
|
327
|
+
if (inFastForwardMode.Value && lineWaitForClick.SkipOnFastForward)
|
|
328
|
+
continue;
|
|
329
|
+
|
|
330
|
+
bool exitParent = false;
|
|
331
|
+
|
|
332
|
+
yield return lineWaitForClick.LineWaitForClick(currentDialogue, currentLine, () => { exitParent = true; });
|
|
333
|
+
|
|
334
|
+
if (exitParent)
|
|
335
|
+
{
|
|
336
|
+
exitParentRoutine?.Invoke();
|
|
337
|
+
|
|
338
|
+
yield break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else
|
|
342
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {waitForClick.GetType().Name} on " +
|
|
343
|
+
$"{waitForClick.gameObject.name} was not a valid {nameof(ILineWaitForClick)}!" +
|
|
344
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LineWaitForClickComponents)} list on the line reader.");
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/// <summary>
|
|
349
|
+
///
|
|
350
|
+
/// </summary>
|
|
351
|
+
/// <param name="currentLine"></param>
|
|
352
|
+
/// <remarks></remarks>
|
|
353
|
+
protected virtual IEnumerator InvokeLineEndComponents(Line currentLine)
|
|
354
|
+
{
|
|
355
|
+
foreach (var endProcessor in LineEndComponents)
|
|
356
|
+
if (endProcessor is ILineEndProcess lineProcessor)
|
|
357
|
+
lineProcessor.LineEndProcess(currentLine);
|
|
358
|
+
else if (endProcessor is ILineEndProcessRoutine lineRoutine)
|
|
359
|
+
yield return lineRoutine.LineEndProcess(currentLine);
|
|
360
|
+
else if (endProcessor is not ILineTextDisplay && endProcessor is not ILineTextDisplayRoutine)
|
|
361
|
+
UnityEngine.Debug.LogWarning($"ALERT: The component: {endProcessor.GetType().Name} on " +
|
|
362
|
+
$"{endProcessor.gameObject.name} was not a valid " +
|
|
363
|
+
$"{nameof(ILineEndProcess)} or {nameof(ILineEndProcessRoutine)}!" +
|
|
364
|
+
$"\nPROPOSAL: Remove this object from the {nameof(LineEndComponents)} list on the line reader.");
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
#endregion
|
|
368
|
+
|
|
369
|
+
#region Additional public Functions
|
|
370
|
+
|
|
371
|
+
/// <inheritdoc/>
|
|
372
|
+
public override void ClearSaveDataOnDialogueStart() => SetSaveLineNumber(0);
|
|
373
|
+
|
|
374
|
+
/// <inheritdoc/>
|
|
375
|
+
public override void ClearSaveData() => ClearSaveDataOnDialogueStart();
|
|
376
|
+
|
|
377
|
+
/// <inheritdoc/>
|
|
378
|
+
public virtual void Save(Dictionary<string, object> saveDatas)
|
|
379
|
+
{
|
|
380
|
+
if (!ServiceLocator.GetService<IDialogueManager>().GetComponentsInChildren<DialogueComponent>().Contains(this))
|
|
381
|
+
return;
|
|
382
|
+
|
|
383
|
+
saveDatas.Set(currentLineNumberSaveKey, saveLineNum);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/// <inheritdoc/>
|
|
387
|
+
public virtual void Load(Dictionary<string, object> saveDatas)
|
|
388
|
+
=> SetSaveLineNumber(saveDatas.Get<int>(currentLineNumberSaveKey));
|
|
389
|
+
|
|
390
|
+
#endregion
|
|
391
|
+
}
|
|
392
392
|
}
|