net.dreditor.dialogues.implementation 0.0.0-stage → 0.1.6

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.
Files changed (100) hide show
  1. package/DREditor.Dialogues.Implementation.asmdef +16 -0
  2. package/DREditor.Dialogues.Implementation.asmdef.meta +7 -0
  3. package/DialogueAssetDataClearer.cs +50 -0
  4. package/DialogueAssetDataClearer.cs.meta +11 -0
  5. package/DialogueAssetEndEventHandler.cs +58 -0
  6. package/DialogueAssetEndEventHandler.cs.meta +11 -0
  7. package/DialogueAssetEnder.cs +240 -0
  8. package/DialogueAssetEnder.cs.meta +11 -0
  9. package/DialogueAssetFinisher.cs +90 -0
  10. package/DialogueAssetFinisher.cs.meta +11 -0
  11. package/DialogueAssetFinisherBase.cs +83 -0
  12. package/DialogueAssetFinisherBase.cs.meta +11 -0
  13. package/DialogueAssetManager.cs +66 -0
  14. package/DialogueAssetManager.cs.meta +11 -0
  15. package/DialogueAssetReader.cs +378 -0
  16. package/DialogueAssetReader.cs.meta +11 -0
  17. package/DialogueAssetStarter.cs +255 -0
  18. package/DialogueAssetStarter.cs.meta +11 -0
  19. package/DialogueAssetStarterDebugger.cs +41 -0
  20. package/DialogueAssetStarterDebugger.cs.meta +11 -0
  21. package/DialogueAssetWaiter.cs +94 -0
  22. package/DialogueAssetWaiter.cs.meta +11 -0
  23. package/DialogueLineReader.cs +392 -0
  24. package/DialogueLineReader.cs.meta +11 -0
  25. package/DialogueManager.cs +84 -0
  26. package/DialogueManager.cs.meta +11 -0
  27. package/DialogueNameSaver.cs +46 -0
  28. package/DialogueNameSaver.cs.meta +11 -0
  29. package/FastForwardToLine.cs +103 -0
  30. package/FastForwardToLine.cs.meta +11 -0
  31. package/InstantDialogueEnder.cs +92 -0
  32. package/InstantDialogueEnder.cs.meta +11 -0
  33. package/InstantDialogueFinisher.cs +133 -0
  34. package/InstantDialogueFinisher.cs.meta +11 -0
  35. package/InstantDialogueStarter.cs +83 -0
  36. package/InstantDialogueStarter.cs.meta +11 -0
  37. package/NotLeavingOnDialogueFinish.cs +45 -0
  38. package/NotLeavingOnDialogueFinish.cs.meta +11 -0
  39. package/PreparableDialogueStarter.cs +89 -0
  40. package/PreparableDialogueStarter.cs.meta +11 -0
  41. package/Samples/Dialogue_Asset_End_Event_Handler.prefab +685 -0
  42. package/Samples/Dialogue_Asset_End_Event_Handler.prefab.meta +7 -0
  43. package/Samples/Dialogue_Asset_Ender.prefab +858 -0
  44. package/Samples/Dialogue_Asset_Ender.prefab.meta +7 -0
  45. package/Samples/Dialogue_Asset_Finisher.prefab +301 -0
  46. package/Samples/Dialogue_Asset_Finisher.prefab.meta +7 -0
  47. package/Samples/Dialogue_Asset_Load_Identifier.prefab +48 -0
  48. package/Samples/Dialogue_Asset_Load_Identifier.prefab.meta +7 -0
  49. package/Samples/Dialogue_Asset_Loader.prefab +231 -0
  50. package/Samples/Dialogue_Asset_Loader.prefab.meta +7 -0
  51. package/Samples/Dialogue_Asset_Reader_DRE.prefab +511 -0
  52. package/Samples/Dialogue_Asset_Reader_DRE.prefab.meta +7 -0
  53. package/Samples/Dialogue_Asset_Reader_Shell.prefab +252 -0
  54. package/Samples/Dialogue_Asset_Reader_Shell.prefab.meta +7 -0
  55. package/Samples/Dialogue_Asset_Reader_Template.prefab +193 -0
  56. package/Samples/Dialogue_Asset_Reader_Template.prefab.meta +7 -0
  57. package/Samples/Dialogue_Asset_Starter.prefab +613 -0
  58. package/Samples/Dialogue_Asset_Starter.prefab.meta +7 -0
  59. package/Samples/Dialogue_Asset_Waiter.prefab +50 -0
  60. package/Samples/Dialogue_Asset_Waiter.prefab.meta +7 -0
  61. package/Samples/Dialogue_Events_Shell.prefab +458 -0
  62. package/Samples/Dialogue_Events_Shell.prefab.meta +7 -0
  63. package/Samples/Dialogue_Events_Template.prefab +302 -0
  64. package/Samples/Dialogue_Events_Template.prefab.meta +7 -0
  65. package/Samples/Dialogue_Line_Loader.prefab +1282 -0
  66. package/Samples/Dialogue_Line_Loader.prefab.meta +7 -0
  67. package/Samples/Dialogue_Line_Reader.prefab +3688 -0
  68. package/Samples/Dialogue_Line_Reader.prefab.meta +7 -0
  69. package/Samples/Dialogue_Name_Saver.prefab +48 -0
  70. package/Samples/Dialogue_Name_Saver.prefab.meta +7 -0
  71. package/Samples/Dialogue_System_Shell.prefab +325 -0
  72. package/Samples/Dialogue_System_Shell.prefab.meta +7 -0
  73. package/Samples/Dialogue_System_Template.prefab +1138 -0
  74. package/Samples/Dialogue_System_Template.prefab.meta +7 -0
  75. package/Samples/Fast_Forward_To_Line_Tool.prefab +53 -0
  76. package/Samples/Fast_Forward_To_Line_Tool.prefab.meta +7 -0
  77. package/Samples/Instant_Dialogue_Ender.prefab +141 -0
  78. package/Samples/Instant_Dialogue_Ender.prefab.meta +7 -0
  79. package/Samples/Instant_Dialogue_Finisher.prefab +172 -0
  80. package/Samples/Instant_Dialogue_Finisher.prefab.meta +7 -0
  81. package/Samples/Instant_Dialogue_Starter.prefab +55 -0
  82. package/Samples/Instant_Dialogue_Starter.prefab.meta +7 -0
  83. package/Samples/On_Loading_Through_Scene_Transition.prefab +48 -0
  84. package/Samples/On_Loading_Through_Scene_Transition.prefab.meta +7 -0
  85. package/Samples/Scene_Event_On_Text_Display.prefab +47 -0
  86. package/Samples/Scene_Event_On_Text_Display.prefab.meta +7 -0
  87. package/Samples/Trial_Dialogue_Asset_Reader.prefab +561 -0
  88. package/Samples/Trial_Dialogue_Asset_Reader.prefab.meta +7 -0
  89. package/Samples/Trial_Dialogue_Asset_Starter.prefab +239 -0
  90. package/Samples/Trial_Dialogue_Asset_Starter.prefab.meta +7 -0
  91. package/Samples/Trial_Dialogue_Line_Loader.prefab +941 -0
  92. package/Samples/Trial_Dialogue_Line_Loader.prefab.meta +7 -0
  93. package/Samples/Trial_Dialogue_Loader.prefab +232 -0
  94. package/Samples/Trial_Dialogue_Loader.prefab.meta +7 -0
  95. package/Samples/Tween_Waiter_Handler.prefab +46 -0
  96. package/Samples/Tween_Waiter_Handler.prefab.meta +7 -0
  97. package/Samples.meta +8 -0
  98. package/package.json +34 -6
  99. package/package.json.meta +7 -0
  100. package/README.md +0 -3
