net.dreditor.dialoguemechanics.automaticline 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.
Files changed (30) hide show
  1. package/.attestation.p7m +0 -0
  2. package/AutoMechanic.cs +114 -114
  3. package/AutoMechanic.cs.meta +11 -11
  4. package/AutoMechanicBase.cs +48 -48
  5. package/AutoMechanicBase.cs.meta +11 -11
  6. package/AutoMechanicLineHandler.cs +41 -41
  7. package/AutoMechanicLineHandler.cs.meta +11 -11
  8. package/AutoMechanicToggler.cs +92 -92
  9. package/AutoMechanicToggler.cs.meta +11 -11
  10. package/DREditor.DialogueMechanics.AutomaticLine.asmdef +20 -20
  11. package/DREditor.DialogueMechanics.AutomaticLine.asmdef.meta +7 -7
  12. package/{Samples → Samples~}/AutoWaitTime.asset +20 -20
  13. package/{Samples → Samples~}/AutoWaitTime.asset.meta +8 -8
  14. package/{Samples → Samples~}/Auto_Mechanic_Line_Handler.prefab +135 -135
  15. package/{Samples → Samples~}/Auto_Mechanic_Line_Handler.prefab.meta +7 -7
  16. package/{Samples → Samples~}/Auto_Mechanic_Toggler.prefab +144 -144
  17. package/{Samples → Samples~}/Auto_Mechanic_Toggler.prefab.meta +7 -7
  18. package/{Samples → Samples~}/CanToggleAutoMode.asset +20 -20
  19. package/{Samples → Samples~}/CanToggleAutoMode.asset.meta +8 -8
  20. package/{Samples → Samples~}/MaxAutoWaitTime.asset +20 -20
  21. package/{Samples → Samples~}/MaxAutoWaitTime.asset.meta +8 -8
  22. package/{Samples → Samples~}/Text_Voice_Auto_Mechanic.prefab +53 -53
  23. package/{Samples → Samples~}/Text_Voice_Auto_Mechanic.prefab.meta +7 -7
  24. package/TextBoxAutoMechanic.cs +47 -47
  25. package/TextBoxAutoMechanic.cs.meta +11 -11
  26. package/TextVoiceAutoMechanic.cs +29 -29
  27. package/TextVoiceAutoMechanic.cs.meta +11 -11
  28. package/package.json +43 -38
  29. package/package.json.meta +7 -7
  30. package/Samples.meta +0 -8
