net.dreditor.minigames 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.
Files changed (167) hide show
  1. package/.attestation.p7m +0 -0
  2. package/BulletDifficulty.cs +37 -0
  3. package/BulletDifficulty.cs.meta +11 -0
  4. package/BulletDifficultyEditor.cs +381 -0
  5. package/BulletDifficultyEditor.cs.meta +11 -0
  6. package/DREditor.Minigames.asmdef +37 -0
  7. package/DREditor.Minigames.asmdef.meta +7 -0
  8. package/DifficultyEditorBase.cs +61 -0
  9. package/DifficultyEditorBase.cs.meta +11 -0
  10. package/IShatterGraphic.cs +33 -0
  11. package/IShatterGraphic.cs.meta +11 -0
  12. package/IShatterText.cs +34 -0
  13. package/IShatterText.cs.meta +11 -0
  14. package/InitializeTrialOffsets.cs +52 -0
  15. package/InitializeTrialOffsets.cs.meta +11 -0
  16. package/MinigameBuilderBase.cs +29 -0
  17. package/MinigameBuilderBase.cs.meta +11 -0
  18. package/MinigameControlsUIHandler.cs +95 -0
  19. package/MinigameControlsUIHandler.cs.meta +11 -0
  20. package/MinigameManagerBase.cs +198 -0
  21. package/MinigameManagerBase.cs.meta +11 -0
  22. package/QuestionToggle.cs +155 -0
  23. package/QuestionToggle.cs.meta +11 -0
  24. package/RestoreControlsUIPostDialogue.cs +101 -0
  25. package/RestoreControlsUIPostDialogue.cs.meta +2 -0
  26. package/Samples~/Bullet Shatter Mesh Generator.asset +23 -0
  27. package/Samples~/Bullet Shatter Mesh Generator.asset.meta +8 -0
  28. package/Samples~/HasStamina.asset +21 -0
  29. package/Samples~/HasStamina.asset.meta +8 -0
  30. package/Samples~/IsDrainingStamina.asset +21 -0
  31. package/Samples~/IsDrainingStamina.asset.meta +8 -0
  32. package/Samples~/MinigameInputAllowed.asset +21 -0
  33. package/Samples~/MinigameInputAllowed.asset.meta +8 -0
  34. package/Samples~/Minigame_Controls_UI_Handler.prefab +53 -0
  35. package/Samples~/Minigame_Controls_UI_Handler.prefab.meta +7 -0
  36. package/Samples~/Quad Shatter.asset +31 -0
  37. package/Samples~/Quad Shatter.asset.meta +8 -0
  38. package/Samples~/ShatterCameraEnabled.asset +21 -0
  39. package/Samples~/ShatterCameraEnabled.asset.meta +8 -0
  40. package/Samples~/Shatter_Graphic.prefab +98 -0
  41. package/Samples~/Shatter_Graphic.prefab.meta +7 -0
  42. package/Samples~/Stamina_Handler.prefab +59 -0
  43. package/Samples~/Stamina_Handler.prefab.meta +7 -0
  44. package/Samples~/TBS_Manager_Shell.prefab +60 -0
  45. package/Samples~/TBS_Manager_Shell.prefab.meta +7 -0
  46. package/Samples~/TBS_Manager_Template.prefab +504 -0
  47. package/Samples~/TBS_Manager_Template.prefab.meta +7 -0
  48. package/Samples~/Trial_UI_Shatter_Canvas_Shell.prefab +289 -0
  49. package/Samples~/Trial_UI_Shatter_Canvas_Shell.prefab.meta +7 -0
  50. package/Samples~/Trial_UI_Shatter_Canvas_Template.prefab +449 -0
  51. package/Samples~/Trial_UI_Shatter_Canvas_Template.prefab.meta +7 -0
  52. package/Samples~/Triangle Shatter.asset +31 -0
  53. package/Samples~/Triangle Shatter.asset.meta +8 -0
  54. package/Samples~/Truth_Bullet_Menu_Canvas_Shell.prefab +221 -0
  55. package/Samples~/Truth_Bullet_Menu_Canvas_Shell.prefab.meta +7 -0
  56. package/Samples~/Truth_Bullet_Menu_Canvas_Template.prefab +525 -0
  57. package/Samples~/Truth_Bullet_Menu_Canvas_Template.prefab.meta +7 -0
  58. package/Samples~/Truth_Bullet_Menu_Holder_Shell.prefab +38 -0
  59. package/Samples~/Truth_Bullet_Menu_Holder_Shell.prefab.meta +7 -0
  60. package/Samples~/Truth_Bullet_Menu_Holder_Template.prefab +1159 -0
  61. package/Samples~/Truth_Bullet_Menu_Holder_Template.prefab.meta +7 -0
  62. package/Samples~/Truth_Bullet_Minigame_Canvas_Template.prefab +494 -0
  63. package/Samples~/Truth_Bullet_Minigame_Canvas_Template.prefab.meta +7 -0
  64. package/Samples~/Truth_Bullet_Option_ETemplate.prefab +294 -0
  65. package/Samples~/Truth_Bullet_Option_ETemplate.prefab.meta +7 -0
  66. package/Shattering/BreakTex.renderTexture +39 -0
  67. package/Shattering/BreakTex.renderTexture.meta +8 -0
  68. package/Shattering/BulletShatter.cs +177 -0
  69. package/Shattering/BulletShatter.cs.meta +11 -0
  70. package/Shattering/IShatterableCanvas.cs +21 -0
  71. package/Shattering/IShatterableCanvas.cs.meta +11 -0
  72. package/Shattering/MeshGenerator.cs +179 -0
  73. package/Shattering/MeshGenerator.cs.meta +11 -0
  74. package/Shattering/RenderCanvasOnShatter.cs +48 -0
  75. package/Shattering/RenderCanvasOnShatter.cs.meta +11 -0
  76. package/Shattering/ShatterCameraRender.cs +80 -0
  77. package/Shattering/ShatterCameraRender.cs.meta +11 -0
  78. package/Shattering/ShatterGraphic.cs +136 -0
  79. package/Shattering/ShatterGraphic.cs.meta +11 -0
  80. package/Shattering/ShatterMeshGraphic.cs +305 -0
  81. package/Shattering/ShatterMeshGraphic.cs.meta +11 -0
  82. package/Shattering/ShatterProcess.cs +283 -0
  83. package/Shattering/ShatterProcess.cs.meta +11 -0
  84. package/Shattering/ShatterProcessBase.cs +52 -0
  85. package/Shattering/ShatterProcessBase.cs.meta +11 -0
  86. package/Shattering/ShatterQuad.cs +57 -0
  87. package/Shattering/ShatterQuad.cs.meta +11 -0
  88. package/Shattering/ShatterQuadProcess.cs +66 -0
  89. package/Shattering/ShatterQuadProcess.cs.meta +11 -0
  90. package/Shattering/ShatterShape.cs +85 -0
  91. package/Shattering/ShatterShape.cs.meta +11 -0
  92. package/Shattering/ShatterTri.cs +28 -0
  93. package/Shattering/ShatterTri.cs.meta +11 -0
  94. package/Shattering/ShatterTriProcess.cs +180 -0
  95. package/Shattering/ShatterTriProcess.cs.meta +11 -0
  96. package/Shattering/ShatterWithUI.cs +69 -0
  97. package/Shattering/ShatterWithUI.cs.meta +11 -0
  98. package/Shattering/SplitShatter.cs +115 -0
  99. package/Shattering/SplitShatter.cs.meta +11 -0
  100. package/Shattering/TMPTextShatter.cs +244 -0
  101. package/Shattering/TMPTextShatter.cs.meta +11 -0
  102. package/Shattering/UIBreakVisibility.cs +173 -0
  103. package/Shattering/UIBreakVisibility.cs.meta +11 -0
  104. package/Shattering.meta +8 -0
  105. package/ShuffleUtility.cs +33 -0
  106. package/ShuffleUtility.cs.meta +11 -0
  107. package/SimpleRandom.cs +33 -0
  108. package/SimpleRandom.cs.meta +11 -0
  109. package/Stats/ColorHealthBar.cs +57 -0
  110. package/Stats/ColorHealthBar.cs.meta +11 -0
  111. package/Stats/ColorHealthModifier.cs +139 -0
  112. package/Stats/ColorHealthModifier.cs.meta +11 -0
  113. package/Stats/GaugeHandler.cs +73 -0
  114. package/Stats/GaugeHandler.cs.meta +2 -0
  115. package/Stats/HealthBarModifier.cs +90 -0
  116. package/Stats/HealthBarModifier.cs.meta +11 -0
  117. package/Stats/HealthStat.cs +78 -0
  118. package/Stats/HealthStat.cs.meta +11 -0
  119. package/Stats/HealthStatBase.cs +27 -0
  120. package/Stats/HealthStatBase.cs.meta +11 -0
  121. package/Stats/IGauge.cs +37 -0
  122. package/Stats/IGauge.cs.meta +2 -0
  123. package/Stats/InfluenceGauge.cs +108 -0
  124. package/Stats/InfluenceGauge.cs.meta +11 -0
  125. package/Stats/InfluenceGaugeBase.cs +43 -0
  126. package/Stats/InfluenceGaugeBase.cs.meta +11 -0
  127. package/Stats/SimpleGauge.cs +47 -0
  128. package/Stats/SimpleGauge.cs.meta +2 -0
  129. package/Stats/StaminaHandler.cs +154 -0
  130. package/Stats/StaminaHandler.cs.meta +11 -0
  131. package/Stats/TrialStats.cs +141 -0
  132. package/Stats/TrialStats.cs.meta +11 -0
  133. package/Stats/TrialStatsBase.cs +37 -0
  134. package/Stats/TrialStatsBase.cs.meta +11 -0
  135. package/Stats.meta +8 -0
  136. package/TBS/TBSelectBuilder.cs +60 -0
  137. package/TBS/TBSelectBuilder.cs.meta +11 -0
  138. package/TBS/TBSelectBuilderEditor.cs +167 -0
  139. package/TBS/TBSelectBuilderEditor.cs.meta +11 -0
  140. package/TBS/TBSelectManager.cs +316 -0
  141. package/TBS/TBSelectManager.cs.meta +11 -0
  142. package/TBS/TBSelection.cs +47 -0
  143. package/TBS/TBSelection.cs.meta +11 -0
  144. package/TBS/TrialTruthBulletMenu.cs +25 -0
  145. package/TBS/TrialTruthBulletMenu.cs.meta +11 -0
  146. package/TBS.meta +8 -0
  147. package/ThreadSafeSimpleRandom.cs +30 -0
  148. package/ThreadSafeSimpleRandom.cs.meta +11 -0
  149. package/TimedDifficultyEditor.cs +57 -0
  150. package/TimedDifficultyEditor.cs.meta +11 -0
  151. package/TimedMinigameEditor.cs +32 -0
  152. package/TimedMinigameEditor.cs.meta +11 -0
  153. package/TimerBase.cs +190 -0
  154. package/TimerBase.cs.meta +11 -0
  155. package/TimerDifficulty.cs +46 -0
  156. package/TimerDifficulty.cs.meta +11 -0
  157. package/TrialDialogueMinigame.cs +277 -0
  158. package/TrialDialogueMinigame.cs.meta +11 -0
  159. package/TrialDiscussion.cs +69 -0
  160. package/TrialDiscussion.cs.meta +11 -0
  161. package/TrialTimer.cs +114 -0
  162. package/TrialTimer.cs.meta +11 -0
  163. package/TrialTimerBase.cs +130 -0
  164. package/TrialTimerBase.cs.meta +11 -0
  165. package/package.json +54 -4
  166. package/package.json.meta +7 -0
  167. package/README.md +0 -3