@@ -0,0 +1,103 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using DREditor.Services;
4
+ using System.Collections;
5
+ using UnityEngine;
6
+
7
+ namespace DREditor.Dialogues.Implementation
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ [ClassHeader(nameof(ServiceHolder<FastForwardToLine>) + " for type: " + nameof(FastForwardToLine) +
13
+ "\n\n")]
14
+ public class FastForwardToLine : ServiceHolder<FastForwardToLine>
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ [Header("")]
20
+ [Tooltip("")]
21
+ [SerializeField] protected BoolWithEvent inDialogue;
22
+
23
+ /// <summary>
24
+ ///
25
+ /// </summary>
26
+ [Tooltip("")]
27
+ [SerializeField] protected BoolWithEvent inFastForwardMode;
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ [Tooltip("")]
33
+ [SerializeField] protected BoolWithEvent inInstant;
34
+
35
+
36
+ /// <summary>
37
+ ///
38
+ /// </summary>
39
+ [Header("")]
40
+ [Tooltip("")]
41
+ [SerializeField] protected int toLine = 0;
42
+
43
+ /// <summary>
44
+ ///
45
+ /// </summary>
46
+ [Tooltip("")]
47
+ [SerializeField] protected Dialogue dialogue;
48
+
49
+
50
+ /// <summary>
51
+ ///
52
+ /// </summary>
53
+ protected IDialogueManager dialogueManager;
54
+
55
+
56
+ protected virtual void OnEnable() => inDialogue.AddListener(OnDialogueStart);
57
+
58
+ protected virtual void OnDisable() => inDialogue.RemoveListener(OnDialogueStart);
59
+
60
+ protected virtual void Start() => dialogueManager = ServiceLocator.GetService<IDialogueManager>();
61
+
62
+ /// <summary>
63
+ ///
64
+ /// </summary>
65
+ /// <param name="inDialogue"></param>
66
+ protected virtual void OnDialogueStart(bool inDialogue)
67
+ {
68
+ if (inDialogue && !inInstant.Value)
69
+ {
70
+ inFastForwardMode.SetValue(true);
71
+
72
+ StartCoroutine(WaitTillLine());
73
+ }
74
+ }
75
+
76
+ /// <summary>
77
+ ///
78
+ /// </summary>
79
+ protected virtual IEnumerator WaitTillLine()
80
+ {
81
+ yield return new WaitUntil(() => !inDialogue.Value || (AtTargetDialogue() && AtTargetLine()));
82
+
83
+ inFastForwardMode.SetValue(false);
84
+
85
+ if (AtTargetDialogue() && AtTargetLine())
86
+ enabled = false;
87
+
88
+ yield break;
89
+ }
90
+
91
+ /// <summary>
92
+ ///
93
+ /// </summary>
94
+ /// <returns></returns>
95
+ protected virtual bool AtTargetDialogue() => dialogueManager.GetReader().GetCurrentDialogue() == dialogue;
96
+
97
+ /// <summary>
98
+ ///
99
+ /// </summary>
100
+ /// <returns></returns>
101
+ protected virtual bool AtTargetLine() => dialogueManager.GetReader().GetCurrentLineNum() == toLine;
102
+ }
103
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 778429825eb557b42bcc89d7d36ca670
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,92 @@
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 System.Collections;
5
+ using System.Collections.Generic;
6
+ using UnityEngine;
7
+ using UnityEngine.Serialization;
8
+
9
+ namespace DREditor.Dialogues.Implementation
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ [ClassHeader(nameof(DialogueEnder) + ", " +
15
+ "\n\n")]
16
+ public class InstantDialogueEnder : DialogueEnder
17
+ {
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ [SerializeField] DialogueFinisher InstantDialogueFinisher = null;
23
+
24
+ /// <summary>
25
+ ///
26
+ /// </summary>
27
+ [Tooltip("")]
28
+ [SerializeField] protected int collectionID = 1;
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ [Tooltip("")]
34
+ [SerializeField] protected string orderFieldName = "resolveOrder";
35
+
36
+ /// <summary>
37
+ ///
38
+ /// </summary>
39
+ [Tooltip("")]
40
+ [SerializeField] protected DialogueComponentCollection<IResolvableDialogueComponent> resolvableCollection = new();
41
+
42
+ /// <summary>
43
+ ///
44
+ /// </summary>
45
+ [FormerlySerializedAs("ResolvableComponents")]
46
+ [Tooltip("")]
47
+ [SerializeField] protected List<DialogueComponent> overrideComponents = new();
48
+
49
+
50
+ protected virtual void Awake() => resolvableCollection.Initialize(transform, orderFieldName, collectionID);
51
+
52
+ protected virtual void OnValidate() => resolvableCollection.Initialize(transform, orderFieldName, collectionID);
53
+
54
+
55
+ /// <inheritdoc/>
56
+ public override void StopDialogue() => StartCoroutine(EndDialogue());
57
+
58
+ /// <inheritdoc/>
59
+ public override IEnumerator EndDialogue(bool finishDialogue = true)
60
+ {
61
+ UnityEngine.Debug.Log($"REPORT: {ToString()}: Instant dialogue has started to resolve.");
62
+
63
+ yield return ResolveDialogueComponents();
64
+
65
+ yield return InstantDialogueFinisher.FinishDialogueRoutine(finishDialogue);
66
+
67
+ UnityEngine.Debug.Log($"REPORT: {ToString()}: Instant dialogue has resolved.");
68
+
69
+ yield break;
70
+ }
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ protected virtual IEnumerator ResolveDialogueComponents()
76
+ {
77
+ IEnumerable componentList = overrideComponents.Count > 0 ? overrideComponents : resolvableCollection.components;
78
+
79
+ foreach (var component in componentList)
80
+ if (component != null && component is IResolvableDialogueComponent resolvable)
81
+ if (resolvable.UseRoutineToResolve())
82
+ yield return resolvable.ResolveRoutine();
83
+ else
84
+ resolvable.Resolve();
85
+
86
+ yield break;
87
+ }
88
+
89
+ /// <inheritdoc/>
90
+ public override void FinishDialogue() => InstantDialogueFinisher.FinishDialogue();
91
+ }
92
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c1665a4e3e9abcc4b83a6548fd0f27a6
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,133 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues.Finishing;
3
+ using DREditor.EventObjects;
4
+ using System.Collections;
5
+ using System.Collections.Generic;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.Dialogues.Implementation
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader(nameof(DialogueAssetFinisherBase) + ", " + nameof(DialogueFinisher) + ", " +
14
+ nameof(IEndDialogueEvent) + ", " + nameof(IDialogueFinisher) +
15
+ "\n\n")]
16
+ public class InstantDialogueFinisher : DialogueAssetFinisherBase
17
+ {
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ [SerializeField] BoolWithEvent inInstant = null;
23
+
24
+ /// <summary>
25
+ ///
26
+ /// </summary>
27
+ [Tooltip("")]
28
+ [SerializeField] BoolWithEvent isGoingToMainMenu = null;
29
+
30
+
31
+ /// <summary>
32
+ ///
33
+ /// </summary>
34
+ [Header("")]
35
+ [Divider]
36
+ [Tooltip("")]
37
+ [SerializeField] protected int collectionID = 2;
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ [Tooltip("")]
43
+ [SerializeField] protected string orderFieldName = "finishOrder";
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ [Tooltip("")]
49
+ [SerializeField] protected DialogueComponentCollection<IFinishableDialogueComponent> finishableCollection = new();
50
+
51
+ /// <summary>
52
+ ///
53
+ /// </summary>
54
+ [Tooltip("")]
55
+ [SerializeField] protected List<DialogueComponent> overrideComponents = new();
56
+
57
+
58
+ protected virtual void Awake() => finishableCollection.Initialize(transform, orderFieldName, collectionID);
59
+
60
+ protected virtual void OnValidate() => finishableCollection.Initialize(transform, orderFieldName, collectionID);
61
+
62
+
63
+ /// <inheritdoc/>
64
+ public override void FinishDialogue() => StartCoroutine(FinishDialogueRoutine());
65
+
66
+ /// <inheritdoc/>
67
+ public override IEnumerator FinishDialogueRoutine(bool finishDialogue = true)
68
+ {
69
+ yield return FinishDialogueComponents();
70
+
71
+ SetInstantValueFalse();
72
+
73
+ CallOnDialogueEnd(); // NOTE: It is unknown why this is called twice but in the past caused issues when removed.
74
+
75
+ SetNoLongerInDialogueValues();
76
+
77
+ if (finishDialogue)
78
+ MoveToOriginalGameplayState();
79
+
80
+ UnityEngine.Debug.Log($"REPORT: {ToString()}: Instant dialogue has finished.");
81
+ }
82
+
83
+ /// <summary>
84
+ ///
85
+ /// </summary>
86
+ protected virtual void SetInstantValueFalse() => inInstant.Value = false;
87
+
88
+ /// <summary>
89
+ ///
90
+ /// </summary>
91
+ protected virtual void MoveToOriginalGameplayState()
92
+ {
93
+ if (!isGoingToMainMenu.Value)
94
+ EnableMenuAccessIfNotInTrial();
95
+
96
+ CallOnDialogueEnd();
97
+
98
+ SetControlsBasedOnCurrentMode();
99
+
100
+ CallOnFinishedDialogue();
101
+ }
102
+
103
+ /// <summary>
104
+ ///
105
+ /// </summary>
106
+ protected virtual IEnumerator FinishDialogueComponents()
107
+ {
108
+ IEnumerable componentList = overrideComponents.Count > 0 ? overrideComponents : finishableCollection.components;
109
+
110
+ foreach (DialogueComponent component in componentList)
111
+ if (component != null && component is IComplexFinishableDialogueComponent finishable)
112
+ if (finishable.UseCoroutine())
113
+ yield return finishable.OnFinishDialogueRoutine();
114
+ else
115
+ finishable.OnFinishDialogue();
116
+ else
117
+ yield return EvaluateFinishingDialogueComponent(component);
118
+ }
119
+
120
+ /// <summary>
121
+ ///
122
+ /// </summary>
123
+ /// <param name="component"></param>
124
+ /// <returns></returns>
125
+ protected virtual IEnumerator EvaluateFinishingDialogueComponent(DialogueComponent component)
126
+ {
127
+ if (component != null && component is IFinishableDialogueComponent finishable)
128
+ finishable.OnFinishDialogue();
129
+ else if (component != null && component is IFinishableDialogueComponentRoutine finishableRoutine)
130
+ yield return finishableRoutine.OnFinishDialogueRoutine();
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 7d5f35d61725333409320817a5c6dac8
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,83 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using DREditor.Services;
4
+ using System.Collections;
5
+ using UnityEngine;
6
+
7
+ namespace DREditor.Dialogues.Implementation
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ [ClassHeader(nameof(PreparableDialogueStarter) +
13
+ "\n\n")]
14
+ public class InstantDialogueStarter : PreparableDialogueStarter
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ [Header("")]
20
+ [Divider]
21
+ [Tooltip("")]
22
+ [SerializeField] protected BoolWithEvent hasStartedDialogue = null;
23
+
24
+ /// <summary>
25
+ ///
26
+ /// </summary>
27
+ [Tooltip("")]
28
+ [SerializeField] protected BoolWithEvent inDialogue = null;
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ [Tooltip("")]
34
+ [SerializeField] protected BoolWithEvent inInstant = null;
35
+
36
+
37
+ /// <inheritdoc/>
38
+ public override void StartDialogue<T>(SelectableObject actor, DialogueBase<T>[] dialogues, bool inleaving = false)
39
+ => StartCoroutine(InstantDialogue(dialogues, inleaving));
40
+
41
+ public override void StartDialogue<T>(SelectableObject actor, DialogueBase<T> dialogue, bool inleaving = false)
42
+ => StartCoroutine(InstantDialogue(new DialogueBase<T>[1] { dialogue }, inleaving));
43
+
44
+ /// <summary>
45
+ ///
46
+ /// </summary>
47
+ /// <param name="dialogues"></param>
48
+ /// <param name="inleaving"></param>
49
+ protected virtual IEnumerator InstantDialogue<T2>(DialogueBase<T2>[] dialogues, bool inleaving = false)
50
+ where T2 : Line
51
+ {
52
+ SetValueWithEvents();
53
+
54
+ InvokeDialoguePreparationEvent();
55
+
56
+ UnityEngine.Debug.Log($"REPORT: {nameof(InstantDialogueStarter)}: " +
57
+ $"Starting to Prepare Dialogue.");
58
+
59
+ yield return PrepareDialogueComponents();
60
+
61
+ UnityEngine.Debug.Log($"REPORT: {nameof(InstantDialogueStarter)}: " +
62
+ $"Finished preparing dialogue.");
63
+
64
+ ServiceLocator.GetService<IDialogueManager>()
65
+ .GetReader()
66
+ .PlayDialogues(dialogues, inleaving);
67
+
68
+ yield break;
69
+ }
70
+
71
+ /// <summary>
72
+ ///
73
+ /// </summary>
74
+ protected virtual void SetValueWithEvents()
75
+ {
76
+ inDialogue.SetValue(true);
77
+
78
+ hasStartedDialogue.SetValue(true);
79
+
80
+ inInstant.SetValue(true);
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0afb0b52013ef2d4c937f73ef19183d2
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,45 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues.Finishing;
3
+ using DREditor.EventObjects;
4
+ using DREditor.Services;
5
+ using UnityEngine;
6
+
7
+ namespace DREditor.Dialogues.Implementation
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ public class NotLeavingOnDialogueFinish : MonoBehaviour, IToTitleScreen
13
+ {
14
+ /// <summary>
15
+ ///
16
+ /// </summary>
17
+ [Tooltip("")]
18
+ [SerializeField] protected DialogueFinisher DialogueFinisher = null;
19
+
20
+ /// <summary>
21
+ ///
22
+ /// </summary>
23
+ [Tooltip("")]
24
+ [SerializeField] protected BoolWithEvent isLeaving = null;
25
+
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ protected virtual void OnEnable() => DialogueFinisher.SubscribeToOnFinishOfDialogue(TurnInLeavingModeOff);
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ protected virtual void OnDisable() => DialogueFinisher.UnsubscribeToOnFinishOfDialogue(TurnInLeavingModeOff);
36
+
37
+ /// <summary>
38
+ ///
39
+ /// </summary>
40
+ protected virtual void TurnInLeavingModeOff() => isLeaving.SetValue(false);
41
+
42
+ /// <inheritdoc/>
43
+ public virtual void ToTitleScreen() => TurnInLeavingModeOff();
44
+ }
45
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a3bf78a4fe2a19b4892f40f10d58aa77
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,89 @@
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;
5
+ using System.Collections;
6
+ using System.Collections.Generic;
7
+ using UnityEngine;
8
+ using UnityEngine.Serialization;
9
+
10
+ namespace DREditor.Dialogues.Implementation
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ public abstract class PreparableDialogueStarter : DialogueStarter, IDialoguePrepareEvent
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ [Header("")]
21
+ [Divider]
22
+ [Tooltip("")]
23
+ [SerializeField] protected SceneEvent dialogueStarted = null;
24
+
25
+
26
+ /// <summary>
27
+ ///
28
+ /// </summary>
29
+ [Header("")]
30
+ [Divider]
31
+ [Tooltip("")]
32
+ [SerializeField] protected int collectionID = 1;
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ [SerializeField] protected string orderFieldName = "prepareOrder";
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ [Tooltip("")]
44
+ [SerializeField] protected DialogueComponentCollection<IPreparableDialogueComponent> preparableCollection = new();
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ [FormerlySerializedAs("PreparableComponents")]
50
+ [Tooltip("")]
51
+ [SerializeField] protected List<DialogueComponent> overrideComponents = new();
52
+
53
+
54
+ public event Action OnDialoguePrepare;
55
+
56
+
57
+ protected virtual void Awake() => preparableCollection.Initialize(transform, orderFieldName, collectionID);
58
+
59
+ protected virtual void OnValidate() => preparableCollection.Initialize(transform, orderFieldName, collectionID);
60
+
61
+ /// <summary>
62
+ ///
63
+ /// </summary>
64
+ protected virtual void InvokeDialoguePreparationEvent()
65
+ {
66
+ OnDialoguePrepare?.Invoke();
67
+
68
+ if (dialogueStarted != null)
69
+ dialogueStarted.Raise();
70
+ }
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ protected virtual IEnumerator PrepareDialogueComponents()
76
+ {
77
+ IEnumerable componentList = overrideComponents.Count > 0 ? overrideComponents : preparableCollection.components;
78
+
79
+ foreach (var component in componentList)
80
+ if (component != null && component is IPreparableDialogueComponent preparable)
81
+ if (preparable.UseRoutineToPrepare())
82
+ yield return preparable.PrepareRoutine();
83
+ else
84
+ preparable.Prepare();
85
+
86
+ yield break;
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 317719720be34934ca3c709bb67a03a5
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: