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/Old/RoomManager.cs
CHANGED
|
@@ -1,257 +1,257 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues.Events;
|
|
3
|
-
using DREditor.Progressing;
|
|
4
|
-
using DREditor.Progressing.Handling;
|
|
5
|
-
using DREditor.RoomBuilding.Implementation;
|
|
6
|
-
using DREditor.Services;
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
|
|
9
|
-
namespace DREditor.RoomBuilding.Old
|
|
10
|
-
{
|
|
11
|
-
/// <summary>
|
|
12
|
-
///
|
|
13
|
-
/// </summary>
|
|
14
|
-
public class RoomManager : RoomManagerBase
|
|
15
|
-
{
|
|
16
|
-
public RoomBuilder Builder = null;
|
|
17
|
-
|
|
18
|
-
public void SetBuilder(RoomBuilder Builder) => this.Builder = Builder;
|
|
19
|
-
|
|
20
|
-
/// <inheritdoc/>
|
|
21
|
-
protected override void Awake()
|
|
22
|
-
{
|
|
23
|
-
base.Awake();
|
|
24
|
-
|
|
25
|
-
DialogueEventSystem.StartListening("LoadInvestigationRoom", LoadInvestigationInstance);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private void OnDisable()
|
|
29
|
-
{
|
|
30
|
-
DialogueEventSystem.StopListening("LoadInvestigationRoom", LoadInvestigationInstance);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/// <inheritdoc/>
|
|
34
|
-
public override bool HasBase(int chapterNum, object pValue)
|
|
35
|
-
{
|
|
36
|
-
bool result = Builder.Sections[chapterNum].HasDataFor((Objective)pValue);
|
|
37
|
-
|
|
38
|
-
UnityEngine.Debug.Log("Has Base for current room: " + result);
|
|
39
|
-
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/// <inheritdoc/>
|
|
44
|
-
public override object SaveRoomState(object pValue)
|
|
45
|
-
{
|
|
46
|
-
RoomData roomI = NewSaveRoom((Objective)pValue);
|
|
47
|
-
|
|
48
|
-
RoomData baseRoom = GetBaseData((Objective)pValue);
|
|
49
|
-
|
|
50
|
-
if (baseRoom != null)
|
|
51
|
-
roomI.SetPersistent(baseRoom.isPersistent);
|
|
52
|
-
|
|
53
|
-
//onRoomSaved.SetValue(true);
|
|
54
|
-
|
|
55
|
-
UnityEngine.Debug.Log(JsonUtility.ToJson(roomI));
|
|
56
|
-
|
|
57
|
-
return roomI;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
RoomData GetBaseData(Objective pValue)
|
|
61
|
-
{
|
|
62
|
-
RoomSection current = Builder.Sections.Find(n => n.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
63
|
-
|
|
64
|
-
for (int i = 0; i < current.Rooms.Count; i++)
|
|
65
|
-
if (current.Rooms[i].progressionValue.Description == pValue.Description)
|
|
66
|
-
return current.Rooms[i];
|
|
67
|
-
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public RoomData NewSaveRoom(Objective pValue)
|
|
72
|
-
{
|
|
73
|
-
RoomData room = new(pValue);
|
|
74
|
-
|
|
75
|
-
room = Save(room);
|
|
76
|
-
|
|
77
|
-
return room;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public RoomData OverwriteRoom(RoomData room)
|
|
81
|
-
{
|
|
82
|
-
room = Save(room);
|
|
83
|
-
|
|
84
|
-
return room;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
RoomData Save(RoomData room)
|
|
88
|
-
{
|
|
89
|
-
room.SetActorDatas(ActorLoader.Save());
|
|
90
|
-
|
|
91
|
-
room.SetItemDatas(ItemActorLoader.SaveItems());
|
|
92
|
-
|
|
93
|
-
room.Save();
|
|
94
|
-
|
|
95
|
-
return room;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public void LoadRoom(RoomData room, RoomData instanceRoom = null)
|
|
99
|
-
{
|
|
100
|
-
if (room != null)
|
|
101
|
-
{
|
|
102
|
-
UnityEngine.Debug.Log("Loading Room Save: " + room.progressionValue.Description);
|
|
103
|
-
|
|
104
|
-
SpawnableLoader.LoadSpawnables(room.spawnDatas);
|
|
105
|
-
|
|
106
|
-
ActorLoader.Load(room, instanceRoom);
|
|
107
|
-
|
|
108
|
-
ItemActorLoader.LoadItems(room.itemDatas, instanceRoom?.itemDatas);
|
|
109
|
-
|
|
110
|
-
if (instanceRoom != null)
|
|
111
|
-
{
|
|
112
|
-
TriggerLoader.Load(room.triggers, instanceRoom.triggers);
|
|
113
|
-
|
|
114
|
-
SubAreaLoader.Load(room.subAreas, instanceRoom.subAreas);
|
|
115
|
-
|
|
116
|
-
DoorLoader.Load(room.doorDatas, instanceRoom.doorDatas);
|
|
117
|
-
|
|
118
|
-
MoveLoader.Load(room.moveDatas, instanceRoom.moveDatas);
|
|
119
|
-
|
|
120
|
-
SaveableManager.Load(room.saveables);
|
|
121
|
-
|
|
122
|
-
SaveableManager.Load(instanceRoom.saveables);
|
|
123
|
-
}
|
|
124
|
-
else
|
|
125
|
-
{
|
|
126
|
-
TriggerLoader.Load(room.triggers);
|
|
127
|
-
|
|
128
|
-
SubAreaLoader.Load(room.subAreas);
|
|
129
|
-
|
|
130
|
-
DoorLoader.Load(room.doorDatas);
|
|
131
|
-
|
|
132
|
-
MoveLoader.Load(room.moveDatas);
|
|
133
|
-
|
|
134
|
-
SaveableManager.Load(room.saveables);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/// <inheritdoc/>
|
|
141
|
-
public override void LoadRoomState(object pValue, object data) // To Load Rooms in Game
|
|
142
|
-
{
|
|
143
|
-
RoomSection current = Builder.Sections
|
|
144
|
-
.Find(n => n.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
145
|
-
|
|
146
|
-
if (current == null)
|
|
147
|
-
{
|
|
148
|
-
UnityEngine.Debug.LogWarning("REPORT: ROOM BUILDER DID NOT HAVE A ROOM SECTION FOR THAT CHAPTER");
|
|
149
|
-
|
|
150
|
-
current = Builder.Sections[0];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
RoomData baseRoom = null;
|
|
154
|
-
|
|
155
|
-
for (int i = 0; i < current.Rooms.Count; i++)
|
|
156
|
-
{
|
|
157
|
-
RoomData room = current.Rooms[i];
|
|
158
|
-
|
|
159
|
-
if (room.progressionValue.Description == ((Objective)pValue).Description)
|
|
160
|
-
{
|
|
161
|
-
baseRoom = room;
|
|
162
|
-
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (baseRoom == null)
|
|
168
|
-
FindBaseRoomState(out baseRoom, pValue, data);
|
|
169
|
-
|
|
170
|
-
if (baseRoom == null)
|
|
171
|
-
SetBaseRoomToShell(out baseRoom, pValue);
|
|
172
|
-
|
|
173
|
-
if (data != null && baseRoom != null) // Has Instance Data
|
|
174
|
-
LoadRoom(baseRoom, (RoomData)data);
|
|
175
|
-
else
|
|
176
|
-
LoadRoom(baseRoom);
|
|
177
|
-
|
|
178
|
-
onRoomInstanceLoaded.SetValue(true);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
void FindBaseRoomState(out RoomData baseRoom, object pValue = null, object data = null)
|
|
183
|
-
{
|
|
184
|
-
RoomSection current = Builder.Sections
|
|
185
|
-
.Find(n => n.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
186
|
-
|
|
187
|
-
baseRoom = null;
|
|
188
|
-
|
|
189
|
-
bool found = false;
|
|
190
|
-
|
|
191
|
-
for (int x = 0; x < Builder.Sections.Count; x++)
|
|
192
|
-
{
|
|
193
|
-
current = Builder.Sections[x];
|
|
194
|
-
|
|
195
|
-
for (int i = 0; i < current.Rooms.Count; i++)
|
|
196
|
-
{
|
|
197
|
-
RoomData room = current.Rooms[i];
|
|
198
|
-
|
|
199
|
-
if (room.progressionValue.Description == ((Objective)pValue).Description ||
|
|
200
|
-
(data != null &&
|
|
201
|
-
room.progressionValue.Description == ((RoomData)data).progressionValue.Description))
|
|
202
|
-
{
|
|
203
|
-
found = true;
|
|
204
|
-
|
|
205
|
-
baseRoom = room;
|
|
206
|
-
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (found)
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
void SetBaseRoomToShell(out RoomData baseRoom, object pValue = null)
|
|
218
|
-
{
|
|
219
|
-
baseRoom = null;
|
|
220
|
-
|
|
221
|
-
UnityEngine.Debug.Log("Couldn't find Base Room data for Objective: " + ((Objective)pValue).Description +
|
|
222
|
-
" , Checking for Room Shell.");
|
|
223
|
-
|
|
224
|
-
if (Builder.Shells.Count != 0)
|
|
225
|
-
UnityEngine.Debug.Log("Shell Data has been found! Loading Shell...");
|
|
226
|
-
|
|
227
|
-
if (Builder.Shells.Count != 0)
|
|
228
|
-
baseRoom = Builder.Shells[0];
|
|
229
|
-
else
|
|
230
|
-
UnityEngine.Debug.Log("No Shell Data Has been Filled, Loading Empty Shell");
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/// <inheritdoc/>
|
|
235
|
-
public override bool BaseIsPersistent(object pValue)
|
|
236
|
-
{
|
|
237
|
-
return GetBaseData((Objective)pValue).isPersistent;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
void LoadInvestigationInstance(object o = null)
|
|
241
|
-
{
|
|
242
|
-
ActorLoader.UnloadActors(false);
|
|
243
|
-
|
|
244
|
-
TriggerLoader.UnloadEvents();
|
|
245
|
-
|
|
246
|
-
LoadRoomState((Objective)o, null);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/// <inheritdoc/>
|
|
250
|
-
public override void UnloadAll(bool inEditor)
|
|
251
|
-
{
|
|
252
|
-
ActorLoader.UnloadActors(false);
|
|
253
|
-
|
|
254
|
-
TriggerLoader.UnloadEvents();
|
|
255
|
-
}
|
|
256
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues.Events;
|
|
3
|
+
using DREditor.Progressing;
|
|
4
|
+
using DREditor.Progressing.Handling;
|
|
5
|
+
using DREditor.RoomBuilding.Implementation;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.RoomBuilding.Old
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
public class RoomManager : RoomManagerBase
|
|
15
|
+
{
|
|
16
|
+
public RoomBuilder Builder = null;
|
|
17
|
+
|
|
18
|
+
public void SetBuilder(RoomBuilder Builder) => this.Builder = Builder;
|
|
19
|
+
|
|
20
|
+
/// <inheritdoc/>
|
|
21
|
+
protected override void Awake()
|
|
22
|
+
{
|
|
23
|
+
base.Awake();
|
|
24
|
+
|
|
25
|
+
DialogueEventSystem.StartListening("LoadInvestigationRoom", LoadInvestigationInstance);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private void OnDisable()
|
|
29
|
+
{
|
|
30
|
+
DialogueEventSystem.StopListening("LoadInvestigationRoom", LoadInvestigationInstance);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// <inheritdoc/>
|
|
34
|
+
public override bool HasBase(int chapterNum, object pValue)
|
|
35
|
+
{
|
|
36
|
+
bool result = Builder.Sections[chapterNum].HasDataFor((Objective)pValue);
|
|
37
|
+
|
|
38
|
+
UnityEngine.Debug.Log("Has Base for current room: " + result);
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// <inheritdoc/>
|
|
44
|
+
public override object SaveRoomState(object pValue)
|
|
45
|
+
{
|
|
46
|
+
RoomData roomI = NewSaveRoom((Objective)pValue);
|
|
47
|
+
|
|
48
|
+
RoomData baseRoom = GetBaseData((Objective)pValue);
|
|
49
|
+
|
|
50
|
+
if (baseRoom != null)
|
|
51
|
+
roomI.SetPersistent(baseRoom.isPersistent);
|
|
52
|
+
|
|
53
|
+
//onRoomSaved.SetValue(true);
|
|
54
|
+
|
|
55
|
+
UnityEngine.Debug.Log(JsonUtility.ToJson(roomI));
|
|
56
|
+
|
|
57
|
+
return roomI;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
RoomData GetBaseData(Objective pValue)
|
|
61
|
+
{
|
|
62
|
+
RoomSection current = Builder.Sections.Find(n => n.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
63
|
+
|
|
64
|
+
for (int i = 0; i < current.Rooms.Count; i++)
|
|
65
|
+
if (current.Rooms[i].progressionValue.Description == pValue.Description)
|
|
66
|
+
return current.Rooms[i];
|
|
67
|
+
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public RoomData NewSaveRoom(Objective pValue)
|
|
72
|
+
{
|
|
73
|
+
RoomData room = new(pValue);
|
|
74
|
+
|
|
75
|
+
room = Save(room);
|
|
76
|
+
|
|
77
|
+
return room;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public RoomData OverwriteRoom(RoomData room)
|
|
81
|
+
{
|
|
82
|
+
room = Save(room);
|
|
83
|
+
|
|
84
|
+
return room;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
RoomData Save(RoomData room)
|
|
88
|
+
{
|
|
89
|
+
room.SetActorDatas(ActorLoader.Save());
|
|
90
|
+
|
|
91
|
+
room.SetItemDatas(ItemActorLoader.SaveItems());
|
|
92
|
+
|
|
93
|
+
room.Save();
|
|
94
|
+
|
|
95
|
+
return room;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public void LoadRoom(RoomData room, RoomData instanceRoom = null)
|
|
99
|
+
{
|
|
100
|
+
if (room != null)
|
|
101
|
+
{
|
|
102
|
+
UnityEngine.Debug.Log("Loading Room Save: " + room.progressionValue.Description);
|
|
103
|
+
|
|
104
|
+
SpawnableLoader.LoadSpawnables(room.spawnDatas);
|
|
105
|
+
|
|
106
|
+
ActorLoader.Load(room, instanceRoom);
|
|
107
|
+
|
|
108
|
+
ItemActorLoader.LoadItems(room.itemDatas, instanceRoom?.itemDatas);
|
|
109
|
+
|
|
110
|
+
if (instanceRoom != null)
|
|
111
|
+
{
|
|
112
|
+
TriggerLoader.Load(room.triggers, instanceRoom.triggers);
|
|
113
|
+
|
|
114
|
+
SubAreaLoader.Load(room.subAreas, instanceRoom.subAreas);
|
|
115
|
+
|
|
116
|
+
DoorLoader.Load(room.doorDatas, instanceRoom.doorDatas);
|
|
117
|
+
|
|
118
|
+
MoveLoader.Load(room.moveDatas, instanceRoom.moveDatas);
|
|
119
|
+
|
|
120
|
+
SaveableManager.Load(room.saveables);
|
|
121
|
+
|
|
122
|
+
SaveableManager.Load(instanceRoom.saveables);
|
|
123
|
+
}
|
|
124
|
+
else
|
|
125
|
+
{
|
|
126
|
+
TriggerLoader.Load(room.triggers);
|
|
127
|
+
|
|
128
|
+
SubAreaLoader.Load(room.subAreas);
|
|
129
|
+
|
|
130
|
+
DoorLoader.Load(room.doorDatas);
|
|
131
|
+
|
|
132
|
+
MoveLoader.Load(room.moveDatas);
|
|
133
|
+
|
|
134
|
+
SaveableManager.Load(room.saveables);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// <inheritdoc/>
|
|
141
|
+
public override void LoadRoomState(object pValue, object data) // To Load Rooms in Game
|
|
142
|
+
{
|
|
143
|
+
RoomSection current = Builder.Sections
|
|
144
|
+
.Find(n => n.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
145
|
+
|
|
146
|
+
if (current == null)
|
|
147
|
+
{
|
|
148
|
+
UnityEngine.Debug.LogWarning("REPORT: ROOM BUILDER DID NOT HAVE A ROOM SECTION FOR THAT CHAPTER");
|
|
149
|
+
|
|
150
|
+
current = Builder.Sections[0];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
RoomData baseRoom = null;
|
|
154
|
+
|
|
155
|
+
for (int i = 0; i < current.Rooms.Count; i++)
|
|
156
|
+
{
|
|
157
|
+
RoomData room = current.Rooms[i];
|
|
158
|
+
|
|
159
|
+
if (room.progressionValue.Description == ((Objective)pValue).Description)
|
|
160
|
+
{
|
|
161
|
+
baseRoom = room;
|
|
162
|
+
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (baseRoom == null)
|
|
168
|
+
FindBaseRoomState(out baseRoom, pValue, data);
|
|
169
|
+
|
|
170
|
+
if (baseRoom == null)
|
|
171
|
+
SetBaseRoomToShell(out baseRoom, pValue);
|
|
172
|
+
|
|
173
|
+
if (data != null && baseRoom != null) // Has Instance Data
|
|
174
|
+
LoadRoom(baseRoom, (RoomData)data);
|
|
175
|
+
else
|
|
176
|
+
LoadRoom(baseRoom);
|
|
177
|
+
|
|
178
|
+
onRoomInstanceLoaded.SetValue(true);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
void FindBaseRoomState(out RoomData baseRoom, object pValue = null, object data = null)
|
|
183
|
+
{
|
|
184
|
+
RoomSection current = Builder.Sections
|
|
185
|
+
.Find(n => n.Chapter == ServiceLocator.GetService<ProgressionManagerBase>().GetCurrentChapter());
|
|
186
|
+
|
|
187
|
+
baseRoom = null;
|
|
188
|
+
|
|
189
|
+
bool found = false;
|
|
190
|
+
|
|
191
|
+
for (int x = 0; x < Builder.Sections.Count; x++)
|
|
192
|
+
{
|
|
193
|
+
current = Builder.Sections[x];
|
|
194
|
+
|
|
195
|
+
for (int i = 0; i < current.Rooms.Count; i++)
|
|
196
|
+
{
|
|
197
|
+
RoomData room = current.Rooms[i];
|
|
198
|
+
|
|
199
|
+
if (room.progressionValue.Description == ((Objective)pValue).Description ||
|
|
200
|
+
(data != null &&
|
|
201
|
+
room.progressionValue.Description == ((RoomData)data).progressionValue.Description))
|
|
202
|
+
{
|
|
203
|
+
found = true;
|
|
204
|
+
|
|
205
|
+
baseRoom = room;
|
|
206
|
+
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (found)
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
void SetBaseRoomToShell(out RoomData baseRoom, object pValue = null)
|
|
218
|
+
{
|
|
219
|
+
baseRoom = null;
|
|
220
|
+
|
|
221
|
+
UnityEngine.Debug.Log("Couldn't find Base Room data for Objective: " + ((Objective)pValue).Description +
|
|
222
|
+
" , Checking for Room Shell.");
|
|
223
|
+
|
|
224
|
+
if (Builder.Shells.Count != 0)
|
|
225
|
+
UnityEngine.Debug.Log("Shell Data has been found! Loading Shell...");
|
|
226
|
+
|
|
227
|
+
if (Builder.Shells.Count != 0)
|
|
228
|
+
baseRoom = Builder.Shells[0];
|
|
229
|
+
else
|
|
230
|
+
UnityEngine.Debug.Log("No Shell Data Has been Filled, Loading Empty Shell");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
/// <inheritdoc/>
|
|
235
|
+
public override bool BaseIsPersistent(object pValue)
|
|
236
|
+
{
|
|
237
|
+
return GetBaseData((Objective)pValue).isPersistent;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
void LoadInvestigationInstance(object o = null)
|
|
241
|
+
{
|
|
242
|
+
ActorLoader.UnloadActors(false);
|
|
243
|
+
|
|
244
|
+
TriggerLoader.UnloadEvents();
|
|
245
|
+
|
|
246
|
+
LoadRoomState((Objective)o, null);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/// <inheritdoc/>
|
|
250
|
+
public override void UnloadAll(bool inEditor)
|
|
251
|
+
{
|
|
252
|
+
ActorLoader.UnloadActors(false);
|
|
253
|
+
|
|
254
|
+
TriggerLoader.UnloadEvents();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
257
|
}
|
package/Old/RoomManager.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 037bda07ee3eb20408028af70a5c7705
|
|
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: 037bda07ee3eb20408028af70a5c7705
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|