net.dreditor.ui.savingloading 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 (38) hide show
  1. package/.attestation.p7m +0 -0
  2. package/DREditor.UI.SavingLoading.asmdef +23 -0
  3. package/DREditor.UI.SavingLoading.asmdef.meta +7 -0
  4. package/PostSavePoint.cs +58 -0
  5. package/PostSavePoint.cs.meta +11 -0
  6. package/ReturnToMenuOnPauseMenu.cs +114 -0
  7. package/ReturnToMenuOnPauseMenu.cs.meta +11 -0
  8. package/Samples~/DRE_SavePoint.unity +262 -0
  9. package/Samples~/DRE_SavePoint.unity.meta +7 -0
  10. package/Samples~/Save_Point_Canvas_Shell.prefab +169 -0
  11. package/Samples~/Save_Point_Canvas_Shell.prefab.meta +7 -0
  12. package/Samples~/Save_Point_Canvas_Template.prefab +563 -0
  13. package/Samples~/Save_Point_Canvas_Template.prefab.meta +7 -0
  14. package/Samples~/Save_Point_System_Template.prefab +1434 -0
  15. package/Samples~/Save_Point_System_Template.prefab.meta +7 -0
  16. package/SaveDataDisplayerBase.cs +25 -0
  17. package/SaveDataDisplayerBase.cs.meta +11 -0
  18. package/SaveDateDisplayer.cs +147 -0
  19. package/SaveDateDisplayer.cs.meta +11 -0
  20. package/SaveLoadMenu.cs +299 -0
  21. package/SaveLoadMenu.cs.meta +11 -0
  22. package/SaveLoadMenuBase.cs +123 -0
  23. package/SaveLoadMenuBase.cs.meta +11 -0
  24. package/SavePointUI.cs +240 -0
  25. package/SavePointUI.cs.meta +11 -0
  26. package/SavePointUIBase.cs +135 -0
  27. package/SavePointUIBase.cs.meta +11 -0
  28. package/SavePointUIGameState.cs +121 -0
  29. package/SavePointUIGameState.cs.meta +11 -0
  30. package/SaveSlot.cs +82 -0
  31. package/SaveSlot.cs.meta +11 -0
  32. package/SaveSlotBase.cs +100 -0
  33. package/SaveSlotBase.cs.meta +11 -0
  34. package/SaveTitleDisplayer.cs +205 -0
  35. package/SaveTitleDisplayer.cs.meta +11 -0
  36. package/package.json +44 -4
  37. package/package.json.meta +7 -0
  38. package/README.md +0 -3
