net.dreditor.ui.savingloading 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 (38) hide show
  1. package/.attestation.p7m +0 -0
  2. package/DREditor.UI.SavingLoading.asmdef +22 -22
  3. package/DREditor.UI.SavingLoading.asmdef.meta +7 -7
  4. package/PostSavePoint.cs +57 -57
  5. package/PostSavePoint.cs.meta +11 -11
  6. package/ReturnToMenuOnPauseMenu.cs +113 -113
  7. package/ReturnToMenuOnPauseMenu.cs.meta +11 -11
  8. package/{Samples → Samples~}/DRE_SavePoint.unity +262 -262
  9. package/{Samples → Samples~}/DRE_SavePoint.unity.meta +7 -7
  10. package/{Samples → Samples~}/Save_Point_Canvas_Shell.prefab +169 -169
  11. package/{Samples → Samples~}/Save_Point_Canvas_Shell.prefab.meta +7 -7
  12. package/{Samples → Samples~}/Save_Point_Canvas_Template.prefab +563 -563
  13. package/{Samples → Samples~}/Save_Point_Canvas_Template.prefab.meta +7 -7
  14. package/{Samples → Samples~}/Save_Point_System_Template.prefab +1434 -1434
  15. package/{Samples → Samples~}/Save_Point_System_Template.prefab.meta +7 -7
  16. package/SaveDataDisplayerBase.cs +24 -24
  17. package/SaveDataDisplayerBase.cs.meta +11 -11
  18. package/SaveDateDisplayer.cs +146 -146
  19. package/SaveDateDisplayer.cs.meta +11 -11
  20. package/SaveLoadMenu.cs +298 -298
  21. package/SaveLoadMenu.cs.meta +11 -11
  22. package/SaveLoadMenuBase.cs +122 -122
  23. package/SaveLoadMenuBase.cs.meta +11 -11
  24. package/SavePointUI.cs +239 -239
  25. package/SavePointUI.cs.meta +11 -11
  26. package/SavePointUIBase.cs +134 -134
  27. package/SavePointUIBase.cs.meta +11 -11
  28. package/SavePointUIGameState.cs +120 -120
  29. package/SavePointUIGameState.cs.meta +11 -11
  30. package/SaveSlot.cs +81 -81
  31. package/SaveSlot.cs.meta +11 -11
  32. package/SaveSlotBase.cs +99 -99
  33. package/SaveSlotBase.cs.meta +11 -11
  34. package/SaveTitleDisplayer.cs +204 -204
  35. package/SaveTitleDisplayer.cs.meta +11 -11
  36. package/package.json +46 -41
  37. package/package.json.meta +7 -7
  38. package/Samples.meta +0 -8
package/SaveLoadMenu.cs CHANGED
@@ -1,299 +1,299 @@
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.SaveManaging;
5
- using DREditor.Services;
6
- using System.Collections;
7
- using System.Collections.Generic;
8
- using UnityEngine;
9
- using UnityEngine.Events;
10
- using UnityEngine.EventSystems;
11
- using UnityEngine.Serialization;
12
-
13
- namespace DREditor.UI.SavingLoading
14
- {
15
- /// <summary>
16
- ///
17
- /// </summary>
18
- /// <remarks></remarks>
19
- [DefaultExecutionOrder(1)]
20
- [ClassHeader("")]
21
- public class SaveLoadMenu : SaveLoadMenuBase
22
- {
23
- /// <summary>
24
- ///
25
- /// </summary>
26
- [Divider]
27
- [Tooltip("")]
28
- [SerializeField] protected bool onPauseMenu = false;
29
-
30
- /// <summary>
31
- ///
32
- /// </summary>
33
- [Tooltip("")]
34
- [FormerlySerializedAs("SlotList")]
35
- [SerializeField] protected List<SaveSlotBase> saveSlots = new();
36
-
37
- /// <summary>
38
- ///
39
- /// </summary>
40
- [Tooltip("")]
41
- [SerializeField] protected SelectableMenuGroupBase saveLoadGroup = null;
42
-
43
- /// <summary>
44
- ///
45
- /// </summary>
46
- [Tooltip("")]
47
- [SerializeField] protected MenuGroupBase savePopUp = null;
48
-
49
- /// <summary>
50
- ///
51
- /// </summary>
52
- [Tooltip("")]
53
- [SerializeField] protected MenuGroupBase overwritePopUp = null;
54
-
55
- /// <summary>
56
- ///
57
- /// </summary>
58
- [Tooltip("")]
59
- [SerializeField] protected MenuGroupBase loadPopUp = null;
60
-
61
- /// <summary>
62
- ///
63
- /// </summary>
64
- [Tooltip("")]
65
- [SerializeField] protected ReturnToMenuOnPauseMenu ReturnToMenuPauseHandler = null;
66
-
67
-
68
- [Header("")]
69
- [SerializeField] protected UnityEvent OnSelectedLockedSaveSlot;
70
-
71
-
72
- /// <summary>
73
- ///
74
- /// </summary>
75
- [Header("")]
76
- [Divider]
77
- [Tooltip("")]
78
- [SerializeField] protected string loadGameFileEventString = "LoadGameFile";
79
-
80
- /// <summary>
81
- ///
82
- /// </summary>
83
- [Tooltip("")]
84
- [SerializeField] protected string applyDataEventString = "ApplyCurrentData";
85
-
86
-
87
- /// <summary>
88
- ///
89
- /// </summary>
90
- protected virtual void Start()
91
- {
92
- for (int i = 0; i < saveSlots.Count; i++)
93
- saveSlots[i].SetID(i);
94
- }
95
-
96
- /// <summary>
97
- ///
98
- /// </summary>
99
- protected virtual void OnEnable()
100
- {
101
- SetSubscriptionsToSaveSlots(true);
102
-
103
- SetSubscriptionToPopUps(true);
104
- }
105
-
106
- /// <summary>
107
- ///
108
- /// </summary>
109
- protected virtual void OnDisable()
110
- {
111
- SetSubscriptionsToSaveSlots(false);
112
-
113
- SetSubscriptionToPopUps(false);
114
- }
115
-
116
- /// <summary>
117
- ///
118
- /// </summary>
119
- /// <param name="subscribing"></param>
120
- protected virtual void SetSubscriptionsToSaveSlots(bool subscribing)
121
- {
122
- foreach (var slot in saveSlots)
123
- {
124
- if (subscribing)
125
- {
126
- slot.OnSlotClicked += SetCurrentSaveSlot;
127
-
128
- slot.button.onClick.AddListener(EvaluatePopUp);
129
- }
130
- else
131
- {
132
- slot.OnSlotClicked -= SetCurrentSaveSlot;
133
-
134
- slot.button.onClick.RemoveListener(EvaluatePopUp);
135
- }
136
- }
137
- }
138
-
139
- /// <summary>
140
- ///
141
- /// </summary>
142
- /// <param name="subscribing"></param>
143
- protected virtual void SetSubscriptionToPopUps(bool subscribing)
144
- {
145
- SelectSlotOnPopUpEnd(savePopUp, subscribing);
146
-
147
- SelectSlotOnPopUpEnd(overwritePopUp, subscribing);
148
-
149
- SelectSlotOnPopUpEnd(loadPopUp, subscribing);
150
- }
151
-
152
- /// <summary>
153
- ///
154
- /// </summary>
155
- /// <param name="popUp"></param>
156
- /// <param name="subscribing"></param>
157
- protected virtual void SelectSlotOnPopUpEnd(MenuGroupBase popUp, bool subscribing)
158
- {
159
- if (popUp == null)
160
- return;
161
-
162
- if (subscribing)
163
- popUp.EndEvents.AddListener(SelectSlot);
164
- else
165
- popUp.EndEvents.RemoveListener(SelectSlot);
166
- }
167
-
168
- /// <summary>
169
- ///
170
- /// </summary>
171
- /// <param name="currentSlot"></param>
172
- protected virtual void SetCurrentSaveSlot(SaveSlotBase currentSlot) => base.currentSlot = currentSlot;
173
-
174
- /// <summary>
175
- ///
176
- /// </summary>
177
- protected virtual void EvaluatePopUp()
178
- {
179
- saveLoadGroup.SetLastSelected(currentSlot.gameObject);
180
-
181
- if (saveMode)
182
- {
183
- saveLoadGroup.RemoveBackInput();
184
-
185
- if (currentSlot.HasSaveData())
186
- overwritePopUp.Show();
187
- else
188
- savePopUp.Show();
189
- }
190
- else if (currentSlot.HasSaveData())
191
- {
192
- saveLoadGroup.RemoveBackInput();
193
-
194
- loadPopUp.Show();
195
- }
196
- else
197
- OnSelectedLockedSaveSlot?.Invoke();
198
- }
199
-
200
- /// <summary>
201
- ///
202
- /// </summary>
203
- protected virtual void SelectSlot()
204
- {
205
- EventSystem.current.SetSelectedGameObject(currentSlot.gameObject);
206
-
207
- ServiceLocator.GetService<UIHandlerBase>().SetCurrent(currentSlot.gameObject);
208
- }
209
-
210
-
211
- /// <inheritdoc/>
212
- public override void LoadCurrentSlot()
213
- {
214
- ServiceLocator.GetService<IDialogueManager>().GetManagerComponent<DialogueDataClearer>().ClearSaveData();
215
-
216
- DialogueEventSystem.TriggerEvent(loadGameFileEventString, saveFilePreText + currentSlot.GetID());
217
-
218
- if (onPauseMenu)
219
- MoveToMenuOnFileSelected();
220
- else // On the Main Menu Screen
221
- DialogueEventSystem.TriggerEvent(applyDataEventString);
222
- }
223
-
224
- /// <summary>
225
- ///
226
- /// </summary>
227
- protected virtual void MoveToMenuOnFileSelected()
228
- {
229
- ServiceLocator.GetService<MenuState>().SetSelect(false);
230
-
231
- loadPopUp.Hide();
232
-
233
- loadPopUp.RemoveBackInput();
234
-
235
- EventSystem.current.SetSelectedGameObject(null);
236
-
237
- saveLoadGroup.SetLastSelected(currentSlot.gameObject);
238
-
239
- saveLoadGroup.RemoveBackInput();
240
-
241
- StartCoroutine(ReturnToMenuPauseHandler.FadeToMenu());
242
- }
243
-
244
-
245
- /// <summary>
246
- ///
247
- /// </summary>
248
- protected override void LoadSlotsUI()
249
- {
250
- if (useCoroutineFileLoading)
251
- StartCoroutine(LoadSlotProcess());
252
- else
253
- PopulateSlotsUI();
254
- }
255
-
256
- /// <summary>
257
- ///
258
- /// </summary>
259
- protected virtual IEnumerator LoadSlotProcess()
260
- {
261
- for (int i = 0; i < saveSlots.Count; i++)
262
- if (SaveSystem.SaveFileExists(saveFilePreText + i))
263
- yield return FoundSaveRoutine(saveSlots[i]);
264
- else
265
- saveSlots[i].OnSaveNotFound();
266
-
267
- yield break;
268
- }
269
-
270
- /// <summary>
271
- ///
272
- /// </summary>
273
- /// <param name="slot"></param>
274
- /// <remarks></remarks>
275
- protected virtual IEnumerator FoundSaveRoutine(SaveSlotBase slot)
276
- {
277
- slot.OnSaveFound();
278
-
279
- yield return null;
280
-
281
- yield return null;
282
-
283
- yield break;
284
- }
285
-
286
-
287
- /// <summary>
288
- ///
289
- /// </summary>
290
- protected virtual void PopulateSlotsUI()
291
- {
292
- for (int i = 0; i < saveSlots.Count; i++)
293
- if (SaveSystem.SaveFileExists(saveFilePreText + i))
294
- saveSlots[i].OnSaveFound();
295
- else
296
- saveSlots[i].OnSaveNotFound();
297
- }
298
- }
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.SaveManaging;
5
+ using DREditor.Services;
6
+ using System.Collections;
7
+ using System.Collections.Generic;
8
+ using UnityEngine;
9
+ using UnityEngine.Events;
10
+ using UnityEngine.EventSystems;
11
+ using UnityEngine.Serialization;
12
+
13
+ namespace DREditor.UI.SavingLoading
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ /// <remarks></remarks>
19
+ [DefaultExecutionOrder(1)]
20
+ [ClassHeader("")]
21
+ public class SaveLoadMenu : SaveLoadMenuBase
22
+ {
23
+ /// <summary>
24
+ ///
25
+ /// </summary>
26
+ [Divider]
27
+ [Tooltip("")]
28
+ [SerializeField] protected bool onPauseMenu = false;
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ [Tooltip("")]
34
+ [FormerlySerializedAs("SlotList")]
35
+ [SerializeField] protected List<SaveSlotBase> saveSlots = new();
36
+
37
+ /// <summary>
38
+ ///
39
+ /// </summary>
40
+ [Tooltip("")]
41
+ [SerializeField] protected SelectableMenuGroupBase saveLoadGroup = null;
42
+
43
+ /// <summary>
44
+ ///
45
+ /// </summary>
46
+ [Tooltip("")]
47
+ [SerializeField] protected MenuGroupBase savePopUp = null;
48
+
49
+ /// <summary>
50
+ ///
51
+ /// </summary>
52
+ [Tooltip("")]
53
+ [SerializeField] protected MenuGroupBase overwritePopUp = null;
54
+
55
+ /// <summary>
56
+ ///
57
+ /// </summary>
58
+ [Tooltip("")]
59
+ [SerializeField] protected MenuGroupBase loadPopUp = null;
60
+
61
+ /// <summary>
62
+ ///
63
+ /// </summary>
64
+ [Tooltip("")]
65
+ [SerializeField] protected ReturnToMenuOnPauseMenu ReturnToMenuPauseHandler = null;
66
+
67
+
68
+ [Header("")]
69
+ [SerializeField] protected UnityEvent OnSelectedLockedSaveSlot;
70
+
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ [Header("")]
76
+ [Divider]
77
+ [Tooltip("")]
78
+ [SerializeField] protected string loadGameFileEventString = "LoadGameFile";
79
+
80
+ /// <summary>
81
+ ///
82
+ /// </summary>
83
+ [Tooltip("")]
84
+ [SerializeField] protected string applyDataEventString = "ApplyCurrentData";
85
+
86
+
87
+ /// <summary>
88
+ ///
89
+ /// </summary>
90
+ protected virtual void Start()
91
+ {
92
+ for (int i = 0; i < saveSlots.Count; i++)
93
+ saveSlots[i].SetID(i);
94
+ }
95
+
96
+ /// <summary>
97
+ ///
98
+ /// </summary>
99
+ protected virtual void OnEnable()
100
+ {
101
+ SetSubscriptionsToSaveSlots(true);
102
+
103
+ SetSubscriptionToPopUps(true);
104
+ }
105
+
106
+ /// <summary>
107
+ ///
108
+ /// </summary>
109
+ protected virtual void OnDisable()
110
+ {
111
+ SetSubscriptionsToSaveSlots(false);
112
+
113
+ SetSubscriptionToPopUps(false);
114
+ }
115
+
116
+ /// <summary>
117
+ ///
118
+ /// </summary>
119
+ /// <param name="subscribing"></param>
120
+ protected virtual void SetSubscriptionsToSaveSlots(bool subscribing)
121
+ {
122
+ foreach (var slot in saveSlots)
123
+ {
124
+ if (subscribing)
125
+ {
126
+ slot.OnSlotClicked += SetCurrentSaveSlot;
127
+
128
+ slot.button.onClick.AddListener(EvaluatePopUp);
129
+ }
130
+ else
131
+ {
132
+ slot.OnSlotClicked -= SetCurrentSaveSlot;
133
+
134
+ slot.button.onClick.RemoveListener(EvaluatePopUp);
135
+ }
136
+ }
137
+ }
138
+
139
+ /// <summary>
140
+ ///
141
+ /// </summary>
142
+ /// <param name="subscribing"></param>
143
+ protected virtual void SetSubscriptionToPopUps(bool subscribing)
144
+ {
145
+ SelectSlotOnPopUpEnd(savePopUp, subscribing);
146
+
147
+ SelectSlotOnPopUpEnd(overwritePopUp, subscribing);
148
+
149
+ SelectSlotOnPopUpEnd(loadPopUp, subscribing);
150
+ }
151
+
152
+ /// <summary>
153
+ ///
154
+ /// </summary>
155
+ /// <param name="popUp"></param>
156
+ /// <param name="subscribing"></param>
157
+ protected virtual void SelectSlotOnPopUpEnd(MenuGroupBase popUp, bool subscribing)
158
+ {
159
+ if (popUp == null)
160
+ return;
161
+
162
+ if (subscribing)
163
+ popUp.EndEvents.AddListener(SelectSlot);
164
+ else
165
+ popUp.EndEvents.RemoveListener(SelectSlot);
166
+ }
167
+
168
+ /// <summary>
169
+ ///
170
+ /// </summary>
171
+ /// <param name="currentSlot"></param>
172
+ protected virtual void SetCurrentSaveSlot(SaveSlotBase currentSlot) => base.currentSlot = currentSlot;
173
+
174
+ /// <summary>
175
+ ///
176
+ /// </summary>
177
+ protected virtual void EvaluatePopUp()
178
+ {
179
+ saveLoadGroup.SetLastSelected(currentSlot.gameObject);
180
+
181
+ if (saveMode)
182
+ {
183
+ saveLoadGroup.RemoveBackInput();
184
+
185
+ if (currentSlot.HasSaveData())
186
+ overwritePopUp.Show();
187
+ else
188
+ savePopUp.Show();
189
+ }
190
+ else if (currentSlot.HasSaveData())
191
+ {
192
+ saveLoadGroup.RemoveBackInput();
193
+
194
+ loadPopUp.Show();
195
+ }
196
+ else
197
+ OnSelectedLockedSaveSlot?.Invoke();
198
+ }
199
+
200
+ /// <summary>
201
+ ///
202
+ /// </summary>
203
+ protected virtual void SelectSlot()
204
+ {
205
+ EventSystem.current.SetSelectedGameObject(currentSlot.gameObject);
206
+
207
+ ServiceLocator.GetService<UIHandlerBase>().SetCurrent(currentSlot.gameObject);
208
+ }
209
+
210
+
211
+ /// <inheritdoc/>
212
+ public override void LoadCurrentSlot()
213
+ {
214
+ ServiceLocator.GetService<IDialogueManager>().GetManagerComponent<DialogueDataClearer>().ClearSaveData();
215
+
216
+ DialogueEventSystem.TriggerEvent(loadGameFileEventString, saveFilePreText + currentSlot.GetID());
217
+
218
+ if (onPauseMenu)
219
+ MoveToMenuOnFileSelected();
220
+ else // On the Main Menu Screen
221
+ DialogueEventSystem.TriggerEvent(applyDataEventString);
222
+ }
223
+
224
+ /// <summary>
225
+ ///
226
+ /// </summary>
227
+ protected virtual void MoveToMenuOnFileSelected()
228
+ {
229
+ ServiceLocator.GetService<MenuState>().SetSelect(false);
230
+
231
+ loadPopUp.Hide();
232
+
233
+ loadPopUp.RemoveBackInput();
234
+
235
+ EventSystem.current.SetSelectedGameObject(null);
236
+
237
+ saveLoadGroup.SetLastSelected(currentSlot.gameObject);
238
+
239
+ saveLoadGroup.RemoveBackInput();
240
+
241
+ StartCoroutine(ReturnToMenuPauseHandler.FadeToMenu());
242
+ }
243
+
244
+
245
+ /// <summary>
246
+ ///
247
+ /// </summary>
248
+ protected override void LoadSlotsUI()
249
+ {
250
+ if (useCoroutineFileLoading)
251
+ StartCoroutine(LoadSlotProcess());
252
+ else
253
+ PopulateSlotsUI();
254
+ }
255
+
256
+ /// <summary>
257
+ ///
258
+ /// </summary>
259
+ protected virtual IEnumerator LoadSlotProcess()
260
+ {
261
+ for (int i = 0; i < saveSlots.Count; i++)
262
+ if (SaveSystem.SaveFileExists(saveFilePreText + i))
263
+ yield return FoundSaveRoutine(saveSlots[i]);
264
+ else
265
+ saveSlots[i].OnSaveNotFound();
266
+
267
+ yield break;
268
+ }
269
+
270
+ /// <summary>
271
+ ///
272
+ /// </summary>
273
+ /// <param name="slot"></param>
274
+ /// <remarks></remarks>
275
+ protected virtual IEnumerator FoundSaveRoutine(SaveSlotBase slot)
276
+ {
277
+ slot.OnSaveFound();
278
+
279
+ yield return null;
280
+
281
+ yield return null;
282
+
283
+ yield break;
284
+ }
285
+
286
+
287
+ /// <summary>
288
+ ///
289
+ /// </summary>
290
+ protected virtual void PopulateSlotsUI()
291
+ {
292
+ for (int i = 0; i < saveSlots.Count; i++)
293
+ if (SaveSystem.SaveFileExists(saveFilePreText + i))
294
+ saveSlots[i].OnSaveFound();
295
+ else
296
+ saveSlots[i].OnSaveNotFound();
297
+ }
298
+ }
299
299
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: b886bc40e4418b04ba478eebf45a7493
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: b886bc40e4418b04ba478eebf45a7493
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: