net.dreditor.roombuilding 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/DREditor.RoomBuilding.asmdef +28 -28
- package/DREditor.RoomBuilding.asmdef.meta +7 -7
- package/Editor/DREditor.RoomBuilding.Editor.asmdef +19 -19
- package/Editor/DREditor.RoomBuilding.Editor.asmdef.meta +7 -7
- package/Editor/FindCharactersInRoomsWizard.cs +55 -55
- package/Editor/FindCharactersInRoomsWizard.cs.meta +11 -11
- package/Editor/RoomBuilderContainsObjective.cs +38 -38
- package/Editor/RoomBuilderContainsObjective.cs.meta +11 -11
- package/Editor/RoomBuilderScanWizard.cs +90 -90
- package/Editor/RoomBuilderScanWizard.cs.meta +11 -11
- package/Editor/ScanRoomBuilders.cs +74 -74
- package/Editor/ScanRoomBuilders.cs.meta +11 -11
- package/Editor.meta +8 -8
- package/Implementation/Actors/ActorData.cs +115 -115
- package/Implementation/Actors/ActorData.cs.meta +11 -11
- package/Implementation/Actors/ActorStateData.cs +10 -10
- package/Implementation/Actors/ActorStateData.cs.meta +11 -11
- package/Implementation/Actors/ActorStateLoader.cs +344 -344
- package/Implementation/Actors/ActorStateLoader.cs.meta +11 -11
- package/Implementation/Actors/TActorData.cs +35 -35
- package/Implementation/Actors/TActorData.cs.meta +11 -11
- package/Implementation/Actors/TrialActorManager.cs +157 -157
- package/Implementation/Actors/TrialActorManager.cs.meta +11 -11
- package/Implementation/Actors.meta +8 -8
- package/Implementation/DoorLoader.cs +117 -117
- package/Implementation/DoorLoader.cs.meta +11 -11
- package/Implementation/DoorLoaderUtility.cs +51 -51
- package/Implementation/DoorLoaderUtility.cs.meta +11 -11
- package/Implementation/DoorStateData.cs +11 -11
- package/Implementation/DoorStateData.cs.meta +11 -11
- package/Implementation/ItemActorLoader.cs +157 -157
- package/Implementation/ItemActorLoader.cs.meta +11 -11
- package/Implementation/ItemData.cs +67 -67
- package/Implementation/ItemData.cs.meta +11 -11
- package/Implementation/ItemStateData.cs +10 -10
- package/Implementation/ItemStateData.cs.meta +11 -11
- package/Implementation/MoveLoader.cs +67 -67
- package/Implementation/MoveLoader.cs.meta +11 -11
- package/Implementation/MoveStateData.cs +11 -11
- package/Implementation/MoveStateData.cs.meta +11 -11
- package/Implementation/RoomStateHandlerBase.cs +241 -241
- package/Implementation/RoomStateHandlerBase.cs.meta +11 -11
- package/Implementation/SaveableData.cs +56 -56
- package/Implementation/SaveableData.cs.meta +11 -11
- package/Implementation/SaveableDataSet.cs +66 -66
- package/Implementation/SaveableDataSet.cs.meta +11 -11
- package/Implementation/SaveableManager.cs +70 -70
- package/Implementation/SaveableManager.cs.meta +11 -11
- package/Implementation/SaveableStateData.cs +10 -10
- package/Implementation/SaveableStateData.cs.meta +11 -11
- package/Implementation/SpawnableLoader.cs +125 -125
- package/Implementation/SpawnableLoader.cs.meta +11 -11
- package/Implementation/SpawnableStateData.cs +11 -11
- package/Implementation/SpawnableStateData.cs.meta +11 -11
- package/Implementation/StateDataAsset.cs +28 -28
- package/Implementation/StateDataAsset.cs.meta +11 -11
- package/Implementation/SubAreaLoader.cs +108 -108
- package/Implementation/SubAreaLoader.cs.meta +11 -11
- package/Implementation/SubAreaStateData.cs +11 -11
- package/Implementation/SubAreaStateData.cs.meta +11 -11
- package/Implementation/TriggerConverter.cs +137 -137
- package/Implementation/TriggerConverter.cs.meta +11 -11
- package/Implementation/TriggerLoader.cs +295 -295
- package/Implementation/TriggerLoader.cs.meta +11 -11
- package/Implementation/TriggerStateData.cs +18 -18
- package/Implementation/TriggerStateData.cs.meta +11 -11
- package/Implementation.meta +8 -8
- package/InstanceListWrapper.cs +23 -23
- package/InstanceListWrapper.cs.meta +11 -11
- package/Instances/ConvertInstanceData.cs +89 -89
- package/Instances/ConvertInstanceData.cs.meta +11 -11
- package/Instances/InstanceData.cs +43 -43
- package/Instances/InstanceData.cs.meta +11 -11
- package/Instances/InstanceStateData.cs +51 -51
- package/Instances/InstanceStateData.cs.meta +11 -11
- package/Instances/RoomInstanceData.cs +68 -68
- package/Instances/RoomInstanceData.cs.meta +11 -11
- package/Instances/RoomInstanceManager.cs +452 -452
- package/Instances/RoomInstanceManager.cs.meta +11 -11
- package/Instances.meta +8 -8
- package/LoadInvestigationRoomState.cs +53 -53
- package/LoadInvestigationRoomState.cs.meta +11 -11
- package/Old/ActorLoader.cs +382 -382
- package/Old/ActorLoader.cs.meta +11 -11
- package/Old/Room.cs +24 -24
- package/Old/Room.cs.meta +11 -11
- package/Old/RoomBuilder.cs +59 -59
- package/Old/RoomBuilder.cs.meta +11 -11
- package/Old/RoomData.cs +90 -90
- package/Old/RoomData.cs.meta +11 -11
- package/Old/RoomManager.cs +256 -256
- package/Old/RoomManager.cs.meta +11 -11
- package/Old/RoomManagerDisplayEditor.cs +72 -72
- package/Old/RoomManagerDisplayEditor.cs.meta +11 -11
- package/Old/RoomManagerEditor.cs +211 -211
- package/Old/RoomManagerEditor.cs.meta +11 -11
- package/Old/RoomManagerShellDisplayEditor.cs +48 -48
- package/Old/RoomManagerShellDisplayEditor.cs.meta +11 -11
- package/Old/RoomSection.cs +35 -35
- package/Old/RoomSection.cs.meta +11 -11
- package/Old.meta +8 -8
- package/RoomManagerBase.cs +84 -84
- package/RoomManagerBase.cs.meta +11 -11
- package/RoomManagerEditorBase.cs +86 -86
- package/RoomManagerEditorBase.cs.meta +11 -11
- package/RoomManagerEditorCoreBase.cs +159 -159
- package/RoomManagerEditorCoreBase.cs.meta +11 -11
- package/RoomSaveDisplayEditorBase.cs +111 -111
- package/RoomSaveDisplayEditorBase.cs.meta +11 -11
- package/RoomShellDisplayEditorBase.cs +68 -68
- package/RoomShellDisplayEditorBase.cs.meta +11 -11
- package/RoomStateBuilder.cs +53 -53
- package/RoomStateBuilder.cs.meta +11 -11
- package/RoomStateData.cs +58 -58
- package/RoomStateData.cs.meta +11 -11
- package/RoomStateManager.cs +202 -202
- package/RoomStateManager.cs.meta +11 -11
- package/RoomStateManagerEditor.cs +392 -392
- package/RoomStateManagerEditor.cs.meta +11 -11
- package/RoomStateSaveDisplayEditor.cs +175 -175
- package/RoomStateSaveDisplayEditor.cs.meta +11 -11
- package/RoomStateSection.cs +69 -69
- package/RoomStateSection.cs.meta +11 -11
- package/RoomStateShellDisplayEditor.cs +108 -108
- package/RoomStateShellDisplayEditor.cs.meta +11 -11
- package/{Samples → Samples~}/Room_State_Manager.prefab +473 -473
- package/{Samples → Samples~}/Room_State_Manager.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_Actor_Manager.prefab +51 -51
- package/{Samples → Samples~}/Trial_Actor_Manager.prefab.meta +7 -7
- package/package.json +51 -46
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/RoomStateManager.cs
CHANGED
|
@@ -1,203 +1,203 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Progressing;
|
|
3
|
-
using DREditor.Progressing.Handling;
|
|
4
|
-
using DREditor.RoomStateBuilding;
|
|
5
|
-
using DREditor.Services;
|
|
6
|
-
using System.Collections.Generic;
|
|
7
|
-
using System.Linq;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.RoomBuilding
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
public class RoomStateManager : RoomManagerBase
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
public RoomStateBuilder Builder = null;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
public List<MonoBehaviour> loadHandlers = new();
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
public List<IRoomStateLoader> loaders = new();
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
public List<IRoomStateSaver> savers = new();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/// <summary>
|
|
39
|
-
///
|
|
40
|
-
/// </summary>
|
|
41
|
-
/// <param name="Builder"></param>
|
|
42
|
-
public virtual void SetBuilder(RoomStateBuilder Builder) => this.Builder = Builder;
|
|
43
|
-
|
|
44
|
-
/// <inheritdoc/>
|
|
45
|
-
protected override void Awake()
|
|
46
|
-
{
|
|
47
|
-
dontDestroyOnLoad = false;
|
|
48
|
-
|
|
49
|
-
base.Awake();
|
|
50
|
-
|
|
51
|
-
InitializeHandlers();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// <summary>
|
|
55
|
-
///
|
|
56
|
-
/// </summary>
|
|
57
|
-
public virtual void InitializeHandlers()
|
|
58
|
-
{
|
|
59
|
-
savers = loadHandlers.OfType<IRoomStateSaver>().ToList();
|
|
60
|
-
|
|
61
|
-
loaders = loadHandlers.OfType<IRoomStateLoader>().ToList();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/// <inheritdoc/>
|
|
65
|
-
public override bool HasBase(int chapterNum, object pValue)
|
|
66
|
-
{
|
|
67
|
-
bool result = Builder.Sections[chapterNum].HasDataFor((Objective)pValue);
|
|
68
|
-
|
|
69
|
-
UnityEngine.Debug.Log("Has Base for current room: " + result);
|
|
70
|
-
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/// <inheritdoc/>
|
|
75
|
-
public override object SaveRoomState(object pValue)
|
|
76
|
-
{
|
|
77
|
-
InstanceListWrapper<InstanceListWrapper<string>> instanceTemp = new();
|
|
78
|
-
|
|
79
|
-
foreach (var saver in savers)
|
|
80
|
-
instanceTemp.wrappedInstances.Add(new InstanceListWrapper<string>((List<string>)saver.SaveInstance()));
|
|
81
|
-
|
|
82
|
-
foreach (var listWrapper in instanceTemp.wrappedInstances)
|
|
83
|
-
if (listWrapper.wrappedInstances != null)
|
|
84
|
-
foreach (var wrappedList in listWrapper.wrappedInstances)
|
|
85
|
-
UnityEngine.Debug.Log(wrappedList);
|
|
86
|
-
|
|
87
|
-
UnityEngine.Debug.Log(JsonUtility.ToJson(instanceTemp));
|
|
88
|
-
|
|
89
|
-
return JsonUtility.ToJson(instanceTemp);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/// <inheritdoc/>
|
|
93
|
-
public override bool BaseIsPersistent(object pValue)
|
|
94
|
-
{
|
|
95
|
-
var result = GetBaseData((Objective)pValue);
|
|
96
|
-
|
|
97
|
-
return result != null && result.isPersistent;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/// <inheritdoc/>
|
|
101
|
-
public override void LoadRoomState(object pValue, object data)
|
|
102
|
-
{
|
|
103
|
-
var currentChapter = ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter();
|
|
104
|
-
|
|
105
|
-
RoomStateSection current = Builder.Sections
|
|
106
|
-
.Find(section => section.Chapter == currentChapter);
|
|
107
|
-
|
|
108
|
-
if (current == null || !currentChapter.HasObjective((Objective)pValue))
|
|
109
|
-
{
|
|
110
|
-
UnityEngine.Debug.LogWarning("REPORT: ROOM BUILDER DID NOT HAVE A ROOM SECTION FOR THAT CHAPTER");
|
|
111
|
-
|
|
112
|
-
current = Builder.Sections[0];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
RoomStateData baseRoom = GetBaseData((Objective)pValue, current);
|
|
116
|
-
|
|
117
|
-
baseRoom = baseRoom == null ? OnBaseRoomEmpty((Objective)pValue, current) : baseRoom;
|
|
118
|
-
|
|
119
|
-
if (data != null && baseRoom != null)
|
|
120
|
-
LoadInstance(baseRoom, data);
|
|
121
|
-
else
|
|
122
|
-
LoadRoomFromHandlers(baseRoom);
|
|
123
|
-
|
|
124
|
-
onRoomInstanceLoaded.SetValue(true);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/// <summary>
|
|
128
|
-
///
|
|
129
|
-
/// </summary>
|
|
130
|
-
/// <param name="pValue"></param>
|
|
131
|
-
/// <param name="current"></param>
|
|
132
|
-
/// <returns></returns>
|
|
133
|
-
protected virtual RoomStateData OnBaseRoomEmpty(Objective pValue, RoomStateSection current)
|
|
134
|
-
{
|
|
135
|
-
UnityEngine.Debug.Log("Couldn't find Base Room data for Objective: " + pValue.Description + " " +
|
|
136
|
-
"within chapter: " + current.Chapter.name + ", Checking for Room Shell.");
|
|
137
|
-
|
|
138
|
-
int shellIndex = Builder.Sections.IndexOf(current);
|
|
139
|
-
|
|
140
|
-
if (shellIndex < Builder.Shells.Count)
|
|
141
|
-
{
|
|
142
|
-
UnityEngine.Debug.Log("Shell Data has been found! Loading Shell...");
|
|
143
|
-
|
|
144
|
-
return Builder.Shells[shellIndex];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
UnityEngine.Debug.Log($"No Shell Data Has been Filled at index {shellIndex}, Loading Empty Shell");
|
|
148
|
-
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/// <summary>
|
|
153
|
-
///
|
|
154
|
-
/// </summary>
|
|
155
|
-
/// <param name="pValue"></param>
|
|
156
|
-
/// <returns></returns>
|
|
157
|
-
protected virtual RoomStateData GetBaseData(Objective pValue)
|
|
158
|
-
{
|
|
159
|
-
RoomStateSection current = Builder.Sections
|
|
160
|
-
.Find(section => section.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
161
|
-
|
|
162
|
-
return GetBaseData(pValue, current);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/// <summary>
|
|
166
|
-
///
|
|
167
|
-
/// </summary>
|
|
168
|
-
/// <param name="pValue"></param>
|
|
169
|
-
/// <param name="current"></param>
|
|
170
|
-
/// <returns></returns>
|
|
171
|
-
protected virtual RoomStateData GetBaseData(Objective pValue, RoomStateSection current) =>
|
|
172
|
-
current.Rooms.FirstOrDefault(room => room.progressionValue.Description == pValue.Description);
|
|
173
|
-
|
|
174
|
-
/// <summary>
|
|
175
|
-
///
|
|
176
|
-
/// </summary>
|
|
177
|
-
/// <param name="room"></param>
|
|
178
|
-
public virtual void LoadRoomFromHandlers(RoomStateData room)
|
|
179
|
-
{
|
|
180
|
-
if (room != null)
|
|
181
|
-
foreach (var loader in loaders)
|
|
182
|
-
loader?.LoadData(room.dataStates);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/// <summary>
|
|
186
|
-
///
|
|
187
|
-
/// </summary>
|
|
188
|
-
/// <param name="room"></param>
|
|
189
|
-
/// <param name="instanceRoom"></param>
|
|
190
|
-
protected virtual void LoadInstance(RoomStateData room, object instanceRoom = null)
|
|
191
|
-
{
|
|
192
|
-
foreach (var loader in loaders)
|
|
193
|
-
loader.LoadInstance(room.dataStates, instanceRoom);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/// <inheritdoc/>
|
|
197
|
-
public override void UnloadAll(bool inEditor)
|
|
198
|
-
{
|
|
199
|
-
foreach (var loader in loaders)
|
|
200
|
-
loader.Unload(inEditor);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Progressing;
|
|
3
|
+
using DREditor.Progressing.Handling;
|
|
4
|
+
using DREditor.RoomStateBuilding;
|
|
5
|
+
using DREditor.Services;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using System.Linq;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.RoomBuilding
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
public class RoomStateManager : RoomManagerBase
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
public RoomStateBuilder Builder = null;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
public List<MonoBehaviour> loadHandlers = new();
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
public List<IRoomStateLoader> loaders = new();
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
public List<IRoomStateSaver> savers = new();
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <param name="Builder"></param>
|
|
42
|
+
public virtual void SetBuilder(RoomStateBuilder Builder) => this.Builder = Builder;
|
|
43
|
+
|
|
44
|
+
/// <inheritdoc/>
|
|
45
|
+
protected override void Awake()
|
|
46
|
+
{
|
|
47
|
+
dontDestroyOnLoad = false;
|
|
48
|
+
|
|
49
|
+
base.Awake();
|
|
50
|
+
|
|
51
|
+
InitializeHandlers();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
public virtual void InitializeHandlers()
|
|
58
|
+
{
|
|
59
|
+
savers = loadHandlers.OfType<IRoomStateSaver>().ToList();
|
|
60
|
+
|
|
61
|
+
loaders = loadHandlers.OfType<IRoomStateLoader>().ToList();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// <inheritdoc/>
|
|
65
|
+
public override bool HasBase(int chapterNum, object pValue)
|
|
66
|
+
{
|
|
67
|
+
bool result = Builder.Sections[chapterNum].HasDataFor((Objective)pValue);
|
|
68
|
+
|
|
69
|
+
UnityEngine.Debug.Log("Has Base for current room: " + result);
|
|
70
|
+
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// <inheritdoc/>
|
|
75
|
+
public override object SaveRoomState(object pValue)
|
|
76
|
+
{
|
|
77
|
+
InstanceListWrapper<InstanceListWrapper<string>> instanceTemp = new();
|
|
78
|
+
|
|
79
|
+
foreach (var saver in savers)
|
|
80
|
+
instanceTemp.wrappedInstances.Add(new InstanceListWrapper<string>((List<string>)saver.SaveInstance()));
|
|
81
|
+
|
|
82
|
+
foreach (var listWrapper in instanceTemp.wrappedInstances)
|
|
83
|
+
if (listWrapper.wrappedInstances != null)
|
|
84
|
+
foreach (var wrappedList in listWrapper.wrappedInstances)
|
|
85
|
+
UnityEngine.Debug.Log(wrappedList);
|
|
86
|
+
|
|
87
|
+
UnityEngine.Debug.Log(JsonUtility.ToJson(instanceTemp));
|
|
88
|
+
|
|
89
|
+
return JsonUtility.ToJson(instanceTemp);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// <inheritdoc/>
|
|
93
|
+
public override bool BaseIsPersistent(object pValue)
|
|
94
|
+
{
|
|
95
|
+
var result = GetBaseData((Objective)pValue);
|
|
96
|
+
|
|
97
|
+
return result != null && result.isPersistent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// <inheritdoc/>
|
|
101
|
+
public override void LoadRoomState(object pValue, object data)
|
|
102
|
+
{
|
|
103
|
+
var currentChapter = ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter();
|
|
104
|
+
|
|
105
|
+
RoomStateSection current = Builder.Sections
|
|
106
|
+
.Find(section => section.Chapter == currentChapter);
|
|
107
|
+
|
|
108
|
+
if (current == null || !currentChapter.HasObjective((Objective)pValue))
|
|
109
|
+
{
|
|
110
|
+
UnityEngine.Debug.LogWarning("REPORT: ROOM BUILDER DID NOT HAVE A ROOM SECTION FOR THAT CHAPTER");
|
|
111
|
+
|
|
112
|
+
current = Builder.Sections[0];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
RoomStateData baseRoom = GetBaseData((Objective)pValue, current);
|
|
116
|
+
|
|
117
|
+
baseRoom = baseRoom == null ? OnBaseRoomEmpty((Objective)pValue, current) : baseRoom;
|
|
118
|
+
|
|
119
|
+
if (data != null && baseRoom != null)
|
|
120
|
+
LoadInstance(baseRoom, data);
|
|
121
|
+
else
|
|
122
|
+
LoadRoomFromHandlers(baseRoom);
|
|
123
|
+
|
|
124
|
+
onRoomInstanceLoaded.SetValue(true);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/// <summary>
|
|
128
|
+
///
|
|
129
|
+
/// </summary>
|
|
130
|
+
/// <param name="pValue"></param>
|
|
131
|
+
/// <param name="current"></param>
|
|
132
|
+
/// <returns></returns>
|
|
133
|
+
protected virtual RoomStateData OnBaseRoomEmpty(Objective pValue, RoomStateSection current)
|
|
134
|
+
{
|
|
135
|
+
UnityEngine.Debug.Log("Couldn't find Base Room data for Objective: " + pValue.Description + " " +
|
|
136
|
+
"within chapter: " + current.Chapter.name + ", Checking for Room Shell.");
|
|
137
|
+
|
|
138
|
+
int shellIndex = Builder.Sections.IndexOf(current);
|
|
139
|
+
|
|
140
|
+
if (shellIndex < Builder.Shells.Count)
|
|
141
|
+
{
|
|
142
|
+
UnityEngine.Debug.Log("Shell Data has been found! Loading Shell...");
|
|
143
|
+
|
|
144
|
+
return Builder.Shells[shellIndex];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
UnityEngine.Debug.Log($"No Shell Data Has been Filled at index {shellIndex}, Loading Empty Shell");
|
|
148
|
+
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/// <summary>
|
|
153
|
+
///
|
|
154
|
+
/// </summary>
|
|
155
|
+
/// <param name="pValue"></param>
|
|
156
|
+
/// <returns></returns>
|
|
157
|
+
protected virtual RoomStateData GetBaseData(Objective pValue)
|
|
158
|
+
{
|
|
159
|
+
RoomStateSection current = Builder.Sections
|
|
160
|
+
.Find(section => section.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
161
|
+
|
|
162
|
+
return GetBaseData(pValue, current);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/// <summary>
|
|
166
|
+
///
|
|
167
|
+
/// </summary>
|
|
168
|
+
/// <param name="pValue"></param>
|
|
169
|
+
/// <param name="current"></param>
|
|
170
|
+
/// <returns></returns>
|
|
171
|
+
protected virtual RoomStateData GetBaseData(Objective pValue, RoomStateSection current) =>
|
|
172
|
+
current.Rooms.FirstOrDefault(room => room.progressionValue.Description == pValue.Description);
|
|
173
|
+
|
|
174
|
+
/// <summary>
|
|
175
|
+
///
|
|
176
|
+
/// </summary>
|
|
177
|
+
/// <param name="room"></param>
|
|
178
|
+
public virtual void LoadRoomFromHandlers(RoomStateData room)
|
|
179
|
+
{
|
|
180
|
+
if (room != null)
|
|
181
|
+
foreach (var loader in loaders)
|
|
182
|
+
loader?.LoadData(room.dataStates);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/// <summary>
|
|
186
|
+
///
|
|
187
|
+
/// </summary>
|
|
188
|
+
/// <param name="room"></param>
|
|
189
|
+
/// <param name="instanceRoom"></param>
|
|
190
|
+
protected virtual void LoadInstance(RoomStateData room, object instanceRoom = null)
|
|
191
|
+
{
|
|
192
|
+
foreach (var loader in loaders)
|
|
193
|
+
loader.LoadInstance(room.dataStates, instanceRoom);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/// <inheritdoc/>
|
|
197
|
+
public override void UnloadAll(bool inEditor)
|
|
198
|
+
{
|
|
199
|
+
foreach (var loader in loaders)
|
|
200
|
+
loader.Unload(inEditor);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
203
|
}
|
package/RoomStateManager.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: c16bc9c0733fcc54aa978ab5095dd5f1
|
|
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: c16bc9c0733fcc54aa978ab5095dd5f1
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|