net.dreditor.progressing.handling 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 (74) hide show
  1. package/.attestation.p7m +0 -0
  2. package/ChapterTitleDisplayer.cs +41 -41
  3. package/ChapterTitleDisplayer.cs.meta +11 -11
  4. package/DREditor.Progressing.Handling.asmdef +16 -16
  5. package/DREditor.Progressing.Handling.asmdef.meta +7 -7
  6. package/FlagTriggerExtensions.cs +78 -78
  7. package/FlagTriggerExtensions.cs.meta +11 -11
  8. package/FlagTriggerHandler.cs +236 -236
  9. package/FlagTriggerHandler.cs.meta +11 -11
  10. package/FlagTriggerHandlerBase.cs +65 -65
  11. package/FlagTriggerHandlerBase.cs.meta +11 -11
  12. package/HistoricalManagerBase.cs +158 -158
  13. package/HistoricalManagerBase.cs.meta +1 -1
  14. package/IHistory.cs +100 -100
  15. package/IHistory.cs.meta +1 -1
  16. package/ProgressionData.cs +180 -180
  17. package/ProgressionData.cs.meta +11 -11
  18. package/ProgressionDebugger.cs +185 -185
  19. package/ProgressionDebugger.cs.meta +11 -11
  20. package/ProgressionFlagHandler.cs +166 -166
  21. package/ProgressionFlagHandler.cs.meta +11 -11
  22. package/ProgressionHistoryManager.cs +33 -33
  23. package/ProgressionHistoryManager.cs.meta +11 -11
  24. package/ProgressionInfo.cs +53 -53
  25. package/ProgressionInfo.cs.meta +11 -11
  26. package/ProgressionLoader.cs +128 -128
  27. package/ProgressionLoader.cs.meta +11 -11
  28. package/ProgressionManager.cs +285 -285
  29. package/ProgressionManager.cs.meta +11 -11
  30. package/ProgressionManagerBase.cs +131 -131
  31. package/ProgressionManagerBase.cs.meta +11 -11
  32. package/ProgressionSaver.cs +48 -48
  33. package/ProgressionSaver.cs.meta +11 -11
  34. package/{Samples → Samples~}/CurrentChapterIndex.asset +21 -21
  35. package/{Samples → Samples~}/CurrentChapterIndex.asset.meta +8 -8
  36. package/{Samples → Samples~}/CurrentObjectiveIndex.asset +19 -19
  37. package/{Samples → Samples~}/CurrentObjectiveIndex.asset.meta +8 -8
  38. package/{Samples → Samples~}/CurrentObjectiveName.asset +19 -19
  39. package/{Samples → Samples~}/CurrentObjectiveName.asset.meta +8 -8
  40. package/{Samples → Samples~}/FlagTriggered.asset +19 -19
  41. package/{Samples → Samples~}/FlagTriggered.asset.meta +8 -8
  42. package/{Samples → Samples~}/Flag_Trigger_Handler.prefab +194 -194
  43. package/{Samples → Samples~}/Flag_Trigger_Handler.prefab.meta +7 -7
  44. package/{Samples → Samples~}/LoadProgressionData.asset +14 -14
  45. package/{Samples → Samples~}/LoadProgressionData.asset.meta +8 -8
  46. package/{Samples → Samples~}/MoveToNextNaturalObjective.asset +14 -14
  47. package/{Samples → Samples~}/MoveToNextNaturalObjective.asset.meta +8 -8
  48. package/{Samples → Samples~}/MoveToObjective.asset +19 -19
  49. package/{Samples → Samples~}/MoveToObjective.asset.meta +8 -8
  50. package/{Samples → Samples~}/ObjectiveKeepsInstanceData.asset +19 -19
  51. package/{Samples → Samples~}/ObjectiveKeepsInstanceData.asset.meta +8 -8
  52. package/{Samples → Samples~}/OnGeneratePastData.asset +14 -14
  53. package/{Samples → Samples~}/OnGeneratePastData.asset.meta +8 -8
  54. package/{Samples → Samples~}/OnLastObjective.asset +19 -19
  55. package/{Samples → Samples~}/OnLastObjective.asset.meta +8 -8
  56. package/{Samples → Samples~}/Progression_Debugger.prefab +73 -73
  57. package/{Samples → Samples~}/Progression_Debugger.prefab.meta +7 -7
  58. package/{Samples → Samples~}/Progression_Flag_Handler.prefab +47 -47
  59. package/{Samples → Samples~}/Progression_Flag_Handler.prefab.meta +7 -7
  60. package/{Samples → Samples~}/Progression_History_Manager.prefab +107 -107
  61. package/{Samples → Samples~}/Progression_History_Manager.prefab.meta +7 -7
  62. package/{Samples → Samples~}/Progression_Loader.prefab +76 -76
  63. package/{Samples → Samples~}/Progression_Loader.prefab.meta +7 -7
  64. package/{Samples → Samples~}/Progression_Manager_ETemplate.prefab +603 -603
  65. package/{Samples → Samples~}/Progression_Manager_ETemplate.prefab.meta +7 -7
  66. package/{Samples → Samples~}/Progression_Saver.prefab +51 -51
  67. package/{Samples → Samples~}/Progression_Saver.prefab.meta +7 -7
  68. package/{Samples → Samples~}/RequiredFlagsTriggered.asset +19 -19
  69. package/{Samples → Samples~}/RequiredFlagsTriggered.asset.meta +8 -8
  70. package/{Samples → Samples~}/TriggerAllRequiredFlags.asset +14 -14
  71. package/{Samples → Samples~}/TriggerAllRequiredFlags.asset.meta +8 -8
  72. package/package.json +40 -35
  73. package/package.json.meta +7 -7
  74. package/Samples.meta +0 -8
