net.dreditor.chapterselection 0.1.6 → 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.
- package/.attestation.p7m +0 -0
- package/ChapterSceneByLatestObjective.cs +188 -188
- package/ChapterSceneByLatestObjective.cs.meta +1 -1
- package/ChapterSceneHandler.cs +151 -151
- package/ChapterSceneHandler.cs.meta +11 -11
- package/ChapterSectionBase.cs +139 -139
- package/ChapterSectionBase.cs.meta +11 -11
- package/ChapterSelectCollection.cs +48 -48
- package/ChapterSelectCollection.cs.meta +1 -1
- package/ChapterSelectCollectionBase.cs +71 -71
- package/ChapterSelectCollectionBase.cs.meta +1 -1
- package/ChapterSelectData.cs +55 -55
- package/ChapterSelectData.cs.meta +11 -11
- package/ChapterSelectDatabase.cs +28 -28
- package/ChapterSelectDatabase.cs.meta +11 -11
- package/ChapterSelectFallbackEvaluator.cs +24 -24
- package/ChapterSelectFallbackEvaluator.cs.meta +1 -1
- package/ChapterSelectHandler.cs +60 -60
- package/ChapterSelectHandler.cs.meta +11 -11
- package/ChapterSelectHistoryManager.cs +15 -15
- package/ChapterSelectHistoryManager.cs.meta +1 -1
- package/ChapterSelectManager.cs +196 -196
- package/ChapterSelectManager.cs.meta +11 -11
- package/ChapterSelectSaveData.cs +53 -53
- package/ChapterSelectSaveData.cs.meta +1 -1
- package/ChapterSelectUIHandler.cs +136 -136
- package/ChapterSelectUIHandler.cs.meta +11 -11
- package/ChapterSubSectionBase.cs +77 -77
- package/ChapterSubSectionBase.cs.meta +1 -1
- package/DREditor.ChapterSelection.asmdef +19 -19
- package/DREditor.ChapterSelection.asmdef.meta +7 -7
- package/IChapterSelectData.cs +14 -14
- package/IChapterSelectData.cs.meta +1 -1
- package/{Samples → Samples~}/Animations/ChapSelect.controller +191 -191
- package/{Samples → Samples~}/Animations/ChapSelect.controller.meta +8 -8
- package/{Samples → Samples~}/Animations/HideChapterSelect.anim +232 -232
- package/{Samples → Samples~}/Animations/HideChapterSelect.anim.meta +8 -8
- package/{Samples → Samples~}/Animations.meta +8 -8
- package/{Samples → Samples~}/CS_Select_Button_DRE.prefab +305 -305
- package/{Samples → Samples~}/CS_Select_Button_DRE.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Scene_UI_Canvas_Shell.prefab +393 -393
- package/{Samples → Samples~}/Chapter_Scene_UI_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Scene_UI_Canvas_Template.prefab +771 -771
- package/{Samples → Samples~}/Chapter_Scene_UI_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Select_Difficulty_UI_Canvas_Template.prefab +226 -226
- package/{Samples → Samples~}/Chapter_Select_Difficulty_UI_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Select_History_Manager.prefab +98 -98
- package/{Samples → Samples~}/Chapter_Select_History_Manager.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Select_System_Shell.prefab +61 -61
- package/{Samples → Samples~}/Chapter_Select_System_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Select_System_Template.prefab +549 -549
- package/{Samples → Samples~}/Chapter_Select_System_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Select_UI_Canvas_Shell.prefab +543 -543
- package/{Samples → Samples~}/Chapter_Select_UI_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Chapter_Select_UI_Canvas_Template.prefab +1001 -1001
- package/{Samples → Samples~}/Chapter_Select_UI_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/StartChapterSelectGame.asset +15 -15
- package/{Samples → Samples~}/StartChapterSelectGame.asset.meta +8 -8
- package/SceneDataProvider.cs +25 -25
- package/SceneDataProvider.cs.meta +11 -11
- package/SceneDataProviderBase.cs +36 -36
- package/SceneDataProviderBase.cs.meta +11 -11
- package/UnlockChapterSelectScene.cs +48 -48
- package/UnlockChapterSelectScene.cs.meta +1 -1
- package/package.json +42 -37
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/ChapterSceneHandler.cs
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Processables;
|
|
3
|
-
using DREditor.Saving;
|
|
4
|
-
using DREditor.Services;
|
|
5
|
-
using System.Collections.Generic;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.ChapterSelection
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[ClassHeader(nameof(ChapterSubSectionBase) + ", " + nameof(ChapterSectionBase) + ", " + nameof(IDRELoadableManager) +
|
|
14
|
-
"\n\n")]
|
|
15
|
-
public class ChapterSceneHandler : ChapterSubSectionBase
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected ChapterSectionBase parentSection = null;
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected ChapterSelectFallbackEvaluator fallbackEvaluator = null;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/// <summary>
|
|
31
|
-
///
|
|
32
|
-
/// </summary>
|
|
33
|
-
protected bool inDefaultMode = false;
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
protected ChapterSelectData chapterSelectData = null;
|
|
39
|
-
|
|
40
|
-
/// <summary>
|
|
41
|
-
///
|
|
42
|
-
/// </summary>
|
|
43
|
-
protected List<int> moments = new();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/// <inheritdoc/>
|
|
47
|
-
public override void InitializeDefault()
|
|
48
|
-
{
|
|
49
|
-
SetMaxSection(defaultUnlockedSections);
|
|
50
|
-
|
|
51
|
-
inDefaultMode = true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// <inheritdoc/>
|
|
55
|
-
public override void InitializeLoaded()
|
|
56
|
-
{
|
|
57
|
-
SetMaxSection(GetMaxLoadedScene());
|
|
58
|
-
|
|
59
|
-
inDefaultMode = false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/// <summary>
|
|
63
|
-
///
|
|
64
|
-
/// </summary>
|
|
65
|
-
/// <returns></returns>
|
|
66
|
-
protected int GetMaxLoadedScene()
|
|
67
|
-
{
|
|
68
|
-
ServiceLocator.HasService(out IChapterSelectData chapterSelectData);
|
|
69
|
-
|
|
70
|
-
var chapterScenes = chapterSelectDatabase[parentSection.GetMaxSection()].Details;
|
|
71
|
-
|
|
72
|
-
foreach (var scene in chapterScenes)
|
|
73
|
-
if (chapterSelectData is IIdentifiableValidator validator && validator.IDValid(scene.ID))
|
|
74
|
-
return chapterScenes.IndexOf(scene);
|
|
75
|
-
|
|
76
|
-
return fallbackEvaluator.GetMaxScene(parentSection);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
#region Evaluate Chapter Scene Moment
|
|
81
|
-
|
|
82
|
-
/// <inheritdoc/>
|
|
83
|
-
public override void OnParentSubmittedIndex(int selectedIndex) => EvaluateChapterScene(selectedIndex);
|
|
84
|
-
|
|
85
|
-
/// <summary>
|
|
86
|
-
///
|
|
87
|
-
/// </summary>
|
|
88
|
-
/// <param name="currentButtonIndex"></param>
|
|
89
|
-
public virtual void EvaluateChapterScene(int currentButtonIndex)
|
|
90
|
-
{
|
|
91
|
-
chapterSelectData = chapterSelectDatabase[currentButtonIndex];
|
|
92
|
-
|
|
93
|
-
moments.Clear();
|
|
94
|
-
|
|
95
|
-
EvaluateChapterSelectMoments();
|
|
96
|
-
|
|
97
|
-
ActivateValidSceneMoments();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/// <summary>
|
|
101
|
-
///
|
|
102
|
-
/// </summary>
|
|
103
|
-
protected virtual void EvaluateChapterSelectMoments()
|
|
104
|
-
{
|
|
105
|
-
foreach (SceneDataProviderBase sceneData in chapterSelectData)
|
|
106
|
-
CheckValidChapterSceneData(sceneData);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/// <summary>
|
|
110
|
-
///
|
|
111
|
-
/// </summary>
|
|
112
|
-
/// <param name="sceneData"></param>
|
|
113
|
-
protected virtual void CheckValidChapterSceneData(SceneDataProviderBase sceneData)
|
|
114
|
-
{
|
|
115
|
-
bool shouldAdd = chapterSelectData.chapter < parentSection.GetMaxSection() ||
|
|
116
|
-
(inDefaultMode && parentSection.SectionIsDefaultUnlocked() && sceneData.selectScene <= maxSection) ||
|
|
117
|
-
(!inDefaultMode && SceneIsValid(sceneData)) ||
|
|
118
|
-
(!inDefaultMode && sceneData.selectScene <= maxSection);
|
|
119
|
-
|
|
120
|
-
if (shouldAdd)
|
|
121
|
-
moments.Add(sceneData.selectScene);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/// <summary>
|
|
125
|
-
///
|
|
126
|
-
/// </summary>
|
|
127
|
-
/// <param name="sceneData"></param>
|
|
128
|
-
/// <returns></returns>
|
|
129
|
-
protected virtual bool SceneIsValid(SceneDataProviderBase sceneData)
|
|
130
|
-
{
|
|
131
|
-
if (ServiceLocator.HasService(out IChapterSelectData chapterSelectData) &&
|
|
132
|
-
chapterSelectData is IIdentifiableValidator validator)
|
|
133
|
-
return validator.IDValid(sceneData.ID);
|
|
134
|
-
|
|
135
|
-
UnityEngine.Debug.LogWarning("ANALYSIS: CHAPTER SELECT IS USING ITS FALLBACK EVALUATOR.");
|
|
136
|
-
|
|
137
|
-
return fallbackEvaluator != null && fallbackEvaluator.SceneIsValid(sceneData, parentSection);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/// <summary>
|
|
142
|
-
///
|
|
143
|
-
/// </summary>
|
|
144
|
-
protected virtual void ActivateValidSceneMoments()
|
|
145
|
-
{
|
|
146
|
-
for (int i = 0; i < sectionButtons.Count; i++)
|
|
147
|
-
sectionButtons[i].gameObject.SetActive(moments.Contains(i));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
#endregion
|
|
151
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Processables;
|
|
3
|
+
using DREditor.Saving;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.ChapterSelection
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ClassHeader(nameof(ChapterSubSectionBase) + ", " + nameof(ChapterSectionBase) + ", " + nameof(IDRELoadableManager) +
|
|
14
|
+
"\n\n")]
|
|
15
|
+
public class ChapterSceneHandler : ChapterSubSectionBase
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected ChapterSectionBase parentSection = null;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected ChapterSelectFallbackEvaluator fallbackEvaluator = null;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
protected bool inDefaultMode = false;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
protected ChapterSelectData chapterSelectData = null;
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
protected List<int> moments = new();
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <inheritdoc/>
|
|
47
|
+
public override void InitializeDefault()
|
|
48
|
+
{
|
|
49
|
+
SetMaxSection(defaultUnlockedSections);
|
|
50
|
+
|
|
51
|
+
inDefaultMode = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// <inheritdoc/>
|
|
55
|
+
public override void InitializeLoaded()
|
|
56
|
+
{
|
|
57
|
+
SetMaxSection(GetMaxLoadedScene());
|
|
58
|
+
|
|
59
|
+
inDefaultMode = false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
/// <returns></returns>
|
|
66
|
+
protected int GetMaxLoadedScene()
|
|
67
|
+
{
|
|
68
|
+
ServiceLocator.HasService(out IChapterSelectData chapterSelectData);
|
|
69
|
+
|
|
70
|
+
var chapterScenes = chapterSelectDatabase[parentSection.GetMaxSection()].Details;
|
|
71
|
+
|
|
72
|
+
foreach (var scene in chapterScenes)
|
|
73
|
+
if (chapterSelectData is IIdentifiableValidator validator && validator.IDValid(scene.ID))
|
|
74
|
+
return chapterScenes.IndexOf(scene);
|
|
75
|
+
|
|
76
|
+
return fallbackEvaluator.GetMaxScene(parentSection);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
#region Evaluate Chapter Scene Moment
|
|
81
|
+
|
|
82
|
+
/// <inheritdoc/>
|
|
83
|
+
public override void OnParentSubmittedIndex(int selectedIndex) => EvaluateChapterScene(selectedIndex);
|
|
84
|
+
|
|
85
|
+
/// <summary>
|
|
86
|
+
///
|
|
87
|
+
/// </summary>
|
|
88
|
+
/// <param name="currentButtonIndex"></param>
|
|
89
|
+
public virtual void EvaluateChapterScene(int currentButtonIndex)
|
|
90
|
+
{
|
|
91
|
+
chapterSelectData = chapterSelectDatabase[currentButtonIndex];
|
|
92
|
+
|
|
93
|
+
moments.Clear();
|
|
94
|
+
|
|
95
|
+
EvaluateChapterSelectMoments();
|
|
96
|
+
|
|
97
|
+
ActivateValidSceneMoments();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// <summary>
|
|
101
|
+
///
|
|
102
|
+
/// </summary>
|
|
103
|
+
protected virtual void EvaluateChapterSelectMoments()
|
|
104
|
+
{
|
|
105
|
+
foreach (SceneDataProviderBase sceneData in chapterSelectData)
|
|
106
|
+
CheckValidChapterSceneData(sceneData);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
///
|
|
111
|
+
/// </summary>
|
|
112
|
+
/// <param name="sceneData"></param>
|
|
113
|
+
protected virtual void CheckValidChapterSceneData(SceneDataProviderBase sceneData)
|
|
114
|
+
{
|
|
115
|
+
bool shouldAdd = chapterSelectData.chapter < parentSection.GetMaxSection() ||
|
|
116
|
+
(inDefaultMode && parentSection.SectionIsDefaultUnlocked() && sceneData.selectScene <= maxSection) ||
|
|
117
|
+
(!inDefaultMode && SceneIsValid(sceneData)) ||
|
|
118
|
+
(!inDefaultMode && sceneData.selectScene <= maxSection);
|
|
119
|
+
|
|
120
|
+
if (shouldAdd)
|
|
121
|
+
moments.Add(sceneData.selectScene);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// <summary>
|
|
125
|
+
///
|
|
126
|
+
/// </summary>
|
|
127
|
+
/// <param name="sceneData"></param>
|
|
128
|
+
/// <returns></returns>
|
|
129
|
+
protected virtual bool SceneIsValid(SceneDataProviderBase sceneData)
|
|
130
|
+
{
|
|
131
|
+
if (ServiceLocator.HasService(out IChapterSelectData chapterSelectData) &&
|
|
132
|
+
chapterSelectData is IIdentifiableValidator validator)
|
|
133
|
+
return validator.IDValid(sceneData.ID);
|
|
134
|
+
|
|
135
|
+
UnityEngine.Debug.LogWarning("ANALYSIS: CHAPTER SELECT IS USING ITS FALLBACK EVALUATOR.");
|
|
136
|
+
|
|
137
|
+
return fallbackEvaluator != null && fallbackEvaluator.SceneIsValid(sceneData, parentSection);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
/// <summary>
|
|
142
|
+
///
|
|
143
|
+
/// </summary>
|
|
144
|
+
protected virtual void ActivateValidSceneMoments()
|
|
145
|
+
{
|
|
146
|
+
for (int i = 0; i < sectionButtons.Count; i++)
|
|
147
|
+
sectionButtons[i].gameObject.SetActive(moments.Contains(i));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
#endregion
|
|
151
|
+
}
|
|
152
152
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 412c4018fcce0a14b934b389c0874e96
|
|
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: 412c4018fcce0a14b934b389c0874e96
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/ChapterSectionBase.cs
CHANGED
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Progressing.Handling;
|
|
3
|
-
using DREditor.Saving;
|
|
4
|
-
using DREditor.Services;
|
|
5
|
-
using System.Collections;
|
|
6
|
-
using System.Collections.Generic;
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
using UnityEngine.UI;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.ChapterSelection
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
public abstract class ChapterSectionBase : MonoBehaviour, IDRELoadableManager
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected ChapterSelectDatabase chapterSelectDatabase = null;
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected string chapterKey = "chapter";
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
[Tooltip("")]
|
|
33
|
-
[SerializeField] protected int defaultUnlockedSections = -1;
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
[Tooltip("")]
|
|
39
|
-
[SerializeField] protected List<Button> sectionButtons = new();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
protected int maxSection = 0;
|
|
46
|
-
|
|
47
|
-
/// <summary>
|
|
48
|
-
///
|
|
49
|
-
/// </summary>
|
|
50
|
-
protected int selectedSection = 0;
|
|
51
|
-
|
|
52
|
-
/// <summary>
|
|
53
|
-
///
|
|
54
|
-
/// </summary>
|
|
55
|
-
protected int loadedChapter = 0;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/// <summary>
|
|
59
|
-
///
|
|
60
|
-
/// </summary>
|
|
61
|
-
public virtual int DefaultUnlockedSections { get => defaultUnlockedSections; set => defaultUnlockedSections = value; }
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/// <summary>
|
|
65
|
-
///
|
|
66
|
-
/// </summary>
|
|
67
|
-
/// <returns></returns>
|
|
68
|
-
public virtual int GetSelectedSection() => selectedSection;
|
|
69
|
-
|
|
70
|
-
/// <summary>
|
|
71
|
-
///
|
|
72
|
-
/// </summary>
|
|
73
|
-
/// <returns></returns>
|
|
74
|
-
public virtual int GetMaxSection() => maxSection;
|
|
75
|
-
|
|
76
|
-
/// <summary>
|
|
77
|
-
///
|
|
78
|
-
/// </summary>
|
|
79
|
-
/// <param name="maxSection"></param>
|
|
80
|
-
protected virtual void SetMaxSection(int maxSection) => this.maxSection = maxSection;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/// <summary>
|
|
84
|
-
///
|
|
85
|
-
/// </summary>
|
|
86
|
-
/// <param name="selectedIndex"></param>
|
|
87
|
-
public abstract void OnParentSubmittedIndex(int selectedIndex);
|
|
88
|
-
|
|
89
|
-
/// <summary>
|
|
90
|
-
///
|
|
91
|
-
/// </summary>
|
|
92
|
-
public abstract void InitializeDefault();
|
|
93
|
-
|
|
94
|
-
/// <summary>
|
|
95
|
-
///
|
|
96
|
-
/// </summary>
|
|
97
|
-
public abstract void InitializeLoaded();
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/// <summary>
|
|
101
|
-
///
|
|
102
|
-
/// </summary>
|
|
103
|
-
/// <returns></returns>
|
|
104
|
-
public virtual bool AllowsChapterSelect() => DefaultUnlockedSections >= 0;
|
|
105
|
-
|
|
106
|
-
/// <summary>
|
|
107
|
-
///
|
|
108
|
-
/// </summary>
|
|
109
|
-
/// <remarks>
|
|
110
|
-
///
|
|
111
|
-
/// </remarks>
|
|
112
|
-
/// <param name="button"></param>
|
|
113
|
-
public virtual void SetSelectedSection(Button button) => selectedSection = sectionButtons.IndexOf(button);
|
|
114
|
-
|
|
115
|
-
/// <summary>
|
|
116
|
-
///
|
|
117
|
-
/// </summary>
|
|
118
|
-
/// <returns></returns>
|
|
119
|
-
public virtual bool SectionIsDefaultUnlocked() => selectedSection == DefaultUnlockedSections;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/// <inheritdoc/>
|
|
123
|
-
public virtual void LoadManager(Dictionary<string, object> saveDatas, bool inChapterSelect) =>
|
|
124
|
-
StartCoroutine(BufferLoad(saveDatas, inChapterSelect));
|
|
125
|
-
|
|
126
|
-
/// <summary>
|
|
127
|
-
///
|
|
128
|
-
/// </summary>
|
|
129
|
-
/// <param name="saveDatas"></param>
|
|
130
|
-
/// <param name="inChapterSelect"></param>
|
|
131
|
-
protected virtual IEnumerator BufferLoad(Dictionary<string, object> saveDatas, bool inChapterSelect)
|
|
132
|
-
{
|
|
133
|
-
yield return null;
|
|
134
|
-
|
|
135
|
-
var historyChapter = ServiceLocator.GetService<IHistory>().LatestChapterIndex();
|
|
136
|
-
|
|
137
|
-
loadedChapter = historyChapter >= 0 ? historyChapter : saveDatas.Get<int>(chapterKey);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Progressing.Handling;
|
|
3
|
+
using DREditor.Saving;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using System.Collections;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
using UnityEngine.UI;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.ChapterSelection
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
public abstract class ChapterSectionBase : MonoBehaviour, IDRELoadableManager
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected ChapterSelectDatabase chapterSelectDatabase = null;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected string chapterKey = "chapter";
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected int defaultUnlockedSections = -1;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
[Tooltip("")]
|
|
39
|
+
[SerializeField] protected List<Button> sectionButtons = new();
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
protected int maxSection = 0;
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
protected int selectedSection = 0;
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
protected int loadedChapter = 0;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
///
|
|
60
|
+
/// </summary>
|
|
61
|
+
public virtual int DefaultUnlockedSections { get => defaultUnlockedSections; set => defaultUnlockedSections = value; }
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/// <summary>
|
|
65
|
+
///
|
|
66
|
+
/// </summary>
|
|
67
|
+
/// <returns></returns>
|
|
68
|
+
public virtual int GetSelectedSection() => selectedSection;
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
///
|
|
72
|
+
/// </summary>
|
|
73
|
+
/// <returns></returns>
|
|
74
|
+
public virtual int GetMaxSection() => maxSection;
|
|
75
|
+
|
|
76
|
+
/// <summary>
|
|
77
|
+
///
|
|
78
|
+
/// </summary>
|
|
79
|
+
/// <param name="maxSection"></param>
|
|
80
|
+
protected virtual void SetMaxSection(int maxSection) => this.maxSection = maxSection;
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
///
|
|
85
|
+
/// </summary>
|
|
86
|
+
/// <param name="selectedIndex"></param>
|
|
87
|
+
public abstract void OnParentSubmittedIndex(int selectedIndex);
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
public abstract void InitializeDefault();
|
|
93
|
+
|
|
94
|
+
/// <summary>
|
|
95
|
+
///
|
|
96
|
+
/// </summary>
|
|
97
|
+
public abstract void InitializeLoaded();
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/// <summary>
|
|
101
|
+
///
|
|
102
|
+
/// </summary>
|
|
103
|
+
/// <returns></returns>
|
|
104
|
+
public virtual bool AllowsChapterSelect() => DefaultUnlockedSections >= 0;
|
|
105
|
+
|
|
106
|
+
/// <summary>
|
|
107
|
+
///
|
|
108
|
+
/// </summary>
|
|
109
|
+
/// <remarks>
|
|
110
|
+
///
|
|
111
|
+
/// </remarks>
|
|
112
|
+
/// <param name="button"></param>
|
|
113
|
+
public virtual void SetSelectedSection(Button button) => selectedSection = sectionButtons.IndexOf(button);
|
|
114
|
+
|
|
115
|
+
/// <summary>
|
|
116
|
+
///
|
|
117
|
+
/// </summary>
|
|
118
|
+
/// <returns></returns>
|
|
119
|
+
public virtual bool SectionIsDefaultUnlocked() => selectedSection == DefaultUnlockedSections;
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/// <inheritdoc/>
|
|
123
|
+
public virtual void LoadManager(Dictionary<string, object> saveDatas, bool inChapterSelect) =>
|
|
124
|
+
StartCoroutine(BufferLoad(saveDatas, inChapterSelect));
|
|
125
|
+
|
|
126
|
+
/// <summary>
|
|
127
|
+
///
|
|
128
|
+
/// </summary>
|
|
129
|
+
/// <param name="saveDatas"></param>
|
|
130
|
+
/// <param name="inChapterSelect"></param>
|
|
131
|
+
protected virtual IEnumerator BufferLoad(Dictionary<string, object> saveDatas, bool inChapterSelect)
|
|
132
|
+
{
|
|
133
|
+
yield return null;
|
|
134
|
+
|
|
135
|
+
var historyChapter = ServiceLocator.GetService<IHistory>().LatestChapterIndex();
|
|
136
|
+
|
|
137
|
+
loadedChapter = historyChapter >= 0 ? historyChapter : saveDatas.Get<int>(chapterKey);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
140
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 9570f14d0f8e0d84ebbf8b135dc8f99c
|
|
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: 9570f14d0f8e0d84ebbf8b135dc8f99c
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|