net.dreditor.choices 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/ChoiceManager.cs +316 -316
- package/ChoiceManager.cs.meta +11 -11
- package/ChoiceOptionUI.cs +51 -51
- package/ChoiceOptionUI.cs.meta +11 -11
- package/ChoiceSaveHandler.cs +79 -79
- package/ChoiceSaveHandler.cs.meta +11 -11
- package/DREditor.Choices.asmdef +20 -20
- package/DREditor.Choices.asmdef.meta +7 -7
- package/DialogueChoiceHandler.cs +59 -59
- package/DialogueChoiceHandler.cs.meta +11 -11
- package/IChoiceManager.cs +43 -43
- package/IChoiceManager.cs.meta +11 -11
- package/{Samples → Samples~}/Choice_Save_Handler.prefab +72 -72
- package/{Samples → Samples~}/Choice_Save_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/Dialogue_Choice_Handler.prefab +49 -49
- package/{Samples → Samples~}/Dialogue_Choice_Handler.prefab.meta +7 -7
- package/package.json +43 -38
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/ChoiceOptionUI.cs
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using System;
|
|
3
|
-
using TMPro;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.Choices
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
[ClassHeader("")]
|
|
12
|
-
public class ChoiceOptionUI : MonoBehaviour
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[Tooltip("")]
|
|
18
|
-
[SerializeField] protected TextMeshProUGUI choiceText = null;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
protected event Action OnChoiceSelected;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
public virtual void InvokeChoice() => OnChoiceSelected?.Invoke();
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
public virtual void SubscribeChoice(Action action) => OnChoiceSelected += action;
|
|
36
|
-
|
|
37
|
-
/// <summary>
|
|
38
|
-
///
|
|
39
|
-
/// </summary>
|
|
40
|
-
public virtual void UnsubscribeChoice(Action action) => OnChoiceSelected -= action;
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
public virtual void SetText(string text) => choiceText.text = text;
|
|
46
|
-
|
|
47
|
-
/// <summary>
|
|
48
|
-
///
|
|
49
|
-
/// </summary>
|
|
50
|
-
public virtual void Clear() => choiceText.text = "";
|
|
51
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using System;
|
|
3
|
+
using TMPro;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Choices
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader("")]
|
|
12
|
+
public class ChoiceOptionUI : MonoBehaviour
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected TextMeshProUGUI choiceText = null;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
protected event Action OnChoiceSelected;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
public virtual void InvokeChoice() => OnChoiceSelected?.Invoke();
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
public virtual void SubscribeChoice(Action action) => OnChoiceSelected += action;
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
///
|
|
39
|
+
/// </summary>
|
|
40
|
+
public virtual void UnsubscribeChoice(Action action) => OnChoiceSelected -= action;
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
public virtual void SetText(string text) => choiceText.text = text;
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
public virtual void Clear() => choiceText.text = "";
|
|
51
|
+
}
|
|
52
52
|
}
|
package/ChoiceOptionUI.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: b2749d37719649e4e9d6f68fcc81f71d
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: b2749d37719649e4e9d6f68fcc81f71d
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/ChoiceSaveHandler.cs
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues;
|
|
3
|
-
using DREditor.EventObjects;
|
|
4
|
-
using DREditor.Saving;
|
|
5
|
-
using System.Collections.Generic;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Choices
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[ClassHeader(nameof(IDRESaveable) + ", " + nameof(IDRELoadable) + ", " + nameof(IClearDialogueSaveData) +
|
|
14
|
-
"\n\n")]
|
|
15
|
-
public class ChoiceSaveHandler : DialogueComponent, IDRESaveable, IDRELoadable, IClearDialogueSaveData
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected string saveKey = "Choices";
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected SceneEventListener OnPlayerDidntGivePresentChoice = null;
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
[Tooltip("")]
|
|
33
|
-
[SerializeField] protected int dontGivePresentChoiceIndex = 1;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/// <summary>
|
|
37
|
-
///
|
|
38
|
-
/// </summary>
|
|
39
|
-
protected List<int> choices = new();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
protected virtual void OnEnable() => OnPlayerDidntGivePresentChoice.Response.AddListener(OnPlayerNoGivePresent);
|
|
46
|
-
|
|
47
|
-
/// <summary>
|
|
48
|
-
///
|
|
49
|
-
/// </summary>
|
|
50
|
-
protected virtual void OnDisable() => OnPlayerDidntGivePresentChoice.Response.RemoveListener(OnPlayerNoGivePresent);
|
|
51
|
-
|
|
52
|
-
/// <summary>
|
|
53
|
-
///
|
|
54
|
-
/// </summary>
|
|
55
|
-
protected virtual void OnPlayerNoGivePresent() => AddChoice(dontGivePresentChoiceIndex);
|
|
56
|
-
|
|
57
|
-
/// <summary>
|
|
58
|
-
///
|
|
59
|
-
/// </summary>
|
|
60
|
-
/// <param name="selectedChoiceIndex"></param>
|
|
61
|
-
public virtual void AddChoice(int selectedChoiceIndex) => choices.Add(selectedChoiceIndex);
|
|
62
|
-
|
|
63
|
-
/// <summary>
|
|
64
|
-
///
|
|
65
|
-
/// </summary>
|
|
66
|
-
/// <returns></returns>
|
|
67
|
-
/// <remarks></remarks>
|
|
68
|
-
public virtual List<int> GetChoices() => choices;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/// <inheritdoc/>
|
|
72
|
-
public virtual void Save(Dictionary<string, object> saveData) => saveData.Set(saveKey, choices);
|
|
73
|
-
|
|
74
|
-
/// <inheritdoc/>
|
|
75
|
-
public virtual void ClearSaveData() => choices.Clear();
|
|
76
|
-
|
|
77
|
-
/// <inheritdoc/>
|
|
78
|
-
public virtual void Load(Dictionary<string, object> saveDatas) => choices = new(saveDatas.Get<List<int>>(saveKey));
|
|
79
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using DREditor.Saving;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Choices
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ClassHeader(nameof(IDRESaveable) + ", " + nameof(IDRELoadable) + ", " + nameof(IClearDialogueSaveData) +
|
|
14
|
+
"\n\n")]
|
|
15
|
+
public class ChoiceSaveHandler : DialogueComponent, IDRESaveable, IDRELoadable, IClearDialogueSaveData
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected string saveKey = "Choices";
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected SceneEventListener OnPlayerDidntGivePresentChoice = null;
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected int dontGivePresentChoiceIndex = 1;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
protected List<int> choices = new();
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
protected virtual void OnEnable() => OnPlayerDidntGivePresentChoice.Response.AddListener(OnPlayerNoGivePresent);
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
protected virtual void OnDisable() => OnPlayerDidntGivePresentChoice.Response.RemoveListener(OnPlayerNoGivePresent);
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
protected virtual void OnPlayerNoGivePresent() => AddChoice(dontGivePresentChoiceIndex);
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
///
|
|
59
|
+
/// </summary>
|
|
60
|
+
/// <param name="selectedChoiceIndex"></param>
|
|
61
|
+
public virtual void AddChoice(int selectedChoiceIndex) => choices.Add(selectedChoiceIndex);
|
|
62
|
+
|
|
63
|
+
/// <summary>
|
|
64
|
+
///
|
|
65
|
+
/// </summary>
|
|
66
|
+
/// <returns></returns>
|
|
67
|
+
/// <remarks></remarks>
|
|
68
|
+
public virtual List<int> GetChoices() => choices;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/// <inheritdoc/>
|
|
72
|
+
public virtual void Save(Dictionary<string, object> saveData) => saveData.Set(saveKey, choices);
|
|
73
|
+
|
|
74
|
+
/// <inheritdoc/>
|
|
75
|
+
public virtual void ClearSaveData() => choices.Clear();
|
|
76
|
+
|
|
77
|
+
/// <inheritdoc/>
|
|
78
|
+
public virtual void Load(Dictionary<string, object> saveDatas) => choices = new(saveDatas.Get<List<int>>(saveKey));
|
|
79
|
+
}
|
|
80
80
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 3f6bb93956b512345ae1432c69775f0e
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 3f6bb93956b512345ae1432c69775f0e
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/DREditor.Choices.asmdef
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "DREditor.Choices",
|
|
3
|
-
"rootNamespace": "",
|
|
4
|
-
"references": [
|
|
5
|
-
"Unity.InputSystem",
|
|
6
|
-
"Unity.TextMeshPro",
|
|
7
|
-
"DREditor",
|
|
8
|
-
"DREditor.Controls",
|
|
9
|
-
"DREditor.UI",
|
|
10
|
-
"DREditor.Progressing.Handling"
|
|
11
|
-
],
|
|
12
|
-
"includePlatforms": [],
|
|
13
|
-
"excludePlatforms": [],
|
|
14
|
-
"allowUnsafeCode": false,
|
|
15
|
-
"overrideReferences": false,
|
|
16
|
-
"precompiledReferences": [],
|
|
17
|
-
"autoReferenced": true,
|
|
18
|
-
"defineConstraints": [],
|
|
19
|
-
"versionDefines": [],
|
|
20
|
-
"noEngineReferences": false
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.Choices",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"Unity.InputSystem",
|
|
6
|
+
"Unity.TextMeshPro",
|
|
7
|
+
"DREditor",
|
|
8
|
+
"DREditor.Controls",
|
|
9
|
+
"DREditor.UI",
|
|
10
|
+
"DREditor.Progressing.Handling"
|
|
11
|
+
],
|
|
12
|
+
"includePlatforms": [],
|
|
13
|
+
"excludePlatforms": [],
|
|
14
|
+
"allowUnsafeCode": false,
|
|
15
|
+
"overrideReferences": false,
|
|
16
|
+
"precompiledReferences": [],
|
|
17
|
+
"autoReferenced": true,
|
|
18
|
+
"defineConstraints": [],
|
|
19
|
+
"versionDefines": [],
|
|
20
|
+
"noEngineReferences": false
|
|
21
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 9daee1ad32953b547a29acdb5db552a3
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 9daee1ad32953b547a29acdb5db552a3
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
package/DialogueChoiceHandler.cs
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues;
|
|
3
|
-
using DREditor.Dialogues.LineReading;
|
|
4
|
-
using DREditor.Services;
|
|
5
|
-
using System;
|
|
6
|
-
using System.Collections;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Choices
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(ILineEndProcess) + ", " + nameof(ILineWaitForClick) +
|
|
14
|
-
"\n\n")]
|
|
15
|
-
public class DialogueChoiceHandler : DialogueComponent, ILineEndProcess, ILineWaitForClick
|
|
16
|
-
{
|
|
17
|
-
public virtual bool SkipOnFastForward => false;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/// <inheritdoc/>
|
|
21
|
-
public virtual void LineEndProcess(Line currentLine = null)
|
|
22
|
-
{
|
|
23
|
-
if (ServiceLocator.HasService<IChoiceManager>())
|
|
24
|
-
ServiceLocator.GetService<IChoiceManager>()?.ClearChoiceText();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
/// <inheritdoc/>
|
|
32
|
-
public virtual IEnumerator LineWaitForClick<T>
|
|
33
|
-
(DialogueBase<T> currentDialogue, Line currentLine, Action exitParentCallback = null)
|
|
34
|
-
where T : Line
|
|
35
|
-
{
|
|
36
|
-
if (currentDialogue is not Dialogue dialogue)
|
|
37
|
-
yield break;
|
|
38
|
-
|
|
39
|
-
bool OnLastLine = dialogue.Lines.IndexOf(currentLine) == dialogue.Lines.Count - 1;
|
|
40
|
-
|
|
41
|
-
bool hasChoices = OnLastLine && dialogue.Choices.Count != 0;
|
|
42
|
-
|
|
43
|
-
if (hasChoices)
|
|
44
|
-
{
|
|
45
|
-
bool exitEarly = false;
|
|
46
|
-
|
|
47
|
-
UnityEngine.Debug.Log(ToString() + ": Dialogue: " + dialogue.name + " has choices.");
|
|
48
|
-
|
|
49
|
-
yield return ServiceLocator
|
|
50
|
-
.GetService<IChoiceManager>()
|
|
51
|
-
.ExecuteChoiceHandling(dialogue, () => { exitParentCallback?.Invoke(); exitEarly = true; });
|
|
52
|
-
|
|
53
|
-
UnityEngine.Debug.Log(ToString() + ": Exit Early is: " + exitEarly);
|
|
54
|
-
|
|
55
|
-
if (exitEarly)
|
|
56
|
-
yield break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.Dialogues.LineReading;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using System;
|
|
6
|
+
using System.Collections;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Choices
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(ILineEndProcess) + ", " + nameof(ILineWaitForClick) +
|
|
14
|
+
"\n\n")]
|
|
15
|
+
public class DialogueChoiceHandler : DialogueComponent, ILineEndProcess, ILineWaitForClick
|
|
16
|
+
{
|
|
17
|
+
public virtual bool SkipOnFastForward => false;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/// <inheritdoc/>
|
|
21
|
+
public virtual void LineEndProcess(Line currentLine = null)
|
|
22
|
+
{
|
|
23
|
+
if (ServiceLocator.HasService<IChoiceManager>())
|
|
24
|
+
ServiceLocator.GetService<IChoiceManager>()?.ClearChoiceText();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
/// <inheritdoc/>
|
|
32
|
+
public virtual IEnumerator LineWaitForClick<T>
|
|
33
|
+
(DialogueBase<T> currentDialogue, Line currentLine, Action exitParentCallback = null)
|
|
34
|
+
where T : Line
|
|
35
|
+
{
|
|
36
|
+
if (currentDialogue is not Dialogue dialogue)
|
|
37
|
+
yield break;
|
|
38
|
+
|
|
39
|
+
bool OnLastLine = dialogue.Lines.IndexOf(currentLine) == dialogue.Lines.Count - 1;
|
|
40
|
+
|
|
41
|
+
bool hasChoices = OnLastLine && dialogue.Choices.Count != 0;
|
|
42
|
+
|
|
43
|
+
if (hasChoices)
|
|
44
|
+
{
|
|
45
|
+
bool exitEarly = false;
|
|
46
|
+
|
|
47
|
+
UnityEngine.Debug.Log(ToString() + ": Dialogue: " + dialogue.name + " has choices.");
|
|
48
|
+
|
|
49
|
+
yield return ServiceLocator
|
|
50
|
+
.GetService<IChoiceManager>()
|
|
51
|
+
.ExecuteChoiceHandling(dialogue, () => { exitParentCallback?.Invoke(); exitEarly = true; });
|
|
52
|
+
|
|
53
|
+
UnityEngine.Debug.Log(ToString() + ": Exit Early is: " + exitEarly);
|
|
54
|
+
|
|
55
|
+
if (exitEarly)
|
|
56
|
+
yield break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
60
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: e79a5f2a04464bb46a3be0cda2b29ad2
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: e79a5f2a04464bb46a3be0cda2b29ad2
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/IChoiceManager.cs
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues;
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.Choices
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
public interface IChoiceManager
|
|
12
|
-
{
|
|
13
|
-
/// <summary>
|
|
14
|
-
///
|
|
15
|
-
/// </summary>
|
|
16
|
-
IEnumerator ExecuteChoiceHandling(Dialogue currentDialogue, Action exitParentRoutine = null);
|
|
17
|
-
|
|
18
|
-
/// <summary>
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
/// <param name="actionArray"></param>
|
|
22
|
-
void SubscribeAllChoices(Action[] actionArray);
|
|
23
|
-
|
|
24
|
-
/// <summary>
|
|
25
|
-
///
|
|
26
|
-
/// </summary>
|
|
27
|
-
void SubscribeChoice(int index, Action action);
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
void UnsubscribeChoice(int index, Action action);
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
///
|
|
36
|
-
/// </summary>
|
|
37
|
-
void UnsubscribeAllChoices();
|
|
38
|
-
|
|
39
|
-
/// <summary>
|
|
40
|
-
///
|
|
41
|
-
/// </summary>
|
|
42
|
-
void ClearChoiceText();
|
|
43
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Choices
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
public interface IChoiceManager
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
IEnumerator ExecuteChoiceHandling(Dialogue currentDialogue, Action exitParentRoutine = null);
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
/// <param name="actionArray"></param>
|
|
22
|
+
void SubscribeAllChoices(Action[] actionArray);
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
///
|
|
26
|
+
/// </summary>
|
|
27
|
+
void SubscribeChoice(int index, Action action);
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
void UnsubscribeChoice(int index, Action action);
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
void UnsubscribeAllChoices();
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
void ClearChoiceText();
|
|
43
|
+
}
|
|
44
44
|
}
|
package/IChoiceManager.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 7d08776b79928704fab7f6b22d2382a3
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 7d08776b79928704fab7f6b22d2382a3
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|