Binary file
package/AutoMechanic.cs CHANGED
@@ -1,115 +1,115 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.EventObjects;
3
- using System.Collections;
4
- using UnityEngine;
5
- using UnityEngine.InputSystem;
6
-
7
- namespace DREditor.DialogueMechanics.AutomaticLine
8
- {
9
- /// <summary>
10
- ///
11
- /// </summary>
12
- [ClassHeader(nameof(AutoMechanicBase) +
13
- "\n\n")]
14
- public class AutoMechanic : AutoMechanicBase
15
- {
16
- /// <summary>
17
- ///
18
- /// </summary>
19
- [Tooltip("")]
20
- [SerializeField] protected InputActionReference submit = null;
21
-
22
-
23
- /// <summary>
24
- ///
25
- /// </summary>
26
- [Header("")]
27
- [Divider]
28
- [Tooltip("")]
29
- [SerializeField] protected BoolWithEvent inMenu = null;
30
-
31
- /// <summary>
32
- ///
33
- /// </summary>
34
- [Tooltip("")]
35
- [SerializeField] protected BoolWithEvent inFastForwardMode = null;
36
-
37
- /// <summary>
38
- ///
39
- /// </summary>
40
- [Tooltip("")]
41
- [SerializeField] protected FloatWithEvent autoWaitTime = null;
42
-
43
-
44
- /// <summary>
45
- ///
46
- /// </summary>
47
- protected bool goingToNextLine = false;
48
-
49
-
50
- /// <inheritdoc/>
51
- public override bool InAutoMode()
52
- {
53
- if (inFastForwardMode != null && inFastForwardMode.Value)
54
- return false;
55
-
56
- return base.InAutoMode();
57
- }
58
-
59
- /// <inheritdoc/>
60
- public override IEnumerator WaitForAutoMechanicToResolve()
61
- {
62
- goingToNextLine = false;
63
-
64
- StartCoroutine(AutoMechanicProcess());
65
-
66
- yield return WhileAutoModeIsntFinished();
67
-
68
- yield break;
69
- }
70
-
71
- /// <inheritdoc/>
72
- protected override IEnumerator AutoMechanicProcess()
73
- {
74
- yield return new WaitForSeconds(CalculateAutoWaitTime());
75
-
76
- EndAutoProcess();
77
-
78
- yield break;
79
- }
80
-
81
- /// <summary>
82
- ///
83
- /// </summary>
84
- /// <returns></returns>
85
- protected virtual IEnumerator WhileAutoModeIsntFinished()
86
- {
87
- bool clickNextInputTriggered = submit.action.triggered;
88
-
89
- while (!goingToNextLine)
90
- {
91
- if ((!inMenu.Value && clickNextInputTriggered) || !inAutoMode.Value)
92
- break;
93
- else
94
- yield return null;
95
- }
96
-
97
- yield break;
98
- }
99
-
100
- /// <summary>
101
- ///
102
- /// </summary>
103
- /// <returns></returns>
104
- protected virtual float CalculateAutoWaitTime() => autoWaitTime.Value;
105
-
106
- /// <summary>
107
- ///
108
- /// </summary>
109
- protected virtual void EndAutoProcess()
110
- {
111
- if (inAutoMode.Value)
112
- goingToNextLine = true;
113
- }
114
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using System.Collections;
4
+ using UnityEngine;
5
+ using UnityEngine.InputSystem;
6
+
7
+ namespace DREditor.DialogueMechanics.AutomaticLine
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ [ClassHeader(nameof(AutoMechanicBase) +
13
+ "\n\n")]
14
+ public class AutoMechanic : AutoMechanicBase
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ [Tooltip("")]
20
+ [SerializeField] protected InputActionReference submit = null;
21
+
22
+
23
+ /// <summary>
24
+ ///
25
+ /// </summary>
26
+ [Header("")]
27
+ [Divider]
28
+ [Tooltip("")]
29
+ [SerializeField] protected BoolWithEvent inMenu = null;
30
+
31
+ /// <summary>
32
+ ///
33
+ /// </summary>
34
+ [Tooltip("")]
35
+ [SerializeField] protected BoolWithEvent inFastForwardMode = null;
36
+
37
+ /// <summary>
38
+ ///
39
+ /// </summary>
40
+ [Tooltip("")]
41
+ [SerializeField] protected FloatWithEvent autoWaitTime = null;
42
+
43
+
44
+ /// <summary>
45
+ ///
46
+ /// </summary>
47
+ protected bool goingToNextLine = false;
48
+
49
+
50
+ /// <inheritdoc/>
51
+ public override bool InAutoMode()
52
+ {
53
+ if (inFastForwardMode != null && inFastForwardMode.Value)
54
+ return false;
55
+
56
+ return base.InAutoMode();
57
+ }
58
+
59
+ /// <inheritdoc/>
60
+ public override IEnumerator WaitForAutoMechanicToResolve()
61
+ {
62
+ goingToNextLine = false;
63
+
64
+ StartCoroutine(AutoMechanicProcess());
65
+
66
+ yield return WhileAutoModeIsntFinished();
67
+
68
+ yield break;
69
+ }
70
+
71
+ /// <inheritdoc/>
72
+ protected override IEnumerator AutoMechanicProcess()
73
+ {
74
+ yield return new WaitForSeconds(CalculateAutoWaitTime());
75
+
76
+ EndAutoProcess();
77
+
78
+ yield break;
79
+ }
80
+
81
+ /// <summary>
82
+ ///
83
+ /// </summary>
84
+ /// <returns></returns>
85
+ protected virtual IEnumerator WhileAutoModeIsntFinished()
86
+ {
87
+ bool clickNextInputTriggered = submit.action.triggered;
88
+
89
+ while (!goingToNextLine)
90
+ {
91
+ if ((!inMenu.Value && clickNextInputTriggered) || !inAutoMode.Value)
92
+ break;
93
+ else
94
+ yield return null;
95
+ }
96
+
97
+ yield break;
98
+ }
99
+
100
+ /// <summary>
101
+ ///
102
+ /// </summary>
103
+ /// <returns></returns>
104
+ protected virtual float CalculateAutoWaitTime() => autoWaitTime.Value;
105
+
106
+ /// <summary>
107
+ ///
108
+ /// </summary>
109
+ protected virtual void EndAutoProcess()
110
+ {
111
+ if (inAutoMode.Value)
112
+ goingToNextLine = true;
113
+ }
114
+ }
115
115
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 0cd74c8fd9d64464e97aee75ec03d977
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: 0cd74c8fd9d64464e97aee75ec03d977
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,49 +1,49 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.EventObjects;
3
- using System.Collections;
4
- using UnityEngine;
5
-
6
- namespace DREditor.DialogueMechanics.AutomaticLine
7
- {
8
- /// <summary>
9
- ///
10
- /// </summary>
11
- public abstract class AutoMechanicBase : MonoBehaviour
12
- {
13
- /// <summary>
14
- ///
15
- /// </summary>
16
- [Header("")]
17
-
18
- [Space]
19
-
20
- [Header("")]
21
- [Divider]
22
- [Tooltip("")]
23
- [SerializeField] protected BoolWithEvent inAutoMode = null;
24
-
25
-
26
- /// <summary>
27
- ///
28
- /// </summary>
29
- /// <returns></returns>
30
- public abstract IEnumerator WaitForAutoMechanicToResolve();
31
-
32
- /// <summary>
33
- ///
34
- /// </summary>
35
- /// <returns></returns>
36
- protected abstract IEnumerator AutoMechanicProcess();
37
-
38
- /// <summary>
39
- ///
40
- /// </summary>
41
- /// <returns></returns>
42
- public virtual bool InAutoMode() => inAutoMode.Value;
43
-
44
- /// <summary>
45
- ///
46
- /// </summary>
47
- public virtual void ToggleAutoMode() => inAutoMode.SetValue(!inAutoMode.Value);
48
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using System.Collections;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.DialogueMechanics.AutomaticLine
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public abstract class AutoMechanicBase : MonoBehaviour
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [Header("")]
17
+
18
+ [Space]
19
+
20
+ [Header("")]
21
+ [Divider]
22
+ [Tooltip("")]
23
+ [SerializeField] protected BoolWithEvent inAutoMode = null;
24
+
25
+
26
+ /// <summary>
27
+ ///
28
+ /// </summary>
29
+ /// <returns></returns>
30
+ public abstract IEnumerator WaitForAutoMechanicToResolve();
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ /// <returns></returns>
36
+ protected abstract IEnumerator AutoMechanicProcess();
37
+
38
+ /// <summary>
39
+ ///
40
+ /// </summary>
41
+ /// <returns></returns>
42
+ public virtual bool InAutoMode() => inAutoMode.Value;
43
+
44
+ /// <summary>
45
+ ///
46
+ /// </summary>
47
+ public virtual void ToggleAutoMode() => inAutoMode.SetValue(!inAutoMode.Value);
48
+ }
49
49
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: f4682aa9b382fc84aa06338a3523ba2e
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: f4682aa9b382fc84aa06338a3523ba2e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,42 +1,42 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.Dialogues;
3
- using DREditor.Dialogues.LineReading;
4
- using System;
5
- using System.Collections;
6
- using UnityEngine;
7
-
8
- namespace DREditor.DialogueMechanics.AutomaticLine
9
- {
10
- /// <summary>
11
- ///
12
- /// </summary>
13
- [ClassHeader(nameof(DialogueComponent) + ", " + nameof(ILineWaitForClick) +
14
- "\n\n")]
15
- public class AutoMechanicLineHandler : DialogueComponent, ILineWaitForClick
16
- {
17
- /// <summary>
18
- ///
19
- /// </summary>
20
- [Header("")]
21
- [Divider]
22
- [Tooltip("")]
23
- [SerializeField] protected AutoMechanicBase AutoMechanic = null;
24
-
25
-
26
- public virtual bool SkipOnFastForward => true;
27
-
28
- /// <inheritdoc/>
29
- public virtual IEnumerator LineWaitForClick<T>(DialogueBase<T> currentDialogue, Line currentLine,
30
- Action exitParentCallback = null)
31
- where T : Line
32
- {
33
- if (AutoMechanic.InAutoMode())
34
- {
35
- yield return AutoMechanic.WaitForAutoMechanicToResolve();
36
-
37
- if (AutoMechanic.InAutoMode())
38
- exitParentCallback?.Invoke();
39
- }
40
- }
41
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Dialogues.LineReading;
4
+ using System;
5
+ using System.Collections;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.DialogueMechanics.AutomaticLine
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader(nameof(DialogueComponent) + ", " + nameof(ILineWaitForClick) +
14
+ "\n\n")]
15
+ public class AutoMechanicLineHandler : DialogueComponent, ILineWaitForClick
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ [Header("")]
21
+ [Divider]
22
+ [Tooltip("")]
23
+ [SerializeField] protected AutoMechanicBase AutoMechanic = null;
24
+
25
+
26
+ public virtual bool SkipOnFastForward => true;
27
+
28
+ /// <inheritdoc/>
29
+ public virtual IEnumerator LineWaitForClick<T>(DialogueBase<T> currentDialogue, Line currentLine,
30
+ Action exitParentCallback = null)
31
+ where T : Line
32
+ {
33
+ if (AutoMechanic.InAutoMode())
34
+ {
35
+ yield return AutoMechanic.WaitForAutoMechanicToResolve();
36
+
37
+ if (AutoMechanic.InAutoMode())
38
+ exitParentCallback?.Invoke();
39
+ }
40
+ }
41
+ }
42
42
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 1429a39a5e5323049b2c16787518aaae
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: 1429a39a5e5323049b2c16787518aaae
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,93 +1,93 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.Dialogues;
3
- using DREditor.EventObjects;
4
- using DREditor.Services;
5
- using UnityEngine;
6
- using UnityEngine.InputSystem;
7
- using static UnityEngine.InputSystem.InputAction;
8
-
9
- namespace DREditor.DialogueMechanics.AutomaticLine
10
- {
11
- /// <summary>
12
- ///
13
- /// </summary>
14
- [ClassHeader(nameof(IToTitleScreen) +
15
- "\n\n")]
16
- public class AutoMechanicToggler : MonoBehaviour, IToTitleScreen
17
- {
18
- /// <summary>
19
- ///
20
- /// </summary>
21
- [Tooltip("")]
22
- [SerializeField] protected InputActionReference auto = null;
23
-
24
-
25
- /// <summary>
26
- ///
27
- /// </summary>
28
- [Header("")]
29
- [Divider]
30
- [Tooltip("")]
31
- [SerializeField] protected AutoMechanicBase AutoMechanic = null;
32
-
33
-
34
- /// <summary>
35
- ///
36
- /// </summary>
37
- [Header("")]
38
- [Divider]
39
- [Tooltip("")]
40
- [SerializeField] protected BoolWithEvent inDialogue = null;
41
-
42
- /// <summary>
43
- ///
44
- /// </summary>
45
- [Tooltip("")]
46
- [SerializeField] protected BoolWithEvent isLeaving = null;
47
-
48
- /// <summary>
49
- ///
50
- /// </summary>
51
- [Tooltip("")]
52
- [SerializeField] protected BoolWithEvent isUIToggled = null;
53
-
54
- /// <summary>
55
- ///
56
- /// </summary>
57
- [Tooltip("")]
58
- [SerializeField] protected BoolWithEvent canToggleAutoMode = null;
59
-
60
-
61
- protected virtual void Awake() => EnableToggleAbility();
62
-
63
- /// <summary>
64
- ///
65
- /// </summary>
66
- protected virtual void EnableToggleAbility() => canToggleAutoMode.SetValue(true);
67
-
68
- protected virtual void OnEnable() => auto.action.performed += AttemptToggleAutoMode;
69
-
70
- protected virtual void OnDisable() => auto.action.performed -= AttemptToggleAutoMode;
71
-
72
- /// <summary>
73
- ///
74
- /// </summary>
75
- /// <param name="context"></param>
76
- protected virtual void AttemptToggleAutoMode(CallbackContext context)
77
- {
78
- if (GetComponentInParent<IDialogueManager>() is var dialogueManager &&
79
- dialogueManager != ServiceLocator.GetService<IDialogueManager>())
80
- return;
81
-
82
- if (!inDialogue.Value || isLeaving.Value || !isUIToggled.Value || !canToggleAutoMode.Value)
83
- return;
84
-
85
- if (auto.action.triggered)
86
- AutoMechanic.ToggleAutoMode();
87
- }
88
-
89
-
90
- /// <inheritdoc/>
91
- public virtual void ToTitleScreen() => EnableToggleAbility();
92
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.EventObjects;
4
+ using DREditor.Services;
5
+ using UnityEngine;
6
+ using UnityEngine.InputSystem;
7
+ using static UnityEngine.InputSystem.InputAction;
8
+
9
+ namespace DREditor.DialogueMechanics.AutomaticLine
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ [ClassHeader(nameof(IToTitleScreen) +
15
+ "\n\n")]
16
+ public class AutoMechanicToggler : MonoBehaviour, IToTitleScreen
17
+ {
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ [SerializeField] protected InputActionReference auto = null;
23
+
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ [Header("")]
29
+ [Divider]
30
+ [Tooltip("")]
31
+ [SerializeField] protected AutoMechanicBase AutoMechanic = null;
32
+
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Header("")]
38
+ [Divider]
39
+ [Tooltip("")]
40
+ [SerializeField] protected BoolWithEvent inDialogue = null;
41
+
42
+ /// <summary>
43
+ ///
44
+ /// </summary>
45
+ [Tooltip("")]
46
+ [SerializeField] protected BoolWithEvent isLeaving = null;
47
+
48
+ /// <summary>
49
+ ///
50
+ /// </summary>
51
+ [Tooltip("")]
52
+ [SerializeField] protected BoolWithEvent isUIToggled = null;
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ [Tooltip("")]
58
+ [SerializeField] protected BoolWithEvent canToggleAutoMode = null;
59
+
60
+
61
+ protected virtual void Awake() => EnableToggleAbility();
62
+
63
+ /// <summary>
64
+ ///
65
+ /// </summary>
66
+ protected virtual void EnableToggleAbility() => canToggleAutoMode.SetValue(true);
67
+
68
+ protected virtual void OnEnable() => auto.action.performed += AttemptToggleAutoMode;
69
+
70
+ protected virtual void OnDisable() => auto.action.performed -= AttemptToggleAutoMode;
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ /// <param name="context"></param>
76
+ protected virtual void AttemptToggleAutoMode(CallbackContext context)
77
+ {
78
+ if (GetComponentInParent<IDialogueManager>() is var dialogueManager &&
79
+ dialogueManager != ServiceLocator.GetService<IDialogueManager>())
80
+ return;
81
+
82
+ if (!inDialogue.Value || isLeaving.Value || !isUIToggled.Value || !canToggleAutoMode.Value)
83
+ return;
84
+
85
+ if (auto.action.triggered)
86
+ AutoMechanic.ToggleAutoMode();
87
+ }
88
+
89
+
90
+ /// <inheritdoc/>
91
+ public virtual void ToTitleScreen() => EnableToggleAbility();
92
+ }
93
93
  }