package/SavePointUI.cs ADDED
@@ -0,0 +1,240 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues.Events;
3
+ using DREditor.EventObjects;
4
+ using DREditor.Fading;
5
+ using DREditor.RoomLoading;
6
+ using DREditor.Services;
7
+ using System.Collections;
8
+ using System.Collections.Generic;
9
+ using System.Linq;
10
+ using UnityEngine;
11
+ using UnityEngine.SceneManagement;
12
+
13
+ namespace DREditor.UI.SavingLoading
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ [ClassHeader(nameof(SavePointUIBase) + ", " + nameof(SceneEventListener) +
19
+ "\n\n")]
20
+ public class SavePointUI : SavePointUIBase
21
+ {
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Tooltip("")]
26
+ [SerializeField] protected BoolWithEvent inTrialMode = null;
27
+
28
+ /// <summary>
29
+ ///
30
+ /// </summary>
31
+ [Tooltip("")]
32
+ [SerializeField] protected BoolWithEvent requiredFlagsTriggered = null;
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ [SerializeField] protected BoolWithEvent inDialogue = null;
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ [Tooltip("")]
44
+ [SerializeField] protected BoolWithEvent playHideDialogueSFX = null;
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ [Tooltip("")]
50
+ [SerializeField] protected BoolWithEvent threeDUIVisible = null;
51
+
52
+ /// <summary>
53
+ ///
54
+ /// </summary>
55
+ [Tooltip("")]
56
+ [SerializeField] protected BoolWithEvent hasMenuAccess = null;
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ [Tooltip("")]
62
+ [SerializeField] protected BoolWithEvent inLeaveProcess = null;
63
+
64
+
65
+ /// <summary>
66
+ ///
67
+ /// </summary>
68
+ [Header("")]
69
+ [Divider]
70
+ [Tooltip("")]
71
+ [SerializeField] protected SceneEvent moveToNextNaturalObjective = null;
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ [Tooltip("")]
77
+ [SerializeField] protected StringWithEvent currentObjectiveName = null;
78
+
79
+ /// <summary>
80
+ ///
81
+ /// </summary>
82
+ [Tooltip("")]
83
+ [SerializeField] protected IntWithEvent currentAddState = null;
84
+
85
+
86
+ /// <summary>
87
+ ///
88
+ /// </summary>
89
+ [Header("")]
90
+ [Divider]
91
+ [Tooltip("")]
92
+ [SerializeField] protected float delayLoadPointDuration = 0;
93
+
94
+ /// <summary>
95
+ ///
96
+ /// </summary>
97
+ [Tooltip("")]
98
+ [SerializeField] protected float fadeToPointDuration = 0;
99
+
100
+
101
+ /// <summary>
102
+ ///
103
+ /// </summary>
104
+ [Header("")]
105
+ [Divider]
106
+ [Tooltip("")]
107
+ [SerializeField] protected PostSavePoint[] savePoints;
108
+
109
+
110
+ /// <summary>
111
+ ///
112
+ /// </summary>
113
+ protected readonly Dictionary<string, string> scenePoints = new();
114
+
115
+
116
+ protected virtual void Awake() => InitializeSavePointDictionary();
117
+
118
+ /// <inheritdoc/>
119
+ protected override void OnEnable()
120
+ {
121
+ base.OnEnable();
122
+
123
+ hasMenuAccess.SetValue(false);
124
+ }
125
+
126
+ /// <summary>
127
+ ///
128
+ /// </summary>
129
+ protected virtual void InitializeSavePointDictionary()
130
+ {
131
+ foreach (PostSavePoint savePoint in savePoints)
132
+ scenePoints.TryAdd(savePoint.objective, savePoint.scene);
133
+ }
134
+
135
+
136
+ /// <inheritdoc/>
137
+ protected override void ShowSavePointUI()
138
+ {
139
+ if (inDialogue.Value)
140
+ StartCoroutine(WaitForDialogueToFinish());
141
+ else
142
+ base.ShowSavePointUI();
143
+ }
144
+
145
+ /// <summary>
146
+ ///
147
+ /// </summary>
148
+ protected virtual IEnumerator WaitForDialogueToFinish()
149
+ {
150
+ playHideDialogueSFX.SetValue(false);
151
+
152
+ yield return new WaitUntil(() => !inDialogue.Value);
153
+
154
+ playHideDialogueSFX.SetValue(true);
155
+
156
+ threeDUIVisible.SetValue(false);
157
+
158
+ savePointGroup.Show();
159
+ }
160
+
161
+
162
+ /// <inheritdoc/>
163
+ protected override void StartSavePointTransition() => StartCoroutine(BufferLoadSavePoint());
164
+
165
+ /// <summary>
166
+ ///
167
+ /// </summary>
168
+ protected virtual IEnumerator BufferLoadSavePoint()
169
+ {
170
+ yield return new WaitForSeconds(delayLoadPointDuration);
171
+
172
+ if (ServiceLocator.HasService<GlobalFade>())
173
+ ServiceLocator.GetService<GlobalFade>().FadeTo(fadeToPointDuration);
174
+
175
+ ExecuteValidSavePoint();
176
+ }
177
+
178
+ /// <inheritdoc/>
179
+ protected override bool SavePointIsValid() => scenePoints.ContainsKey(currentObjectiveName.Value);
180
+
181
+ /// <inheritdoc/>
182
+ protected override void LoadSavePoint()
183
+ {
184
+ if (SceneManager.GetActiveScene().name == scenePoints[currentObjectiveName.Value])
185
+ return;
186
+
187
+ string savePointObjective = currentObjectiveName.Value;
188
+
189
+ ExecuteSavePointSettings();
190
+
191
+ LoadScene(scenePoints[savePointObjective]);
192
+ }
193
+
194
+ /// <summary>
195
+ ///
196
+ /// </summary>
197
+ protected virtual void ExecuteSavePointSettings()
198
+ {
199
+ PostSavePoint savePoint = savePoints.Where(n => n.objective == currentObjectiveName.Value).FirstOrDefault();
200
+
201
+ if (savePoint == null)
202
+ return;
203
+
204
+ if (inTrialMode.Value)
205
+ savePoint.mode.SetValue(true);
206
+
207
+ if (savePoint.changeObjective && requiredFlagsTriggered.Value)
208
+ moveToNextNaturalObjective.Raise();
209
+
210
+ if (savePoint.dialogueEvent != "")
211
+ DialogueEventSystem.TriggerEvent(savePoint.dialogueEvent);
212
+
213
+ if (savePoint.roomLoadingOptions != null)
214
+ ServiceLocator.GetService<RoomChangerBase>().SetOptions(savePoint.roomLoadingOptions);
215
+
216
+ currentAddState.SetValue(savePoint.addstate);
217
+
218
+ inLeaveProcess.SetValue(true);
219
+
220
+ hasMenuAccess.SetValue(true);
221
+ }
222
+
223
+ /// <summary>
224
+ ///
225
+ /// </summary>
226
+ /// <param name="scene"></param>
227
+ protected virtual void LoadScene(string scene)
228
+ {
229
+ if (SceneManager.GetActiveScene().name == scene)
230
+ return;
231
+
232
+ UnityEngine.Debug.LogWarning("REPORT: CHANGING SCENE.");
233
+
234
+ if (!isLoadingFile.Value)
235
+ ServiceLocator.GetService<GlobalFade>().FadeTo(fadeToPointDuration);
236
+
237
+ SceneManager.LoadSceneAsync(scene);
238
+ }
239
+ }
240
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9ede2860c4bd625448391b27d3dc7f5a
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,135 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using DREditor.Services;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.UI.SavingLoading
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public abstract class SavePointUIBase : SceneEventListener
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [Tooltip("")]
17
+ [SerializeField] protected bool roomIsSavePoint = false;
18
+
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ [Tooltip("")]
23
+ [SerializeField] protected MenuGroupBase savePointGroup = null;
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ [Tooltip("")]
29
+ [SerializeField] protected SaveLoadMenuBase saveLoadMenu = null;
30
+
31
+ /// <summary>
32
+ ///
33
+ /// </summary>
34
+ [Tooltip("")]
35
+ [SerializeField] protected ReturnToMenuHandler returnToMenuHandler = null;
36
+
37
+
38
+ /// <summary>
39
+ ///
40
+ /// </summary>
41
+ [Header("")]
42
+ [Divider]
43
+ [Tooltip("")]
44
+ [SerializeField] protected BoolWithEvent isLoadingFile = null;
45
+
46
+
47
+ /// <summary>
48
+ ///
49
+ /// </summary>
50
+ protected bool hasLeaveAbility = false;
51
+
52
+
53
+ /// <inheritdoc/>
54
+ protected override void OnEnable()
55
+ {
56
+ base.OnEnable();
57
+
58
+ if (isLoadingFile.Value)
59
+ Response.AddListener(StartSavePointTransition);
60
+ else if (savePointGroup != null)
61
+ Response.AddListener(ShowSavePointUI);
62
+
63
+ if (!roomIsSavePoint && saveLoadMenu != null)
64
+ saveLoadMenu.AddOnSaveListener(MoveToSavePointOnBack);
65
+ }
66
+
67
+ /// <inheritdoc/>
68
+ protected override void OnDisable()
69
+ {
70
+ base.OnDisable();
71
+
72
+ Response.RemoveListener(ShowSavePointUI);
73
+
74
+ Response.RemoveListener(StartSavePointTransition);
75
+
76
+ if (!roomIsSavePoint && saveLoadMenu != null)
77
+ saveLoadMenu.RemoveOnSaveListener(MoveToSavePointOnBack);
78
+
79
+ if (hasLeaveAbility && saveLoadMenu != null)
80
+ saveLoadMenu.GetComponentInChildren<MenuGroupBase>().OnBack.RemoveAllListeners();
81
+ }
82
+
83
+
84
+ /// <summary>
85
+ ///
86
+ /// </summary>
87
+ public virtual void ExecuteValidSavePoint()
88
+ {
89
+ if (SavePointIsValid())
90
+ LoadSavePoint();
91
+ else if (roomIsSavePoint)
92
+ return;
93
+ else
94
+ returnToMenuHandler.ReturnToMenu();
95
+ }
96
+
97
+ /// <summary>
98
+ ///
99
+ /// </summary>
100
+ /// <returns></returns>
101
+ protected abstract bool SavePointIsValid();
102
+
103
+ /// <summary>
104
+ ///
105
+ /// </summary>
106
+ protected abstract void LoadSavePoint();
107
+
108
+ /// <summary>
109
+ ///
110
+ /// </summary>
111
+ protected virtual void ShowSavePointUI() => savePointGroup.Show();
112
+
113
+ /// <summary>
114
+ ///
115
+ /// </summary>
116
+ protected abstract void StartSavePointTransition();
117
+
118
+ /// <summary>
119
+ ///
120
+ /// </summary>
121
+ protected virtual void MoveToSavePointOnBack()
122
+ {
123
+ if (!hasLeaveAbility)
124
+ {
125
+ hasLeaveAbility = true;
126
+
127
+ MenuGroupBase menuGroup = saveLoadMenu.GetComponentInChildren<MenuGroupBase>();
128
+
129
+ menuGroup.OnBack.AddListener(menuGroup.Hide);
130
+
131
+ menuGroup.OnBack.AddListener(StartSavePointTransition);
132
+ }
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0b42b8b825442724782f0a15abf71fd2
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,121 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using UnityEngine;
4
+
5
+ namespace DREditor.UI.SavingLoading
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ [ClassHeader(nameof(SceneEventListener) + ": Should listen to OnFinishedLoadingRoom." +
11
+ "\n\n")]
12
+ public class SavePointUIGameState : SceneEventListener
13
+ {
14
+ /// <summary>
15
+ ///
16
+ /// </summary>
17
+ [Header("")]
18
+ [Divider]
19
+ [Tooltip("")]
20
+ [SerializeField] protected BoolWithEvent isLoadingFile = null;
21
+
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Tooltip("")]
26
+ [SerializeField] protected BoolWithEvent controlsMenuForceDisable = null;
27
+
28
+ /// <summary>
29
+ ///
30
+ /// </summary>
31
+ [Tooltip("")]
32
+ [SerializeField] protected BoolWithEvent skipActivateControls = null;
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ [SerializeField] protected BoolWithEvent onLastObjective = null;
39
+
40
+
41
+ /// <summary>
42
+ ///
43
+ /// </summary>
44
+ [Header("")]
45
+ [Divider]
46
+ [Tooltip("")]
47
+ [SerializeField] protected BoolWithEvent inTrialMode = null;
48
+
49
+ /// <summary>
50
+ ///
51
+ /// </summary>
52
+ [Divider]
53
+
54
+ [Tooltip("")]
55
+ [SerializeField] protected IntWithEvent currentAddState = null;
56
+
57
+ /// <summary>
58
+ ///
59
+ /// </summary>
60
+ [Tooltip("")]
61
+ [SerializeField] protected int endChapterStateIndex = 4;
62
+
63
+
64
+ /// <summary>
65
+ ///
66
+ /// </summary>
67
+ protected virtual void Awake() => InitializeEndOfChapter();
68
+
69
+ /// <summary>
70
+ ///
71
+ /// </summary>
72
+ protected virtual void InitializeEndOfChapter()
73
+ {
74
+ if (currentAddState != null && onLastObjective.Value)
75
+ currentAddState.SetValue(endChapterStateIndex);
76
+ }
77
+
78
+
79
+ /// <inheritdoc/>
80
+ protected override void OnEnable()
81
+ {
82
+ base.OnEnable();
83
+
84
+ controlsMenuForceDisable.SetValue(true);
85
+
86
+ if (!isLoadingFile.Value)
87
+ RemoveControls();
88
+ }
89
+
90
+ /// <inheritdoc/>
91
+ protected override void OnDisable()
92
+ {
93
+ base.OnDisable();
94
+
95
+ controlsMenuForceDisable.SetValue(false);
96
+
97
+ AddControls();
98
+ }
99
+
100
+
101
+ /// <inheritdoc/>
102
+ public override void OnEventRaised()
103
+ {
104
+ base.OnEventRaised();
105
+
106
+ if (!isLoadingFile.Value)
107
+ AddControls();
108
+ }
109
+
110
+
111
+ /// <summary>
112
+ ///
113
+ /// </summary>
114
+ protected virtual void RemoveControls() => skipActivateControls.SetValue(true);
115
+
116
+ /// <summary>
117
+ ///
118
+ /// </summary>
119
+ protected virtual void AddControls() => skipActivateControls.SetValue(false);
120
+ }
121
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d5410115d46c95a4fa0c5ca40e55728e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/SaveSlot.cs ADDED
@@ -0,0 +1,82 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues.Events;
3
+ using System.Collections.Generic;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.UI.SavingLoading
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ /// <remarks></remarks>
12
+ [ClassHeader(nameof(SaveSlotBase) +
13
+ "\n\n")]
14
+ public class SaveSlot : SaveSlotBase
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ [Tooltip("")]
20
+ [SerializeField] protected string saveFilePreText = "save";
21
+
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Tooltip("")]
26
+ [SerializeField] protected string saveFileFoundEvent = "OnSaveFileFound";
27
+
28
+ /// <summary>
29
+ ///
30
+ /// </summary>
31
+ [Tooltip("")]
32
+ [SerializeField] protected string requestSaveFileEvent = "RequestSaveFile";
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ [SerializeField] protected List<SaveDataDisplayerBase> displayers = new();
39
+
40
+
41
+ /// <summary>
42
+ ///
43
+ /// </summary>
44
+ protected Dictionary<string, object> saveDatas;
45
+
46
+
47
+ /// <inheritdoc/>
48
+ public override void OnSaveFound()
49
+ {
50
+ hasSaveData = true;
51
+
52
+ DialogueEventSystem.StartListening(saveFileFoundEvent, LoadSaveFileSlotUI);
53
+
54
+ DialogueEventSystem.TriggerEvent(requestSaveFileEvent, saveFilePreText + id);
55
+ }
56
+
57
+ /// <inheritdoc/>
58
+ public override void OnSaveNotFound()
59
+ {
60
+ foreach (var displayer in displayers)
61
+ if (displayer != null)
62
+ displayer.OnSaveNotFound(id);
63
+ }
64
+
65
+ /// <summary>
66
+ ///
67
+ /// </summary>
68
+ /// <param name="o"></param>
69
+ protected virtual void LoadSaveFileSlotUI(object o = null)
70
+ {
71
+ DialogueEventSystem.StopListening(saveFileFoundEvent, LoadSaveFileSlotUI);
72
+
73
+ saveDatas = (Dictionary<string, object>)o;
74
+
75
+ foreach (var displayer in displayers)
76
+ if (displayer != null)
77
+ displayer.Display(saveDatas, id);
78
+
79
+ saveDatas = null;
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 813e018df08d91a4fa56ed40e821f03e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: