net.dreditor.dialogues.implementation 0.0.0-stage → 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/DREditor.Dialogues.Implementation.asmdef +16 -0
- package/DREditor.Dialogues.Implementation.asmdef.meta +7 -0
- package/DialogueAssetDataClearer.cs +50 -0
- package/DialogueAssetDataClearer.cs.meta +11 -0
- package/DialogueAssetEndEventHandler.cs +58 -0
- package/DialogueAssetEndEventHandler.cs.meta +11 -0
- package/DialogueAssetEnder.cs +240 -0
- package/DialogueAssetEnder.cs.meta +11 -0
- package/DialogueAssetFinisher.cs +90 -0
- package/DialogueAssetFinisher.cs.meta +11 -0
- package/DialogueAssetFinisherBase.cs +83 -0
- package/DialogueAssetFinisherBase.cs.meta +11 -0
- package/DialogueAssetManager.cs +66 -0
- package/DialogueAssetManager.cs.meta +11 -0
- package/DialogueAssetReader.cs +378 -0
- package/DialogueAssetReader.cs.meta +11 -0
- package/DialogueAssetStarter.cs +255 -0
- package/DialogueAssetStarter.cs.meta +11 -0
- package/DialogueAssetStarterDebugger.cs +41 -0
- package/DialogueAssetStarterDebugger.cs.meta +11 -0
- package/DialogueAssetWaiter.cs +94 -0
- package/DialogueAssetWaiter.cs.meta +11 -0
- package/DialogueLineReader.cs +392 -0
- package/DialogueLineReader.cs.meta +11 -0
- package/DialogueManager.cs +84 -0
- package/DialogueManager.cs.meta +11 -0
- package/DialogueNameSaver.cs +46 -0
- package/DialogueNameSaver.cs.meta +11 -0
- package/FastForwardToLine.cs +103 -0
- package/FastForwardToLine.cs.meta +11 -0
- package/InstantDialogueEnder.cs +92 -0
- package/InstantDialogueEnder.cs.meta +11 -0
- package/InstantDialogueFinisher.cs +133 -0
- package/InstantDialogueFinisher.cs.meta +11 -0
- package/InstantDialogueStarter.cs +83 -0
- package/InstantDialogueStarter.cs.meta +11 -0
- package/NotLeavingOnDialogueFinish.cs +45 -0
- package/NotLeavingOnDialogueFinish.cs.meta +11 -0
- package/PreparableDialogueStarter.cs +89 -0
- package/PreparableDialogueStarter.cs.meta +11 -0
- package/Samples~/Dialogue_Asset_End_Event_Handler.prefab +685 -0
- package/Samples~/Dialogue_Asset_End_Event_Handler.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Ender.prefab +858 -0
- package/Samples~/Dialogue_Asset_Ender.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Finisher.prefab +301 -0
- package/Samples~/Dialogue_Asset_Finisher.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Load_Identifier.prefab +48 -0
- package/Samples~/Dialogue_Asset_Load_Identifier.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Loader.prefab +231 -0
- package/Samples~/Dialogue_Asset_Loader.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Reader_DRE.prefab +511 -0
- package/Samples~/Dialogue_Asset_Reader_DRE.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Reader_Shell.prefab +252 -0
- package/Samples~/Dialogue_Asset_Reader_Shell.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Reader_Template.prefab +193 -0
- package/Samples~/Dialogue_Asset_Reader_Template.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Starter.prefab +613 -0
- package/Samples~/Dialogue_Asset_Starter.prefab.meta +7 -0
- package/Samples~/Dialogue_Asset_Waiter.prefab +50 -0
- package/Samples~/Dialogue_Asset_Waiter.prefab.meta +7 -0
- package/Samples~/Dialogue_Events_Shell.prefab +458 -0
- package/Samples~/Dialogue_Events_Shell.prefab.meta +7 -0
- package/Samples~/Dialogue_Events_Template.prefab +302 -0
- package/Samples~/Dialogue_Events_Template.prefab.meta +7 -0
- package/Samples~/Dialogue_Line_Loader.prefab +1282 -0
- package/Samples~/Dialogue_Line_Loader.prefab.meta +7 -0
- package/Samples~/Dialogue_Line_Reader.prefab +3688 -0
- package/Samples~/Dialogue_Line_Reader.prefab.meta +7 -0
- package/Samples~/Dialogue_Name_Saver.prefab +48 -0
- package/Samples~/Dialogue_Name_Saver.prefab.meta +7 -0
- package/Samples~/Dialogue_System_Shell.prefab +325 -0
- package/Samples~/Dialogue_System_Shell.prefab.meta +7 -0
- package/Samples~/Dialogue_System_Template.prefab +1138 -0
- package/Samples~/Dialogue_System_Template.prefab.meta +7 -0
- package/Samples~/Fast_Forward_To_Line_Tool.prefab +53 -0
- package/Samples~/Fast_Forward_To_Line_Tool.prefab.meta +7 -0
- package/Samples~/Instant_Dialogue_Ender.prefab +141 -0
- package/Samples~/Instant_Dialogue_Ender.prefab.meta +7 -0
- package/Samples~/Instant_Dialogue_Finisher.prefab +172 -0
- package/Samples~/Instant_Dialogue_Finisher.prefab.meta +7 -0
- package/Samples~/Instant_Dialogue_Starter.prefab +55 -0
- package/Samples~/Instant_Dialogue_Starter.prefab.meta +7 -0
- package/Samples~/On_Loading_Through_Scene_Transition.prefab +48 -0
- package/Samples~/On_Loading_Through_Scene_Transition.prefab.meta +7 -0
- package/Samples~/Scene_Event_On_Text_Display.prefab +47 -0
- package/Samples~/Scene_Event_On_Text_Display.prefab.meta +7 -0
- package/Samples~/Trial_Dialogue_Asset_Reader.prefab +561 -0
- package/Samples~/Trial_Dialogue_Asset_Reader.prefab.meta +7 -0
- package/Samples~/Trial_Dialogue_Asset_Starter.prefab +239 -0
- package/Samples~/Trial_Dialogue_Asset_Starter.prefab.meta +7 -0
- package/Samples~/Trial_Dialogue_Line_Loader.prefab +941 -0
- package/Samples~/Trial_Dialogue_Line_Loader.prefab.meta +7 -0
- package/Samples~/Trial_Dialogue_Loader.prefab +232 -0
- package/Samples~/Trial_Dialogue_Loader.prefab.meta +7 -0
- package/Samples~/Tween_Waiter_Handler.prefab +46 -0
- package/Samples~/Tween_Waiter_Handler.prefab.meta +7 -0
- package/package.json +37 -4
- package/package.json.meta +7 -0
- package/README.md +0 -3
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues.Starting;
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using System.Collections;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Dialogues.Implementation
|
|
7
|
+
{
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class DialogueAssetWaiter : DialogueWaiter
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Header("")]
|
|
19
|
+
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected BoolWithEvent hasStartedDialogue = null;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected BoolWithEvent inDialogue = null;
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected BoolWithEvent isWaitingForDialogueToFinish = null;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
/// <param name="dialogue"></param>
|
|
40
|
+
/// <returns></returns>
|
|
41
|
+
public override IEnumerator CheckIfInDialogueToPlay(DialogueCore dialogue)
|
|
42
|
+
{
|
|
43
|
+
if (hasStartedDialogue.Value)
|
|
44
|
+
yield return WaitToPlayDialogue(dialogue.name);
|
|
45
|
+
else
|
|
46
|
+
hasStartedDialogue.SetValue(true);
|
|
47
|
+
|
|
48
|
+
yield break;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
///
|
|
53
|
+
/// </summary>
|
|
54
|
+
/// <param name="name"></param>
|
|
55
|
+
/// <returns></returns>
|
|
56
|
+
protected virtual IEnumerator WaitToPlayDialogue(string name)
|
|
57
|
+
{
|
|
58
|
+
Debug.LogWarning($"{ToString()}: ALERT: Dialogue: " + name + " has attempted to start while still inside of dialogue. In " +
|
|
59
|
+
"order to not flip off the InDialogue Value, the game will wait for the current dialogue to finish.");
|
|
60
|
+
|
|
61
|
+
SetToWaiting();
|
|
62
|
+
|
|
63
|
+
while (IsWaiting())
|
|
64
|
+
{
|
|
65
|
+
if (!inDialogue.Value)
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
yield return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
SetToNoLongerWaiting();
|
|
72
|
+
|
|
73
|
+
Debug.Log($"{ToString()}: REPORT: The dialogue: " + name + " has finished waiting and will now play.");
|
|
74
|
+
|
|
75
|
+
yield break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// <summary>
|
|
79
|
+
///
|
|
80
|
+
/// </summary>
|
|
81
|
+
protected virtual void SetToWaiting() => isWaitingForDialogueToFinish.SetValue(true);
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
///
|
|
85
|
+
/// </summary>
|
|
86
|
+
/// <returns></returns>
|
|
87
|
+
protected virtual bool IsWaiting() => isWaitingForDialogueToFinish.Value;
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
protected virtual void SetToNoLongerWaiting() => isWaitingForDialogueToFinish.SetValue(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
392
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues.Ending;
|
|
3
|
+
using DREditor.Dialogues.Finishing;
|
|
4
|
+
using DREditor.Dialogues.Starting;
|
|
5
|
+
using DREditor.EventObjects;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Dialogues.Implementation
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[DefaultExecutionOrder(-1)]
|
|
14
|
+
public abstract class DialogueManager : MonoBehaviour, IDialogueManager
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Header("")]
|
|
20
|
+
[Divider]
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected DialogueStarterDebugger DialogueStarterDebugger = null;
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
///
|
|
26
|
+
/// </summary>
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected DialogueStarter DialogueStarter = null;
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
[Tooltip("")]
|
|
34
|
+
[SerializeField] protected DialogueReader DialogueReader = null;
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
[Tooltip("")]
|
|
40
|
+
[SerializeField] protected DialogueEnder DialogueEnder = null;
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
[Tooltip("")]
|
|
46
|
+
[SerializeField] protected DialogueFinisher DialogueFinisher = null;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/// <inheritdoc/>
|
|
50
|
+
public virtual void DebugNoCharacterDialogueCall(SelectableObject actor, DialogueCore DebugNoDialogue = null)
|
|
51
|
+
=> DialogueStarterDebugger.DebugNoCharacterDialogueCall(actor, DebugNoDialogue);
|
|
52
|
+
|
|
53
|
+
/// <inheritdoc/>
|
|
54
|
+
public virtual void StartDialogue<T>(SelectableObject actor, DialogueBase<T>[] dialogues, bool inleaving = false) where T : Line
|
|
55
|
+
=> DialogueStarter.StartDialogue(actor, dialogues, inleaving);
|
|
56
|
+
|
|
57
|
+
/// <inheritdoc/>
|
|
58
|
+
public virtual void StartDialogue<T>(SelectableObject actor, DialogueBase<T> dialogue, bool inleaving = false) where T : Line
|
|
59
|
+
=> DialogueStarter.StartDialogue(actor, dialogue, inleaving);
|
|
60
|
+
|
|
61
|
+
/// <inheritdoc/>
|
|
62
|
+
public virtual GameObject GetManagerObject() => gameObject;
|
|
63
|
+
|
|
64
|
+
/// <inheritdoc/>
|
|
65
|
+
public virtual DialogueReader GetReader() => DialogueReader;
|
|
66
|
+
|
|
67
|
+
/// <inheritdoc/>
|
|
68
|
+
public virtual IDialogueEnder GetEnder() => DialogueEnder;
|
|
69
|
+
|
|
70
|
+
/// <inheritdoc/>
|
|
71
|
+
public virtual IDialogueFinisher GetFinisher() => DialogueFinisher;
|
|
72
|
+
|
|
73
|
+
/// <inheritdoc/>
|
|
74
|
+
public virtual T GetManagerComponent<T>() where T : MonoBehaviour => GetComponentInChildren<T>();
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/// <inheritdoc/>
|
|
78
|
+
public virtual void Invoke<T>(DialogueCore dialogue) where T : Line
|
|
79
|
+
{
|
|
80
|
+
if (dialogue is DialogueBase<T> dia)
|
|
81
|
+
StartDialogue(null, dia);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.Saving;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using System;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using System.Linq;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.Dialogues.Implementation
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(IClearDialogueSaveData) + ", " + nameof(IDRESaveable) +
|
|
16
|
+
"\n\n")]
|
|
17
|
+
public class DialogueNameSaver : DialogueComponent, IClearDialogueSaveData, IDRESaveable
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Header("")]
|
|
23
|
+
[Divider]
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected string saveDialogueNameKey = "DialogueName";
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Tooltip("")]
|
|
31
|
+
[SerializeField] protected StringWithEvent saveDialogueName = null;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/// <inheritdoc/>
|
|
35
|
+
public virtual void ClearSaveData() => saveDialogueName.SetValue("");
|
|
36
|
+
|
|
37
|
+
/// <inheritdoc/>
|
|
38
|
+
public virtual void Save(Dictionary<string, object> saveData)
|
|
39
|
+
{
|
|
40
|
+
if (!ServiceLocator.GetService<IDialogueManager>().GetComponentsInChildren<DialogueComponent>().Contains(this))
|
|
41
|
+
return;
|
|
42
|
+
|
|
43
|
+
saveData.Set(saveDialogueNameKey, saveDialogueName.Value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|