@@ -0,0 +1,52 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Cameras;
3
+ using DREditor.Characters;
4
+ using DREditor.Processables;
5
+ using UnityEngine;
6
+ using UnityEngine.Serialization;
7
+
8
+ namespace DREditor.Minigames
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader(nameof(InitializableBase) + ", " + nameof(IInitializable) +
14
+ "\n\n")]
15
+ public class InitializeTrialOffsets : InitializableBase
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ [Tooltip("")]
21
+ [FormerlySerializedAs("database")]
22
+ [SerializeField] protected CharacterDatabase characterDatabase = null;
23
+
24
+ /// <summary>
25
+ ///
26
+ /// </summary>
27
+ [Tooltip("")]
28
+ [SerializeField] protected int numberOfCharacters = 16;
29
+
30
+
31
+ /// <inheritdoc/>
32
+ protected override void Init()
33
+ {
34
+ var cameras = FindObjectsByType<DRTrialCamera>();
35
+
36
+ foreach (var camera in cameras)
37
+ SetCharacterHeightOffsets(camera);
38
+ }
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ /// <param name="camera"></param>
44
+ protected virtual void SetCharacterHeightOffsets(DRTrialCamera camera)
45
+ {
46
+ if (characterDatabase != null)
47
+ foreach (Character character in characterDatabase.Characters)
48
+ if (character.TrialPosition < numberOfCharacters)
49
+ camera.CharHeightOffset[character.TrialPosition] = character.TrialHeight;
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: efc696fa0db57ba4eaa5d1aeec8f87e0
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,29 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.Minigames
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ /// <remarks>
12
+ ///
13
+ /// </remarks>
14
+ [Serializable]
15
+ public class MinigameBuilderBase : ScriptableObject
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ public List<TimerDifficulty> times = new();
21
+
22
+
23
+ /// <summary>
24
+ ///
25
+ /// </summary>
26
+ /// <param name="times"></param>
27
+ public virtual void SetDifficultyTimes(List<TimerDifficulty> times) => this.times = times;
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 2415b7ab2ddb97441990a990007ca932
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,95 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using DREditor.UI.UIControls;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.Minigames
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ [ClassHeader(nameof(CallableControlledUI) + ", " + nameof(CallableUIBase) +
12
+ "\n\n")]
13
+ public class MinigameControlsUIHandler : CallableControlledUI
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ [Tooltip("")]
19
+ [SerializeField] protected StringWithEvent currentControlsKey = null;
20
+
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ [Tooltip("")]
25
+ [SerializeField] protected string minigameControlsKey = "";
26
+
27
+
28
+ /// <summary>
29
+ ///
30
+ /// </summary>
31
+ protected TrialTimerBase trialTimer;
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ protected bool timedOut = false;
37
+
38
+
39
+ protected virtual void Awake() => trialTimer = transform.root.GetComponentInChildren<TrialTimerBase>();
40
+
41
+ protected virtual void Start() => currentControlsKey.SetValue(minigameControlsKey);
42
+
43
+ /// <inheritdoc/>
44
+ protected override void OnDisable()
45
+ {
46
+ base.OnDisable();
47
+
48
+ UnsubscribeTimeUp();
49
+ }
50
+
51
+
52
+ /// <inheritdoc/>
53
+ protected override void OpenControlsMenu()
54
+ {
55
+ SubscribeTimeUp();
56
+
57
+ base.OpenControlsMenu();
58
+ }
59
+
60
+ /// <inheritdoc/>
61
+ protected override void OnUIClosed()
62
+ {
63
+ if (!timedOut)
64
+ base.OnUIClosed();
65
+ else
66
+ timedOut = false;
67
+
68
+ UnsubscribeTimeUp();
69
+ }
70
+
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ protected virtual void SubscribeTimeUp()
76
+ {
77
+ if (trialTimer != null)
78
+ trialTimer.TimeUp += OnTimeUp;
79
+ }
80
+
81
+ /// <summary>
82
+ ///
83
+ /// </summary>
84
+ protected virtual void UnsubscribeTimeUp()
85
+ {
86
+ if (trialTimer != null)
87
+ trialTimer.TimeUp -= OnTimeUp;
88
+ }
89
+
90
+ /// <summary>
91
+ ///
92
+ /// </summary>
93
+ protected virtual void OnTimeUp() => timedOut = true;
94
+ }
95
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c32d90af69301f7449ae9fc2f81cd32b
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,198 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Dialogues.Events;
4
+ using DREditor.EventObjects;
5
+ using DREditor.Services;
6
+ using System;
7
+ using System.Collections;
8
+ using System.Linq;
9
+ using UnityEngine;
10
+
11
+ namespace DREditor.Minigames
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ public abstract class MinigameManagerBase : MonoBehaviour
17
+ {
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ [SerializeField] protected string endMinigameEvent = "EndMinigame";
23
+
24
+ /// <summary>
25
+ ///
26
+ /// </summary>
27
+ [Tooltip("")]
28
+ [SerializeField] protected float destroyBufferDuration = 0.5f;
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ [Tooltip("")]
34
+ [SerializeField] protected BoolWithEvent trialMistake = null;
35
+
36
+ /// <summary>
37
+ ///
38
+ /// </summary>
39
+ [Tooltip("")]
40
+ [SerializeField] protected BoolWithEvent inTrialMinigame = null;
41
+
42
+ /// <summary>
43
+ ///
44
+ /// </summary>
45
+ [Tooltip("")]
46
+ [SerializeField] protected BoolWithEvent playerHasDied = null;
47
+
48
+ /// <summary>
49
+ ///
50
+ /// </summary>
51
+ [Tooltip("")]
52
+ [SerializeField] protected BoolWithEvent trialTimeUp = null;
53
+
54
+
55
+ /// <summary>
56
+ ///
57
+ /// </summary>
58
+ public TrialTimerBase TrialTimer => GetComponentInChildren<TrialTimerBase>();
59
+
60
+
61
+ /// <summary>
62
+ ///
63
+ /// </summary>
64
+ protected virtual void OnEnable()
65
+ {
66
+ inTrialMinigame.SetValue(true);
67
+
68
+ playerHasDied.AddListener(EvaluatePlayerDeath);
69
+
70
+ OnMinigameEnable();
71
+ }
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ protected virtual void OnMinigameEnable()
77
+ {
78
+ if (TrialTimer != null)
79
+ TrialTimer.TimeUp += OnTimeUp;
80
+
81
+ trialMistake.AddListener(EvaluateMistake);
82
+ }
83
+
84
+ /// <summary>
85
+ ///
86
+ /// </summary>
87
+ protected virtual void OnDisable()
88
+ {
89
+ inTrialMinigame.SetValue(false);
90
+
91
+ playerHasDied.RemoveListener(EvaluatePlayerDeath);
92
+
93
+ OnMinigameDisable();
94
+ }
95
+
96
+ /// <summary>
97
+ ///
98
+ /// </summary>
99
+ protected virtual void OnMinigameDisable()
100
+ {
101
+ if (TrialTimer != null)
102
+ TrialTimer.TimeUp -= OnTimeUp;
103
+
104
+ trialMistake.RemoveListener(EvaluateMistake);
105
+ }
106
+
107
+
108
+ /// <summary>
109
+ ///
110
+ /// </summary>
111
+ /// <param name="fuckUpDialogue"></param>
112
+ protected virtual void TrialMistake(DialogueCore fuckUpDialogue)
113
+ {
114
+ trialMistake.SetValue(true);
115
+
116
+ fuckUpDialogue.InvokeDialogue(ServiceLocator.GetService<IDialogueManager>());
117
+ }
118
+
119
+ /// <summary>
120
+ ///
121
+ /// </summary>
122
+ protected virtual void FinishedTrialMistake()
123
+ {
124
+ if (!trialMistake.Value)
125
+ trialMistake.Invoke();
126
+ else
127
+ trialMistake.SetValue(false);
128
+ }
129
+
130
+
131
+ /// <summary>
132
+ ///
133
+ /// </summary>
134
+ protected virtual void OnTimeUp() => trialTimeUp.SetValue(true);
135
+
136
+
137
+ /// <summary>
138
+ ///
139
+ /// </summary>
140
+ /// <param name="playerHasDied"></param>
141
+ protected virtual void EvaluatePlayerDeath(bool playerHasDied)
142
+ {
143
+ if (playerHasDied)
144
+ OnPlayerDeath();
145
+ }
146
+
147
+ /// <summary>
148
+ ///
149
+ /// </summary>
150
+ protected virtual void OnPlayerDeath() => TrialTimer.ResetTimer();
151
+
152
+ /// <summary>
153
+ ///
154
+ /// </summary>
155
+ /// <param name="inMistake"></param>
156
+ protected virtual void EvaluateMistake(bool inMistake)
157
+ {
158
+ if (!inMistake)
159
+ Restart();
160
+ }
161
+
162
+
163
+ /// <summary>
164
+ ///
165
+ /// </summary>
166
+ public virtual IEnumerator ResolveMinigame()
167
+ {
168
+ EndMinigame();
169
+
170
+ yield return new WaitForSeconds(destroyBufferDuration);
171
+
172
+ Destroy(gameObject);
173
+ }
174
+
175
+ /// <summary>
176
+ ///
177
+ /// </summary>
178
+ /// <typeparam name="T2"></typeparam>
179
+ /// <param name="action"></param>
180
+ protected virtual void InvokeComponents<T2>(Action<T2> action)
181
+ {
182
+ var components = GetComponentsInChildren<Component>().OfType<T2>();
183
+
184
+ foreach (var component in components)
185
+ action(component);
186
+ }
187
+
188
+ /// <summary>
189
+ ///
190
+ /// </summary>
191
+ protected abstract void Restart();
192
+
193
+ /// <summary>
194
+ ///
195
+ /// </summary>
196
+ public virtual void EndMinigame() => DialogueEventSystem.TriggerEvent(endMinigameEvent);
197
+ }
198
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 75f9514df0a38a242b4b7382a17da199
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,155 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.UIHandling;
3
+ using System.Collections;
4
+ using TMPro;
5
+ using UnityEngine;
6
+ using UnityEngine.InputSystem;
7
+ using static UnityEngine.InputSystem.InputAction;
8
+
9
+ namespace DREditor.Minigames
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ [ClassHeader("")]
15
+ public class QuestionToggle : MonoBehaviour
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ [Tooltip("")]
21
+ [SerializeField] protected InputActionReference toggleQuestion = null;
22
+
23
+ /// <summary>
24
+ ///
25
+ /// </summary>
26
+ [Tooltip("")]
27
+ [SerializeField] protected UIVisibilityComponent fullUIVisibility = null;
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ [Tooltip("")]
33
+ [SerializeField] protected UIVisibilityComponent questionVisibility = null;
34
+
35
+ /// <summary>
36
+ ///
37
+ /// </summary>
38
+ [Tooltip("")]
39
+ [SerializeField] protected ToggleTextVisibility controlsToggle = null;
40
+
41
+ /// <summary>
42
+ ///
43
+ /// </summary>
44
+ [Tooltip("")]
45
+ [SerializeField] protected TextMeshProUGUI questionText = null;
46
+
47
+ /// <summary>
48
+ ///
49
+ /// </summary>
50
+ [Tooltip("")]
51
+ [SerializeField] protected float toggleWaitTime = 1;
52
+
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ protected bool showing = false;
58
+
59
+
60
+ /// <summary>
61
+ ///
62
+ /// </summary>
63
+ /// <param name="questionText"></param>
64
+ public virtual void Initialize(string questionText)
65
+ {
66
+ SetQuestion(questionText);
67
+
68
+ Activate();
69
+ }
70
+
71
+ /// <summary>
72
+ ///
73
+ /// </summary>
74
+ /// <param name="text"></param>
75
+ public virtual void SetQuestion(string text) => questionText.text = text;
76
+
77
+ /// <summary>
78
+ ///
79
+ /// </summary>
80
+ public virtual void Activate()
81
+ {
82
+ fullUIVisibility.Show();
83
+
84
+ toggleQuestion.action.started += ToggleQuestion;
85
+ }
86
+
87
+ /// <summary>
88
+ ///
89
+ /// </summary>
90
+ public virtual void Deactivate()
91
+ {
92
+ toggleQuestion.action.started -= ToggleQuestion;
93
+
94
+ ResolveVisuals();
95
+ }
96
+
97
+ /// <summary>
98
+ ///
99
+ /// </summary>
100
+ protected virtual void ResolveVisuals()
101
+ {
102
+ if (showing)
103
+ {
104
+ questionVisibility.Hide();
105
+
106
+ controlsToggle.Toggle();
107
+
108
+ showing = !showing;
109
+ }
110
+
111
+ fullUIVisibility.Hide();
112
+ }
113
+
114
+ /// <summary>
115
+ ///
116
+ /// </summary>
117
+ /// <param name="ctx"></param>
118
+ protected virtual void ToggleQuestion(CallbackContext ctx)
119
+ {
120
+ toggleQuestion.action.started -= ToggleQuestion;
121
+
122
+ controlsToggle.Toggle();
123
+
124
+ if (showing)
125
+ questionVisibility.Hide();
126
+ else
127
+ questionVisibility.Show();
128
+
129
+ showing = !showing;
130
+
131
+ StartCoroutine(Wait());
132
+ }
133
+
134
+ /// <summary>
135
+ ///
136
+ /// </summary>
137
+ /// <returns></returns>
138
+ protected virtual IEnumerator Wait()
139
+ {
140
+ yield return new WaitForSecondsRealtime(toggleWaitTime);
141
+
142
+ yield return questionVisibility.WaitForChangeToComplete();
143
+
144
+ toggleQuestion.action.started += ToggleQuestion;
145
+
146
+ yield break;
147
+ }
148
+
149
+ /// <summary>
150
+ ///
151
+ /// </summary>
152
+ protected virtual void OnDestroy()
153
+ => toggleQuestion.action.started -= ToggleQuestion;
154
+ }
155
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 6b632daf8d87f5c44a8e17b468fb7cd1
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,101 @@
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
+
7
+ namespace DREditor.Minigames
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ [ClassHeader("")]
13
+ public class RestoreControlsUIPostDialogue : MonoBehaviour
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ [Tooltip("")]
19
+ [SerializeField] protected StringWithEvent currentControlsKey = null;
20
+
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ [Tooltip("")]
25
+ [SerializeField] protected string scanningKey = "trialdialogue";
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ [ReadOnly]
31
+ [Tooltip("")]
32
+ [SerializeField] protected string originalKey = "";
33
+
34
+
35
+ /// <summary>
36
+ ///
37
+ /// </summary>
38
+ protected IDialogueManager dialogueManager;
39
+
40
+
41
+ protected virtual void OnEnable() => currentControlsKey.AddListener(CheckInitializeKey);
42
+
43
+ protected virtual void OnDisable()
44
+ {
45
+ currentControlsKey.RemoveListener(CheckInitializeKey);
46
+
47
+ dialogueManager?.GetFinisher().UnsubscribeToOnFinishOfDialogue(RestoreKey);
48
+ }
49
+
50
+ /// <summary>
51
+ ///
52
+ /// </summary>
53
+ /// <param name="key"></param>
54
+ protected virtual void CheckInitializeKey(string key)
55
+ {
56
+ if (IsScannedKey(key))
57
+ OnScannedKeyFound();
58
+ else
59
+ InitializeOriginalKey();
60
+ }
61
+
62
+ /// <summary>
63
+ ///
64
+ /// </summary>
65
+ /// <param name="key"></param>
66
+ /// <returns></returns>
67
+ protected virtual bool IsScannedKey(string key) => key == scanningKey;
68
+
69
+ /// <summary>
70
+ ///
71
+ /// </summary>
72
+ protected virtual void OnScannedKeyFound()
73
+ {
74
+ currentControlsKey.RemoveListener(CheckInitializeKey);
75
+
76
+ if (ServiceLocator.HasService(out dialogueManager))
77
+ dialogueManager.GetFinisher().SubscribeToOnFinishOfDialogue(RestoreKey);
78
+ }
79
+
80
+ /// <summary>
81
+ ///
82
+ /// </summary>
83
+ protected virtual void InitializeOriginalKey()
84
+ {
85
+ if (currentControlsKey.Value != scanningKey)
86
+ originalKey = currentControlsKey.Value;
87
+ }
88
+
89
+ /// <summary>
90
+ ///
91
+ /// </summary>
92
+ protected virtual void RestoreKey()
93
+ {
94
+ dialogueManager?.GetFinisher().UnsubscribeToOnFinishOfDialogue(RestoreKey);
95
+
96
+ currentControlsKey.SetValue(originalKey);
97
+
98
+ currentControlsKey.AddListener(CheckInitializeKey);
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 134c7b5389d92a14fbc80606f01394a3