net.dreditor.ui.savingloading 0.0.0-stage → 0.1.6

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/DREditor.UI.SavingLoading.asmdef +23 -0
  2. package/DREditor.UI.SavingLoading.asmdef.meta +7 -0
  3. package/PostSavePoint.cs +58 -0
  4. package/PostSavePoint.cs.meta +11 -0
  5. package/ReturnToMenuOnPauseMenu.cs +114 -0
  6. package/ReturnToMenuOnPauseMenu.cs.meta +11 -0
  7. package/Samples/DRE_SavePoint.unity +262 -0
  8. package/Samples/DRE_SavePoint.unity.meta +7 -0
  9. package/Samples/Save_Point_Canvas_Shell.prefab +169 -0
  10. package/Samples/Save_Point_Canvas_Shell.prefab.meta +7 -0
  11. package/Samples/Save_Point_Canvas_Template.prefab +563 -0
  12. package/Samples/Save_Point_Canvas_Template.prefab.meta +7 -0
  13. package/Samples/Save_Point_System_Template.prefab +1434 -0
  14. package/Samples/Save_Point_System_Template.prefab.meta +7 -0
  15. package/Samples.meta +8 -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 +41 -6
  37. package/package.json.meta +7 -0
  38. package/README.md +0 -3
@@ -0,0 +1,100 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using System;
3
+ using UnityEngine;
4
+ using UnityEngine.UI;
5
+
6
+ namespace DREditor.UI.SavingLoading
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public abstract class SaveSlotBase : MonoBehaviour
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [HideInInspector]
17
+ public Button button = null;
18
+
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ public event Action<SaveSlotBase> OnSlotClicked;
23
+
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ protected int id = -1;
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ protected bool hasSaveData = false;
34
+
35
+
36
+ /// <summary>
37
+ ///
38
+ /// </summary>
39
+ protected virtual void Awake() => InitializeButton();
40
+
41
+ /// <summary>
42
+ ///
43
+ /// </summary>
44
+ protected virtual void InitializeButton()
45
+ {
46
+ if (!TryGetComponent(out button))
47
+ button = GetComponentInChildren<Button>();
48
+
49
+ if (button == null)
50
+ UnityEngine.Debug.LogError("The button for a save slot couldn't be initialized! Please ensure a button is either on " +
51
+ "or a child of the save slot!");
52
+ }
53
+
54
+
55
+ /// <summary>
56
+ ///
57
+ /// </summary>
58
+ protected virtual void OnEnable() => button.onClick.AddListener(InvokeSlotClicked);
59
+
60
+ /// <summary>
61
+ ///
62
+ /// </summary>
63
+ protected virtual void OnDisable() => button.onClick.RemoveListener(InvokeSlotClicked);
64
+
65
+ /// <summary>
66
+ ///
67
+ /// </summary>
68
+ protected virtual void InvokeSlotClicked() => OnSlotClicked?.Invoke(this);
69
+
70
+
71
+ /// <summary>
72
+ ///
73
+ /// </summary>
74
+ /// <param name="id"></param>
75
+ public virtual void SetID(int id) => this.id = id;
76
+
77
+ /// <summary>
78
+ ///
79
+ /// </summary>
80
+ /// <returns></returns>
81
+ public virtual int GetID() => id;
82
+
83
+ /// <summary>
84
+ ///
85
+ /// </summary>
86
+ /// <returns></returns>
87
+ public virtual bool HasSaveData() => hasSaveData;
88
+
89
+
90
+ /// <summary>
91
+ ///
92
+ /// </summary>
93
+ public abstract void OnSaveFound();
94
+
95
+ /// <summary>
96
+ ///
97
+ /// </summary>
98
+ public abstract void OnSaveNotFound();
99
+ }
100
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a195c5eebe34d254cbdf9b1a32643c40
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,205 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Progressing;
3
+ using DREditor.Saving;
4
+ using DREditor.States;
5
+ using System.Collections.Generic;
6
+ using System.Text.RegularExpressions;
7
+ using TMPro;
8
+ using UnityEngine;
9
+
10
+ namespace DREditor.UI.SavingLoading
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ [ClassHeader(nameof(SaveDataDisplayerBase) +
16
+ "\n\n")]
17
+ public class SaveTitleDisplayer : SaveDataDisplayerBase
18
+ {
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ [Header("")]
23
+ [Divider]
24
+ [Tooltip("")]
25
+ [SerializeField] protected ProgressionDatabase progressionDatabase = null;
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ [Tooltip("")]
31
+ [SerializeField] protected StateDatabase addStateDatabase = null;
32
+
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Header("")]
38
+ [Divider]
39
+ [Tooltip("")]
40
+ [SerializeField] protected TextMeshProUGUI title = null;
41
+
42
+
43
+ /// <summary>
44
+ ///
45
+ /// </summary>
46
+ [Header("")]
47
+ [Divider]
48
+ [Tooltip("")]
49
+ [SerializeField] protected string titleNotFoundText = "Free Slot ";
50
+
51
+ /// <summary>
52
+ ///
53
+ /// </summary>
54
+ [Tooltip("")]
55
+ [SerializeField] protected string titleFoundText = "Slot ";
56
+
57
+ /// <summary>
58
+ ///
59
+ /// </summary>
60
+ [Tooltip("")]
61
+ [SerializeField] protected string scenePrefix = "GYM_";
62
+
63
+ /// <summary>
64
+ ///
65
+ /// </summary>
66
+ [Tooltip("")]
67
+ [SerializeField] protected string nullLocation = "null";
68
+
69
+ /// <summary>
70
+ ///
71
+ /// </summary>
72
+ [Tooltip("")]
73
+ [SerializeField] protected string slotSeparator = " : ";
74
+
75
+ /// <summary>
76
+ ///
77
+ /// </summary>
78
+ [Tooltip("")]
79
+ [SerializeField] protected string additionalStatePrefix = "(";
80
+
81
+ /// <summary>
82
+ ///
83
+ /// </summary>
84
+ [Tooltip("")]
85
+ [SerializeField] protected string additionalStateSuffix = ")";
86
+
87
+ /// <summary>
88
+ ///
89
+ /// </summary>
90
+ [Tooltip("")]
91
+ [SerializeField] protected string regexPattern = @"([a-z])([A-Z])|([A-Z]+)([A-Z][a-z])";
92
+
93
+ /// <summary>
94
+ ///
95
+ /// </summary>
96
+ [Tooltip("")]
97
+ [SerializeField] protected string regexReplacement = "$1$3 $2$4";
98
+
99
+
100
+ /// <summary>
101
+ ///
102
+ /// </summary>
103
+ [Header("")]
104
+ [Divider]
105
+ [Tooltip("")]
106
+ [SerializeField] protected string sceneKey = "SceneName";
107
+
108
+ /// <summary>
109
+ ///
110
+ /// </summary>
111
+ [Tooltip("")]
112
+ [SerializeField] protected string addedStateKey = "addedState";
113
+
114
+ /// <summary>
115
+ ///
116
+ /// </summary>
117
+ [Tooltip("")]
118
+ [SerializeField] protected string locationKey = "location";
119
+
120
+ /// <summary>
121
+ ///
122
+ /// </summary>
123
+ [Tooltip("")]
124
+ [SerializeField] protected string chapterKey = "chapter";
125
+
126
+
127
+ /// <summary>
128
+ ///
129
+ /// </summary>
130
+ protected Dictionary<string, object> saveDatas;
131
+
132
+
133
+ /// <inheritdoc/>
134
+ public override void Display(Dictionary<string, object> saveDatas, int id)
135
+ {
136
+ this.saveDatas = saveDatas;
137
+
138
+ string title = GetChapter() + GetArea() + GetAdditionalState();
139
+
140
+ this.title.text = titleFoundText + (id + 1) + slotSeparator + title;
141
+
142
+ this.saveDatas = null;
143
+ }
144
+
145
+ /// <summary>
146
+ ///
147
+ /// </summary>
148
+ /// <returns></returns>
149
+ protected virtual string GetChapter()
150
+ => progressionDatabase != null ?
151
+ progressionDatabase.Chapters[saveDatas.Get<int>(chapterKey)].saveTitle + " ": "";
152
+
153
+ /// <summary>
154
+ ///
155
+ /// </summary>
156
+ /// <returns></returns>
157
+ protected virtual string GetArea()
158
+ {
159
+ string area = saveDatas.Get<string>(sceneKey)?.Replace(scenePrefix, "");
160
+
161
+ string location = saveDatas.Get<string>(locationKey);
162
+
163
+ if (location != null && location == nullLocation)
164
+ return "";
165
+ else if (location != null && location != "")
166
+ return location + " ";
167
+ else
168
+ return SplitCamelCase(area) + " ";
169
+ }
170
+
171
+ /// <summary>
172
+ ///
173
+ /// </summary>
174
+ /// <returns></returns>
175
+ protected virtual string GetAdditionalState()
176
+ {
177
+ if (addStateDatabase == null)
178
+ return string.Empty;
179
+
180
+ string added = SplitCamelCase(addStateDatabase.GetStateName(saveDatas.Get<int>(addedStateKey)).ToString());
181
+
182
+ if (added != "")
183
+ added = additionalStatePrefix + added + additionalStateSuffix;
184
+
185
+ return added;
186
+ }
187
+
188
+ /// <summary>
189
+ ///
190
+ /// </summary>
191
+ /// <param name="text"></param>
192
+ /// <returns></returns>
193
+ protected virtual string SplitCamelCase(string text)
194
+ {
195
+ if (string.IsNullOrWhiteSpace(text))
196
+ return "";
197
+ else
198
+ return Regex.Replace(text, regexPattern, regexReplacement);
199
+ }
200
+
201
+
202
+ /// <inheritdoc/>
203
+ public override void OnSaveNotFound(int id) => title.text = titleNotFoundText + (id + 1);
204
+ }
205
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: affae7c9da6af364091da6cd123deb60
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
- {
2
- "name": "net.dreditor.ui.savingloading",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "net.dreditor.ui.savingloading",
3
+ "version": "0.1.6",
4
+ "displayName": "DREditor UI Saving Loading",
5
+ "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
+ "unity": "6000.4",
7
+ "dependencies": {
8
+ "com.unity.ugui": "2.0.0",
9
+ "net.dreditor.core": "0.1.6",
10
+ "net.dreditor.fading": "0.1.6",
11
+ "net.dreditor.progressing.handling": "0.1.6",
12
+ "net.dreditor.states": "0.1.6",
13
+ "net.dreditor.ui": "0.1.6",
14
+ "net.dreditor.audio": "0.1.6",
15
+ "net.dreditor.roomloading": "0.1.6"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "author": {
21
+ "name": "Benjamin \"Sweden\" Jillson",
22
+ "email": "dreditortool@gmail.com",
23
+ "url": "https://dreditor.net"
24
+ },
25
+ "keywords": [
26
+ "editor",
27
+ "tool",
28
+ "dreditor"
29
+ ],
30
+ "samples": [
31
+ {
32
+ "displayName": "Samples",
33
+ "description": "",
34
+ "path": "Samples~"
35
+ }
36
+ ],
37
+ "documentationUrl": "https://dreditor.net",
38
+ "license": "Apache-2.0",
39
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
40
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html"
41
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: b3963d6bb9e4559489a404d56f850e41
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.