@@ -1,181 +1,181 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using System;
3
- using System.Collections.Generic;
4
- using System.Linq;
5
- using UnityEngine;
6
- using UnityEngine.Scripting.APIUpdating;
7
- using UnityEngine.Serialization;
8
-
9
- namespace DREditor.Progressing.Handling
10
- {
11
- /// <summary>
12
- ///
13
- /// </summary>
14
- [Serializable]
15
- [MovedFrom(true, "DREditor.Progression.Handling", "DREditor.Progression.Handling")]
16
- public class ProgressionData : IHistory
17
- {
18
- /// <summary>
19
- ///
20
- /// </summary>
21
- [Tooltip("")]
22
- public int chapter;
23
-
24
- /// <summary>
25
- ///
26
- /// </summary>
27
- [Tooltip("")]
28
- public Objective previousObjective;
29
-
30
-
31
- /// <remarks></remarks>
32
- /// <summary>
33
- ///
34
- /// </summary>
35
- [Tooltip("")]
36
- [FormerlySerializedAs("Info")]
37
- public List<ProgressionInfo> Infos = new();
38
-
39
- public ProgressionData() { }
40
-
41
- /// <inheritdoc/>
42
- public virtual void CarryOver(IPersistentData persistentData)
43
- {
44
- if (persistentData is ProgressionData oldData)
45
- Infos = oldData.Infos;
46
- else
47
- UnityEngine.Debug.LogWarning("ALERT: TRIED TO SET PROGRESSION DATA OF A DIFFERENT TYPE!");
48
- }
49
-
50
- /// <inheritdoc/>
51
- public virtual void SetChapterIndex(int chapter) => this.chapter = chapter;
52
-
53
-
54
- /// <inheritdoc/>
55
- public virtual void SetPreviousObjective(Objective objective) => previousObjective = objective;
56
-
57
- /// <inheritdoc/>
58
- public virtual void Add(int chapterIndex, Objective objective)
59
- {
60
- RecursiveAdd(chapterIndex);
61
-
62
- Infos[chapterIndex].Add(objective);
63
- }
64
-
65
- protected virtual void RecursiveAdd(int chapterIndex)
66
- {
67
- if (chapterIndex >= Infos.Count)
68
- {
69
- Infos.Add(new ProgressionInfo());
70
-
71
- RecursiveAdd(chapterIndex);
72
- }
73
- }
74
-
75
- /// <inheritdoc/>
76
- public virtual void Clear() => Infos.Clear();
77
-
78
- /// <inheritdoc/>
79
- public virtual Objective GetLastObjective()
80
- {
81
- if (previousObjective != null)
82
- return previousObjective;
83
-
84
- if (Infos.Count == 0)
85
- return null;
86
-
87
- return Infos.Last().objectives.Last();
88
- }
89
-
90
- /// <inheritdoc/>
91
- public virtual bool ContainsObjective(string objectiveName)
92
- {
93
- for (int i = 0; i < Infos.Count; i++)
94
- if (Infos[i].ContainsObjective(objectiveName))
95
- return true;
96
-
97
- return false;
98
- }
99
-
100
- /// <inheritdoc/>
101
- public virtual ProgressionFlag GetFlagFromHistory(string flagName)
102
- {
103
- IEnumerable<ProgressionInfo> chaptersContainingFlag =
104
- Infos.Where(chapter => chapter.objectives.Where(objective => objective.GetFlagNames()
105
- .Contains(flagName)).Count() > 0);
106
-
107
- if (chaptersContainingFlag.Count() > 0)
108
- {
109
- var firstObjectiveContainingFlag =
110
- chaptersContainingFlag.ElementAt(0).objectives.Where(n => n.GetFlagNames().Contains(flagName)).ElementAt(0);
111
-
112
- var matchingFlags = firstObjectiveContainingFlag.Flags.Where(n => n.name == flagName);
113
-
114
- if (matchingFlags.Count() > 0 && matchingFlags.ElementAt(0) != null)
115
- return matchingFlags.ElementAt(0);
116
- }
117
-
118
- UnityEngine.Debug.LogWarning("After Checking this save files previously completed Objectives, " +
119
- "that flag couldn't be found. \n" +
120
- "Which means one has occured: There's been user error building progression, " +
121
- "The Searched progression flag string used was misspelt, OR the save file never completed or had the objective " +
122
- "that contained the searched flag. \n" +
123
- "If you still encounter this error after making sure Debug Viewing " +
124
- "Progression data contains the flag, and the searched flag " +
125
- "was not misspelt, you should contact Sweden in order to debug and find the problem.");
126
-
127
- return null;
128
- }
129
-
130
- /// <inheritdoc/>
131
- public virtual List<List<Objective>> GetChapterHistory()
132
- {
133
- List<List<Objective>> chapterHistory = new();
134
-
135
- foreach (var chapter in Infos)
136
- chapterHistory.Add(chapter.objectives);
137
-
138
- return chapterHistory;
139
- }
140
-
141
- /// <inheritdoc/>
142
- public virtual void SetChapterHistory(List<List<Objective>> chapterHistory)
143
- {
144
- foreach (var chapter in Infos)
145
- chapter.SetObjectiveHistory(chapterHistory[Infos.IndexOf(chapter)]);
146
- }
147
-
148
- /// <inheritdoc/>
149
- public virtual Objective GetHistoryObjective(int chapter, int objective) => Infos[chapter].objectives[objective];
150
-
151
- /// <inheritdoc/>
152
- public virtual int GetAmountOfFinishedObjectives()
153
- => Infos.Count > chapter ? Infos[chapter].objectives.Count : 0;
154
-
155
- /// <inheritdoc/>
156
- public virtual int GetObjectiveCountFromHistory(int selectedChapter)
157
- {
158
- if (selectedChapter < Infos.Count && selectedChapter >= 0)
159
- return Infos[selectedChapter].objectives.Count;
160
-
161
- UnityEngine.Debug.LogWarning($"REPORT: The selected chapter index: {selectedChapter} " +
162
- $"does not have progression history! Is there Progression data missing?");
163
-
164
- return 0;
165
- }
166
-
167
- /// <inheritdoc/>
168
- public virtual int LatestChapterIndex()
169
- {
170
- int history = Infos.Count;
171
-
172
- --history;
173
-
174
- return Math.Max(chapter, history);
175
- }
176
-
177
- /// <inheritdoc/>
178
- public virtual ProgressionFlag GetFlagFromIndexes(int chapter, int objective, int flag)
179
- => GetHistoryObjective(chapter, objective).Flags[flag];
180
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using System.Linq;
5
+ using UnityEngine;
6
+ using UnityEngine.Scripting.APIUpdating;
7
+ using UnityEngine.Serialization;
8
+
9
+ namespace DREditor.Progressing.Handling
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ [Serializable]
15
+ [MovedFrom(true, "DREditor.Progression.Handling", "DREditor.Progression.Handling")]
16
+ public class ProgressionData : IHistory
17
+ {
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ public int chapter;
23
+
24
+ /// <summary>
25
+ ///
26
+ /// </summary>
27
+ [Tooltip("")]
28
+ public Objective previousObjective;
29
+
30
+
31
+ /// <remarks></remarks>
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ [Tooltip("")]
36
+ [FormerlySerializedAs("Info")]
37
+ public List<ProgressionInfo> Infos = new();
38
+
39
+ public ProgressionData() { }
40
+
41
+ /// <inheritdoc/>
42
+ public virtual void CarryOver(IPersistentData persistentData)
43
+ {
44
+ if (persistentData is ProgressionData oldData)
45
+ Infos = oldData.Infos;
46
+ else
47
+ UnityEngine.Debug.LogWarning("ALERT: TRIED TO SET PROGRESSION DATA OF A DIFFERENT TYPE!");
48
+ }
49
+
50
+ /// <inheritdoc/>
51
+ public virtual void SetChapterIndex(int chapter) => this.chapter = chapter;
52
+
53
+
54
+ /// <inheritdoc/>
55
+ public virtual void SetPreviousObjective(Objective objective) => previousObjective = objective;
56
+
57
+ /// <inheritdoc/>
58
+ public virtual void Add(int chapterIndex, Objective objective)
59
+ {
60
+ RecursiveAdd(chapterIndex);
61
+
62
+ Infos[chapterIndex].Add(objective);
63
+ }
64
+
65
+ protected virtual void RecursiveAdd(int chapterIndex)
66
+ {
67
+ if (chapterIndex >= Infos.Count)
68
+ {
69
+ Infos.Add(new ProgressionInfo());
70
+
71
+ RecursiveAdd(chapterIndex);
72
+ }
73
+ }
74
+
75
+ /// <inheritdoc/>
76
+ public virtual void Clear() => Infos.Clear();
77
+
78
+ /// <inheritdoc/>
79
+ public virtual Objective GetLastObjective()
80
+ {
81
+ if (previousObjective != null)
82
+ return previousObjective;
83
+
84
+ if (Infos.Count == 0)
85
+ return null;
86
+
87
+ return Infos.Last().objectives.Last();
88
+ }
89
+
90
+ /// <inheritdoc/>
91
+ public virtual bool ContainsObjective(string objectiveName)
92
+ {
93
+ for (int i = 0; i < Infos.Count; i++)
94
+ if (Infos[i].ContainsObjective(objectiveName))
95
+ return true;
96
+
97
+ return false;
98
+ }
99
+
100
+ /// <inheritdoc/>
101
+ public virtual ProgressionFlag GetFlagFromHistory(string flagName)
102
+ {
103
+ IEnumerable<ProgressionInfo> chaptersContainingFlag =
104
+ Infos.Where(chapter => chapter.objectives.Where(objective => objective.GetFlagNames()
105
+ .Contains(flagName)).Count() > 0);
106
+
107
+ if (chaptersContainingFlag.Count() > 0)
108
+ {
109
+ var firstObjectiveContainingFlag =
110
+ chaptersContainingFlag.ElementAt(0).objectives.Where(n => n.GetFlagNames().Contains(flagName)).ElementAt(0);
111
+
112
+ var matchingFlags = firstObjectiveContainingFlag.Flags.Where(n => n.name == flagName);
113
+
114
+ if (matchingFlags.Count() > 0 && matchingFlags.ElementAt(0) != null)
115
+ return matchingFlags.ElementAt(0);
116
+ }
117
+
118
+ UnityEngine.Debug.LogWarning("After Checking this save files previously completed Objectives, " +
119
+ "that flag couldn't be found. \n" +
120
+ "Which means one has occured: There's been user error building progression, " +
121
+ "The Searched progression flag string used was misspelt, OR the save file never completed or had the objective " +
122
+ "that contained the searched flag. \n" +
123
+ "If you still encounter this error after making sure Debug Viewing " +
124
+ "Progression data contains the flag, and the searched flag " +
125
+ "was not misspelt, you should contact Sweden in order to debug and find the problem.");
126
+
127
+ return null;
128
+ }
129
+
130
+ /// <inheritdoc/>
131
+ public virtual List<List<Objective>> GetChapterHistory()
132
+ {
133
+ List<List<Objective>> chapterHistory = new();
134
+
135
+ foreach (var chapter in Infos)
136
+ chapterHistory.Add(chapter.objectives);
137
+
138
+ return chapterHistory;
139
+ }
140
+
141
+ /// <inheritdoc/>
142
+ public virtual void SetChapterHistory(List<List<Objective>> chapterHistory)
143
+ {
144
+ foreach (var chapter in Infos)
145
+ chapter.SetObjectiveHistory(chapterHistory[Infos.IndexOf(chapter)]);
146
+ }
147
+
148
+ /// <inheritdoc/>
149
+ public virtual Objective GetHistoryObjective(int chapter, int objective) => Infos[chapter].objectives[objective];
150
+
151
+ /// <inheritdoc/>
152
+ public virtual int GetAmountOfFinishedObjectives()
153
+ => Infos.Count > chapter ? Infos[chapter].objectives.Count : 0;
154
+
155
+ /// <inheritdoc/>
156
+ public virtual int GetObjectiveCountFromHistory(int selectedChapter)
157
+ {
158
+ if (selectedChapter < Infos.Count && selectedChapter >= 0)
159
+ return Infos[selectedChapter].objectives.Count;
160
+
161
+ UnityEngine.Debug.LogWarning($"REPORT: The selected chapter index: {selectedChapter} " +
162
+ $"does not have progression history! Is there Progression data missing?");
163
+
164
+ return 0;
165
+ }
166
+
167
+ /// <inheritdoc/>
168
+ public virtual int LatestChapterIndex()
169
+ {
170
+ int history = Infos.Count;
171
+
172
+ --history;
173
+
174
+ return Math.Max(chapter, history);
175
+ }
176
+
177
+ /// <inheritdoc/>
178
+ public virtual ProgressionFlag GetFlagFromIndexes(int chapter, int objective, int flag)
179
+ => GetHistoryObjective(chapter, objective).Flags[flag];
180
+ }
181
181
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 961b5a0c2207abd449079c5433058cc4
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: 961b5a0c2207abd449079c5433058cc4
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: