net.dreditor.debugtesting 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.DebugTesting.asmdef +32 -32
- package/DREditor.DebugTesting.asmdef.meta +7 -7
- package/DebugTester.cs +175 -175
- package/DebugTester.cs.meta +11 -11
- package/DebugTesterBase.cs +157 -157
- package/DebugTesterBase.cs.meta +11 -11
- package/Editor/DREditor.DebugTesting.Editor.asmdef +33 -33
- package/Editor/DREditor.DebugTesting.Editor.asmdef.meta +7 -7
- package/Editor/DebugTesterBaseEditor.cs +74 -74
- package/Editor/DebugTesterBaseEditor.cs.meta +11 -11
- package/Editor/DebugTesterEditor.cs +393 -393
- package/Editor/DebugTesterEditor.cs.meta +11 -11
- package/Editor.meta +8 -8
- package/{Samples → Samples~}/Debug_Tester_ETemplate.prefab +92 -92
- package/{Samples → Samples~}/Debug_Tester_ETemplate.prefab.meta +7 -7
- package/package.json +54 -49
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
|
@@ -1,394 +1,394 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using DREditor.Editor.Utility;
|
|
4
|
-
using DREditor.Gates;
|
|
5
|
-
using DREditor.Progressing;
|
|
6
|
-
using DREditor.RoomBuilding;
|
|
7
|
-
using DREditor.Utility;
|
|
8
|
-
using System.Collections.Generic;
|
|
9
|
-
using System.Linq;
|
|
10
|
-
using UnityEditor;
|
|
11
|
-
using UnityEngine;
|
|
12
|
-
|
|
13
|
-
namespace DREditor.DebugTesting.Editor
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
[CustomEditor(typeof(DebugTester))]
|
|
19
|
-
public class DebugTesterEditor : DebugTesterBaseEditor
|
|
20
|
-
{
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
protected DebugTester tester;
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
///
|
|
28
|
-
/// </summary>
|
|
29
|
-
protected GateDatabase gateDatabase;
|
|
30
|
-
|
|
31
|
-
/// <summary>
|
|
32
|
-
///
|
|
33
|
-
/// </summary>
|
|
34
|
-
protected ProgressionDatabase progressionDatabase;
|
|
35
|
-
|
|
36
|
-
/// <summary>
|
|
37
|
-
///
|
|
38
|
-
/// </summary>
|
|
39
|
-
protected List<RoomStateBuilder> RoomStateBuilders;
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
protected UnityEditor.Editor cachedEditor;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
protected virtual void OnEnable()
|
|
48
|
-
{
|
|
49
|
-
tester = target as DebugTester;
|
|
50
|
-
|
|
51
|
-
gateDatabase = DatabaseUtility.LoadDatabase<GateDatabase>();
|
|
52
|
-
|
|
53
|
-
progressionDatabase = DatabaseUtility.LoadDatabase<ProgressionDatabase>();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
protected virtual void OnDisable()
|
|
57
|
-
{
|
|
58
|
-
if (cachedEditor != null)
|
|
59
|
-
DestroyImmediate(cachedEditor);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/// <inheritdoc/>
|
|
64
|
-
protected override bool PassInitialization() => gateDatabase != null && progressionDatabase != null;
|
|
65
|
-
|
|
66
|
-
/// <summary>
|
|
67
|
-
///
|
|
68
|
-
/// </summary>
|
|
69
|
-
protected override void CreateForm()
|
|
70
|
-
{
|
|
71
|
-
base.CreateForm();
|
|
72
|
-
|
|
73
|
-
DisplayPauseData();
|
|
74
|
-
|
|
75
|
-
DisplayState();
|
|
76
|
-
|
|
77
|
-
DisplayChapter();
|
|
78
|
-
|
|
79
|
-
DisplayGates();
|
|
80
|
-
|
|
81
|
-
DisplayPointInTime();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
#region Display Objects and Events
|
|
85
|
-
|
|
86
|
-
/// <summary>
|
|
87
|
-
///
|
|
88
|
-
/// </summary>
|
|
89
|
-
protected virtual void DisplayPauseData()
|
|
90
|
-
{
|
|
91
|
-
if (tester.pauseData != null)
|
|
92
|
-
DrawFoldoutInspector(tester.pauseData, ref cachedEditor);
|
|
93
|
-
|
|
94
|
-
GUILayout.Space(10);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/// <summary>
|
|
98
|
-
///
|
|
99
|
-
/// </summary>
|
|
100
|
-
protected virtual void DisplayState()
|
|
101
|
-
{
|
|
102
|
-
string[] names = tester.stateDatabase != null ? tester.stateDatabase.GetStateNames() : new string[0];
|
|
103
|
-
|
|
104
|
-
int dropdownWidth = names.Length > 0 ? names[tester.state].Length : 0;
|
|
105
|
-
|
|
106
|
-
tester.SetState(HandyFields.IntDropdown("State: ", tester.state, names, dropdownWidth));
|
|
107
|
-
|
|
108
|
-
GUILayout.Space(10);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/// <summary>
|
|
112
|
-
///
|
|
113
|
-
/// </summary>
|
|
114
|
-
protected virtual void DisplayChapter()
|
|
115
|
-
{
|
|
116
|
-
string[] names = progressionDatabase != null ? progressionDatabase.GetAllChapterNames() : new string[0];
|
|
117
|
-
|
|
118
|
-
int dropdownWidth = names.Length > 0 ? names[tester.chapterIndex].Length : 0;
|
|
119
|
-
|
|
120
|
-
tester.SetChapterIndex(HandyFields.IntDropdown("Chapter: ", tester.chapterIndex, names, dropdownWidth));
|
|
121
|
-
|
|
122
|
-
GUILayout.Space(10);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
#endregion
|
|
126
|
-
|
|
127
|
-
#region Display Gates
|
|
128
|
-
|
|
129
|
-
/// <summary>
|
|
130
|
-
///
|
|
131
|
-
/// </summary>
|
|
132
|
-
protected virtual void DisplayGates()
|
|
133
|
-
{
|
|
134
|
-
DisplayGoingToGate();
|
|
135
|
-
|
|
136
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
137
|
-
{
|
|
138
|
-
DisplayInvestigationGates();
|
|
139
|
-
|
|
140
|
-
DisplayFromGate();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
DisplayDefaultFromGate();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/// <summary>
|
|
147
|
-
///
|
|
148
|
-
/// </summary>
|
|
149
|
-
protected virtual void DisplayGoingToGate()
|
|
150
|
-
{
|
|
151
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
152
|
-
{
|
|
153
|
-
EditorGUILayout.LabelField("Going To: ", GUILayout.MaxWidth(100));
|
|
154
|
-
|
|
155
|
-
var gateNames = ContainerUtil.PrependedList(gateDatabase.GetGateNames(), "No Gate");
|
|
156
|
-
|
|
157
|
-
int[] nameIndexes = ContainerUtil.Iota(gateNames.Length, -1);
|
|
158
|
-
|
|
159
|
-
int gateIndex = EditorGUILayout.IntPopup(tester.toGateIdx, gateNames,
|
|
160
|
-
nameIndexes, GUILayout.MaxWidth(130));
|
|
161
|
-
|
|
162
|
-
tester.SetToGate(gateIndex, tester.toGateIdx == -1 ? null : gateDatabase.Areas[tester.toGateIdx]);
|
|
163
|
-
|
|
164
|
-
if (tester.toGate == null && serializedObject.FindProperty("GoToScene") is SerializedProperty sceneProperty)
|
|
165
|
-
HandyFields.HardPropertyField("Scene Name: ", sceneProperty);
|
|
166
|
-
else if (tester.toGateIdx < gateDatabase.Areas.Count && tester.toGateIdx > 0)
|
|
167
|
-
tester.SetToGate(gateIndex, gateDatabase.Areas[tester.toGateIdx]);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (tester.toGate != null && tester.toGate.isTPFD)
|
|
171
|
-
EditorGUILayout.LabelField("TPFD Room", GUILayout.MaxWidth(100));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
GUILayout.Space(10);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/// <summary>
|
|
178
|
-
///
|
|
179
|
-
/// </summary>
|
|
180
|
-
protected virtual void DisplayInvestigationGates()
|
|
181
|
-
{
|
|
182
|
-
if (tester.toGate == null || tester.toGate.fromLocations.Count == 0)
|
|
183
|
-
return;
|
|
184
|
-
|
|
185
|
-
string toScene = "";
|
|
186
|
-
|
|
187
|
-
int investigationGateIndex = -1;
|
|
188
|
-
|
|
189
|
-
if (tester.toGate.invGates.Count > 0)
|
|
190
|
-
{
|
|
191
|
-
EditorGUILayout.LabelField("Inv Gate: ", GUILayout.MaxWidth(100));
|
|
192
|
-
|
|
193
|
-
string[] investigationGateNames = ContainerUtil
|
|
194
|
-
.PrependedList(tester.toGate.invGates.Select(invGate => invGate.sceneName).ToArray(), "None");
|
|
195
|
-
|
|
196
|
-
if (investigationGateNames.Length > 0)
|
|
197
|
-
{
|
|
198
|
-
int[] nameIndexes = ContainerUtil.Iota(investigationGateNames.Length, -1);
|
|
199
|
-
|
|
200
|
-
investigationGateIndex = EditorGUILayout.IntPopup(tester.invGateIdx, investigationGateNames,
|
|
201
|
-
nameIndexes, GUILayout.MaxWidth(130));
|
|
202
|
-
|
|
203
|
-
toScene = tester.invGateIdx == -1 ?
|
|
204
|
-
"" : tester.toGate.invGates[tester.invGateIdx].sceneName;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
tester.SetInvestigationScene(toScene, investigationGateIndex);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/// <summary>
|
|
212
|
-
///
|
|
213
|
-
/// </summary>
|
|
214
|
-
protected virtual void DisplayFromGate()
|
|
215
|
-
{
|
|
216
|
-
if (tester.toGate == null || tester.toGate.fromLocations.Count == 0)
|
|
217
|
-
return;
|
|
218
|
-
|
|
219
|
-
var locationList = tester.toGate.fromLocations;
|
|
220
|
-
|
|
221
|
-
EditorGUILayout.LabelField("Coming From: ", GUILayout.MaxWidth(100));
|
|
222
|
-
|
|
223
|
-
var fromGateNames = ContainerUtil
|
|
224
|
-
.PrependedList(locationList.Select(fromGate => fromGate.gateFrom.ToAreaName).ToArray(), "None");
|
|
225
|
-
|
|
226
|
-
int fromGateIndex = tester.fromGateIdx;
|
|
227
|
-
|
|
228
|
-
if (fromGateNames.Length > 0)
|
|
229
|
-
fromGateIndex = EditorGUILayout.IntPopup(tester.fromGateIdx, fromGateNames,
|
|
230
|
-
ContainerUtil.Iota(fromGateNames.Length, -1), GUILayout.MaxWidth(130));
|
|
231
|
-
|
|
232
|
-
bool validFromGateIndex =
|
|
233
|
-
fromGateIndex < locationList.Count &&
|
|
234
|
-
fromGateNames.Length != 0 &&
|
|
235
|
-
fromGateIndex != -1;
|
|
236
|
-
|
|
237
|
-
tester.SetFromGate(fromGateIndex, validFromGateIndex ? locationList[fromGateIndex] : null);
|
|
238
|
-
|
|
239
|
-
GUILayout.Space(10);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/// <summary>
|
|
243
|
-
///
|
|
244
|
-
/// </summary>
|
|
245
|
-
protected virtual void DisplayDefaultFromGate()
|
|
246
|
-
{
|
|
247
|
-
if (tester.fromGate == null)
|
|
248
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
249
|
-
tester.SetPositionAndRotation(HandyFields.Vector3Field("Position: ", tester.position),
|
|
250
|
-
HandyFields.Vector3Field("Rotation: ", tester.rotation));
|
|
251
|
-
|
|
252
|
-
GUILayout.Space(10);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
#endregion
|
|
256
|
-
|
|
257
|
-
#region Display Point In Time
|
|
258
|
-
|
|
259
|
-
/// <summary>
|
|
260
|
-
///
|
|
261
|
-
/// </summary>
|
|
262
|
-
protected virtual void DisplayPointInTime()
|
|
263
|
-
{
|
|
264
|
-
if (tester.toGate == null || !DisplayingValidGameMoment())
|
|
265
|
-
DisplayDefaultMoment();
|
|
266
|
-
|
|
267
|
-
GUILayout.Space(10);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/// <summary>
|
|
271
|
-
///
|
|
272
|
-
/// </summary>
|
|
273
|
-
protected virtual void DisplayDefaultMoment()
|
|
274
|
-
{
|
|
275
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
276
|
-
{
|
|
277
|
-
EditorGUILayout.LabelField("Any Moment: ", GUILayout.Width(100));
|
|
278
|
-
|
|
279
|
-
string[] objectiveNames = progressionDatabase.GetObjectiveNames(tester.chapterIndex);
|
|
280
|
-
|
|
281
|
-
if (objectiveNames != null && objectiveNames.Length != 0)
|
|
282
|
-
{
|
|
283
|
-
int[] nameIndexes = ContainerUtil.Iota(objectiveNames.Length, 0);
|
|
284
|
-
|
|
285
|
-
tester.SetObjectiveIndex(EditorGUILayout.IntPopup(tester.objectiveIndex, objectiveNames,
|
|
286
|
-
nameIndexes, GUILayout.MaxWidth(130)));
|
|
287
|
-
|
|
288
|
-
tester.SetObjective(progressionDatabase.Chapters[tester.chapterIndex].Objectives[tester.objectiveIndex]);
|
|
289
|
-
}
|
|
290
|
-
else
|
|
291
|
-
EditorGUILayout.LabelField("No Available Objectives for that chapter", GUILayout.Width(100));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
GUILayout.Space(10);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/// <summary>
|
|
298
|
-
///
|
|
299
|
-
/// </summary>
|
|
300
|
-
/// <returns></returns>
|
|
301
|
-
protected virtual bool DisplayingValidGameMoment()
|
|
302
|
-
{
|
|
303
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
304
|
-
{
|
|
305
|
-
if (!DisplayBuilder(out RoomStateBuilder builder))
|
|
306
|
-
return false;
|
|
307
|
-
|
|
308
|
-
if (!DisplaySection(builder, out RoomStateSection section))
|
|
309
|
-
return false;
|
|
310
|
-
|
|
311
|
-
DisplayObjectiveInSection(section);
|
|
312
|
-
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/// <summary>
|
|
318
|
-
///
|
|
319
|
-
/// </summary>
|
|
320
|
-
/// <param name="builder"></param>
|
|
321
|
-
/// <returns></returns>
|
|
322
|
-
protected virtual bool DisplayBuilder(out RoomStateBuilder builder)
|
|
323
|
-
{
|
|
324
|
-
string builderName = tester.GoToScene != "" ? tester.GoToScene : tester.toGate.ToAreaName;
|
|
325
|
-
|
|
326
|
-
builder = null;
|
|
327
|
-
|
|
328
|
-
RoomStateBuilders ??= BuilderUtility.FindAssetsByType<RoomStateBuilder>();
|
|
329
|
-
|
|
330
|
-
if (RoomStateBuilders.Count == 0)
|
|
331
|
-
EditorGUILayout.LabelField("Couldn't find room builders");
|
|
332
|
-
|
|
333
|
-
builder = RoomStateBuilders.Find(foundBuilder => foundBuilder.name == builderName);
|
|
334
|
-
|
|
335
|
-
if (builder == null)
|
|
336
|
-
EditorGUILayout.LabelField("Couldn't find builder with Name: " + builderName);
|
|
337
|
-
|
|
338
|
-
return builder != null;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/// <summary>
|
|
342
|
-
///
|
|
343
|
-
/// </summary>
|
|
344
|
-
/// <param name="builder"></param>
|
|
345
|
-
/// <param name="section"></param>
|
|
346
|
-
/// <returns></returns>
|
|
347
|
-
protected virtual bool DisplaySection(RoomStateBuilder builder, out RoomStateSection section)
|
|
348
|
-
{
|
|
349
|
-
section = null;
|
|
350
|
-
|
|
351
|
-
if (builder == null || builder.Sections.Count == 0)
|
|
352
|
-
return false;
|
|
353
|
-
|
|
354
|
-
bool chapterIndexValid = tester.chapterIndex < progressionDatabase.Chapters.Count && tester.chapterIndex >= 0;
|
|
355
|
-
|
|
356
|
-
bool chapterIndexMatches = builder.Sections
|
|
357
|
-
.Any(roomStateSection =>
|
|
358
|
-
progressionDatabase.GetChapterIndex(roomStateSection.Chapter) == tester.chapterIndex);
|
|
359
|
-
|
|
360
|
-
if (chapterIndexValid && chapterIndexMatches)
|
|
361
|
-
section = builder.Sections[tester.chapterIndex];
|
|
362
|
-
|
|
363
|
-
if (section == null)
|
|
364
|
-
EditorGUILayout.LabelField("Couldn't find builds of room at the specified chapter");
|
|
365
|
-
|
|
366
|
-
if (section.Rooms.Count == 0)
|
|
367
|
-
EditorGUILayout.LabelField("Section had no Room Saves");
|
|
368
|
-
|
|
369
|
-
return section != null && section.Rooms.Count != 0;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/// <summary>
|
|
373
|
-
///
|
|
374
|
-
/// </summary>
|
|
375
|
-
/// <param name="section"></param>
|
|
376
|
-
protected virtual void DisplayObjectiveInSection(RoomStateSection section)
|
|
377
|
-
{
|
|
378
|
-
EditorGUILayout.LabelField("At Moment: ", GUILayout.Width(100));
|
|
379
|
-
|
|
380
|
-
string[] rooms = section.Rooms.Select(roomStateData => roomStateData.progressionValue.Description).ToArray();
|
|
381
|
-
|
|
382
|
-
int[] roomIndexes = ContainerUtil.Iota(rooms.Length, 0);
|
|
383
|
-
|
|
384
|
-
tester.SetObjectiveIndex(EditorGUILayout.IntPopup(tester.objectiveIndex, rooms,
|
|
385
|
-
roomIndexes, GUILayout.MaxWidth(130)));
|
|
386
|
-
|
|
387
|
-
if (section.Rooms.Count > 0 && tester.objectiveIndex < section.Rooms.Count)
|
|
388
|
-
tester.SetObjective(section.Rooms[tester.objectiveIndex].progressionValue);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
#endregion
|
|
392
|
-
}
|
|
393
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Editor.Utility;
|
|
4
|
+
using DREditor.Gates;
|
|
5
|
+
using DREditor.Progressing;
|
|
6
|
+
using DREditor.RoomBuilding;
|
|
7
|
+
using DREditor.Utility;
|
|
8
|
+
using System.Collections.Generic;
|
|
9
|
+
using System.Linq;
|
|
10
|
+
using UnityEditor;
|
|
11
|
+
using UnityEngine;
|
|
12
|
+
|
|
13
|
+
namespace DREditor.DebugTesting.Editor
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[CustomEditor(typeof(DebugTester))]
|
|
19
|
+
public class DebugTesterEditor : DebugTesterBaseEditor
|
|
20
|
+
{
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
protected DebugTester tester;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
protected GateDatabase gateDatabase;
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
protected ProgressionDatabase progressionDatabase;
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
protected List<RoomStateBuilder> RoomStateBuilders;
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
protected UnityEditor.Editor cachedEditor;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
protected virtual void OnEnable()
|
|
48
|
+
{
|
|
49
|
+
tester = target as DebugTester;
|
|
50
|
+
|
|
51
|
+
gateDatabase = DatabaseUtility.LoadDatabase<GateDatabase>();
|
|
52
|
+
|
|
53
|
+
progressionDatabase = DatabaseUtility.LoadDatabase<ProgressionDatabase>();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected virtual void OnDisable()
|
|
57
|
+
{
|
|
58
|
+
if (cachedEditor != null)
|
|
59
|
+
DestroyImmediate(cachedEditor);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/// <inheritdoc/>
|
|
64
|
+
protected override bool PassInitialization() => gateDatabase != null && progressionDatabase != null;
|
|
65
|
+
|
|
66
|
+
/// <summary>
|
|
67
|
+
///
|
|
68
|
+
/// </summary>
|
|
69
|
+
protected override void CreateForm()
|
|
70
|
+
{
|
|
71
|
+
base.CreateForm();
|
|
72
|
+
|
|
73
|
+
DisplayPauseData();
|
|
74
|
+
|
|
75
|
+
DisplayState();
|
|
76
|
+
|
|
77
|
+
DisplayChapter();
|
|
78
|
+
|
|
79
|
+
DisplayGates();
|
|
80
|
+
|
|
81
|
+
DisplayPointInTime();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#region Display Objects and Events
|
|
85
|
+
|
|
86
|
+
/// <summary>
|
|
87
|
+
///
|
|
88
|
+
/// </summary>
|
|
89
|
+
protected virtual void DisplayPauseData()
|
|
90
|
+
{
|
|
91
|
+
if (tester.pauseData != null)
|
|
92
|
+
DrawFoldoutInspector(tester.pauseData, ref cachedEditor);
|
|
93
|
+
|
|
94
|
+
GUILayout.Space(10);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/// <summary>
|
|
98
|
+
///
|
|
99
|
+
/// </summary>
|
|
100
|
+
protected virtual void DisplayState()
|
|
101
|
+
{
|
|
102
|
+
string[] names = tester.stateDatabase != null ? tester.stateDatabase.GetStateNames() : new string[0];
|
|
103
|
+
|
|
104
|
+
int dropdownWidth = names.Length > 0 ? names[tester.state].Length : 0;
|
|
105
|
+
|
|
106
|
+
tester.SetState(HandyFields.IntDropdown("State: ", tester.state, names, dropdownWidth));
|
|
107
|
+
|
|
108
|
+
GUILayout.Space(10);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// <summary>
|
|
112
|
+
///
|
|
113
|
+
/// </summary>
|
|
114
|
+
protected virtual void DisplayChapter()
|
|
115
|
+
{
|
|
116
|
+
string[] names = progressionDatabase != null ? progressionDatabase.GetAllChapterNames() : new string[0];
|
|
117
|
+
|
|
118
|
+
int dropdownWidth = names.Length > 0 ? names[tester.chapterIndex].Length : 0;
|
|
119
|
+
|
|
120
|
+
tester.SetChapterIndex(HandyFields.IntDropdown("Chapter: ", tester.chapterIndex, names, dropdownWidth));
|
|
121
|
+
|
|
122
|
+
GUILayout.Space(10);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
#endregion
|
|
126
|
+
|
|
127
|
+
#region Display Gates
|
|
128
|
+
|
|
129
|
+
/// <summary>
|
|
130
|
+
///
|
|
131
|
+
/// </summary>
|
|
132
|
+
protected virtual void DisplayGates()
|
|
133
|
+
{
|
|
134
|
+
DisplayGoingToGate();
|
|
135
|
+
|
|
136
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
137
|
+
{
|
|
138
|
+
DisplayInvestigationGates();
|
|
139
|
+
|
|
140
|
+
DisplayFromGate();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
DisplayDefaultFromGate();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// <summary>
|
|
147
|
+
///
|
|
148
|
+
/// </summary>
|
|
149
|
+
protected virtual void DisplayGoingToGate()
|
|
150
|
+
{
|
|
151
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
152
|
+
{
|
|
153
|
+
EditorGUILayout.LabelField("Going To: ", GUILayout.MaxWidth(100));
|
|
154
|
+
|
|
155
|
+
var gateNames = ContainerUtil.PrependedList(gateDatabase.GetGateNames(), "No Gate");
|
|
156
|
+
|
|
157
|
+
int[] nameIndexes = ContainerUtil.Iota(gateNames.Length, -1);
|
|
158
|
+
|
|
159
|
+
int gateIndex = EditorGUILayout.IntPopup(tester.toGateIdx, gateNames,
|
|
160
|
+
nameIndexes, GUILayout.MaxWidth(130));
|
|
161
|
+
|
|
162
|
+
tester.SetToGate(gateIndex, tester.toGateIdx == -1 ? null : gateDatabase.Areas[tester.toGateIdx]);
|
|
163
|
+
|
|
164
|
+
if (tester.toGate == null && serializedObject.FindProperty("GoToScene") is SerializedProperty sceneProperty)
|
|
165
|
+
HandyFields.HardPropertyField("Scene Name: ", sceneProperty);
|
|
166
|
+
else if (tester.toGateIdx < gateDatabase.Areas.Count && tester.toGateIdx > 0)
|
|
167
|
+
tester.SetToGate(gateIndex, gateDatabase.Areas[tester.toGateIdx]);
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
if (tester.toGate != null && tester.toGate.isTPFD)
|
|
171
|
+
EditorGUILayout.LabelField("TPFD Room", GUILayout.MaxWidth(100));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
GUILayout.Space(10);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/// <summary>
|
|
178
|
+
///
|
|
179
|
+
/// </summary>
|
|
180
|
+
protected virtual void DisplayInvestigationGates()
|
|
181
|
+
{
|
|
182
|
+
if (tester.toGate == null || tester.toGate.fromLocations.Count == 0)
|
|
183
|
+
return;
|
|
184
|
+
|
|
185
|
+
string toScene = "";
|
|
186
|
+
|
|
187
|
+
int investigationGateIndex = -1;
|
|
188
|
+
|
|
189
|
+
if (tester.toGate.invGates.Count > 0)
|
|
190
|
+
{
|
|
191
|
+
EditorGUILayout.LabelField("Inv Gate: ", GUILayout.MaxWidth(100));
|
|
192
|
+
|
|
193
|
+
string[] investigationGateNames = ContainerUtil
|
|
194
|
+
.PrependedList(tester.toGate.invGates.Select(invGate => invGate.sceneName).ToArray(), "None");
|
|
195
|
+
|
|
196
|
+
if (investigationGateNames.Length > 0)
|
|
197
|
+
{
|
|
198
|
+
int[] nameIndexes = ContainerUtil.Iota(investigationGateNames.Length, -1);
|
|
199
|
+
|
|
200
|
+
investigationGateIndex = EditorGUILayout.IntPopup(tester.invGateIdx, investigationGateNames,
|
|
201
|
+
nameIndexes, GUILayout.MaxWidth(130));
|
|
202
|
+
|
|
203
|
+
toScene = tester.invGateIdx == -1 ?
|
|
204
|
+
"" : tester.toGate.invGates[tester.invGateIdx].sceneName;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
tester.SetInvestigationScene(toScene, investigationGateIndex);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/// <summary>
|
|
212
|
+
///
|
|
213
|
+
/// </summary>
|
|
214
|
+
protected virtual void DisplayFromGate()
|
|
215
|
+
{
|
|
216
|
+
if (tester.toGate == null || tester.toGate.fromLocations.Count == 0)
|
|
217
|
+
return;
|
|
218
|
+
|
|
219
|
+
var locationList = tester.toGate.fromLocations;
|
|
220
|
+
|
|
221
|
+
EditorGUILayout.LabelField("Coming From: ", GUILayout.MaxWidth(100));
|
|
222
|
+
|
|
223
|
+
var fromGateNames = ContainerUtil
|
|
224
|
+
.PrependedList(locationList.Select(fromGate => fromGate.gateFrom.ToAreaName).ToArray(), "None");
|
|
225
|
+
|
|
226
|
+
int fromGateIndex = tester.fromGateIdx;
|
|
227
|
+
|
|
228
|
+
if (fromGateNames.Length > 0)
|
|
229
|
+
fromGateIndex = EditorGUILayout.IntPopup(tester.fromGateIdx, fromGateNames,
|
|
230
|
+
ContainerUtil.Iota(fromGateNames.Length, -1), GUILayout.MaxWidth(130));
|
|
231
|
+
|
|
232
|
+
bool validFromGateIndex =
|
|
233
|
+
fromGateIndex < locationList.Count &&
|
|
234
|
+
fromGateNames.Length != 0 &&
|
|
235
|
+
fromGateIndex != -1;
|
|
236
|
+
|
|
237
|
+
tester.SetFromGate(fromGateIndex, validFromGateIndex ? locationList[fromGateIndex] : null);
|
|
238
|
+
|
|
239
|
+
GUILayout.Space(10);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/// <summary>
|
|
243
|
+
///
|
|
244
|
+
/// </summary>
|
|
245
|
+
protected virtual void DisplayDefaultFromGate()
|
|
246
|
+
{
|
|
247
|
+
if (tester.fromGate == null)
|
|
248
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
249
|
+
tester.SetPositionAndRotation(HandyFields.Vector3Field("Position: ", tester.position),
|
|
250
|
+
HandyFields.Vector3Field("Rotation: ", tester.rotation));
|
|
251
|
+
|
|
252
|
+
GUILayout.Space(10);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
#endregion
|
|
256
|
+
|
|
257
|
+
#region Display Point In Time
|
|
258
|
+
|
|
259
|
+
/// <summary>
|
|
260
|
+
///
|
|
261
|
+
/// </summary>
|
|
262
|
+
protected virtual void DisplayPointInTime()
|
|
263
|
+
{
|
|
264
|
+
if (tester.toGate == null || !DisplayingValidGameMoment())
|
|
265
|
+
DisplayDefaultMoment();
|
|
266
|
+
|
|
267
|
+
GUILayout.Space(10);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/// <summary>
|
|
271
|
+
///
|
|
272
|
+
/// </summary>
|
|
273
|
+
protected virtual void DisplayDefaultMoment()
|
|
274
|
+
{
|
|
275
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
276
|
+
{
|
|
277
|
+
EditorGUILayout.LabelField("Any Moment: ", GUILayout.Width(100));
|
|
278
|
+
|
|
279
|
+
string[] objectiveNames = progressionDatabase.GetObjectiveNames(tester.chapterIndex);
|
|
280
|
+
|
|
281
|
+
if (objectiveNames != null && objectiveNames.Length != 0)
|
|
282
|
+
{
|
|
283
|
+
int[] nameIndexes = ContainerUtil.Iota(objectiveNames.Length, 0);
|
|
284
|
+
|
|
285
|
+
tester.SetObjectiveIndex(EditorGUILayout.IntPopup(tester.objectiveIndex, objectiveNames,
|
|
286
|
+
nameIndexes, GUILayout.MaxWidth(130)));
|
|
287
|
+
|
|
288
|
+
tester.SetObjective(progressionDatabase.Chapters[tester.chapterIndex].Objectives[tester.objectiveIndex]);
|
|
289
|
+
}
|
|
290
|
+
else
|
|
291
|
+
EditorGUILayout.LabelField("No Available Objectives for that chapter", GUILayout.Width(100));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
GUILayout.Space(10);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/// <summary>
|
|
298
|
+
///
|
|
299
|
+
/// </summary>
|
|
300
|
+
/// <returns></returns>
|
|
301
|
+
protected virtual bool DisplayingValidGameMoment()
|
|
302
|
+
{
|
|
303
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
304
|
+
{
|
|
305
|
+
if (!DisplayBuilder(out RoomStateBuilder builder))
|
|
306
|
+
return false;
|
|
307
|
+
|
|
308
|
+
if (!DisplaySection(builder, out RoomStateSection section))
|
|
309
|
+
return false;
|
|
310
|
+
|
|
311
|
+
DisplayObjectiveInSection(section);
|
|
312
|
+
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/// <summary>
|
|
318
|
+
///
|
|
319
|
+
/// </summary>
|
|
320
|
+
/// <param name="builder"></param>
|
|
321
|
+
/// <returns></returns>
|
|
322
|
+
protected virtual bool DisplayBuilder(out RoomStateBuilder builder)
|
|
323
|
+
{
|
|
324
|
+
string builderName = tester.GoToScene != "" ? tester.GoToScene : tester.toGate.ToAreaName;
|
|
325
|
+
|
|
326
|
+
builder = null;
|
|
327
|
+
|
|
328
|
+
RoomStateBuilders ??= BuilderUtility.FindAssetsByType<RoomStateBuilder>();
|
|
329
|
+
|
|
330
|
+
if (RoomStateBuilders.Count == 0)
|
|
331
|
+
EditorGUILayout.LabelField("Couldn't find room builders");
|
|
332
|
+
|
|
333
|
+
builder = RoomStateBuilders.Find(foundBuilder => foundBuilder.name == builderName);
|
|
334
|
+
|
|
335
|
+
if (builder == null)
|
|
336
|
+
EditorGUILayout.LabelField("Couldn't find builder with Name: " + builderName);
|
|
337
|
+
|
|
338
|
+
return builder != null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/// <summary>
|
|
342
|
+
///
|
|
343
|
+
/// </summary>
|
|
344
|
+
/// <param name="builder"></param>
|
|
345
|
+
/// <param name="section"></param>
|
|
346
|
+
/// <returns></returns>
|
|
347
|
+
protected virtual bool DisplaySection(RoomStateBuilder builder, out RoomStateSection section)
|
|
348
|
+
{
|
|
349
|
+
section = null;
|
|
350
|
+
|
|
351
|
+
if (builder == null || builder.Sections.Count == 0)
|
|
352
|
+
return false;
|
|
353
|
+
|
|
354
|
+
bool chapterIndexValid = tester.chapterIndex < progressionDatabase.Chapters.Count && tester.chapterIndex >= 0;
|
|
355
|
+
|
|
356
|
+
bool chapterIndexMatches = builder.Sections
|
|
357
|
+
.Any(roomStateSection =>
|
|
358
|
+
progressionDatabase.GetChapterIndex(roomStateSection.Chapter) == tester.chapterIndex);
|
|
359
|
+
|
|
360
|
+
if (chapterIndexValid && chapterIndexMatches)
|
|
361
|
+
section = builder.Sections[tester.chapterIndex];
|
|
362
|
+
|
|
363
|
+
if (section == null)
|
|
364
|
+
EditorGUILayout.LabelField("Couldn't find builds of room at the specified chapter");
|
|
365
|
+
|
|
366
|
+
if (section.Rooms.Count == 0)
|
|
367
|
+
EditorGUILayout.LabelField("Section had no Room Saves");
|
|
368
|
+
|
|
369
|
+
return section != null && section.Rooms.Count != 0;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/// <summary>
|
|
373
|
+
///
|
|
374
|
+
/// </summary>
|
|
375
|
+
/// <param name="section"></param>
|
|
376
|
+
protected virtual void DisplayObjectiveInSection(RoomStateSection section)
|
|
377
|
+
{
|
|
378
|
+
EditorGUILayout.LabelField("At Moment: ", GUILayout.Width(100));
|
|
379
|
+
|
|
380
|
+
string[] rooms = section.Rooms.Select(roomStateData => roomStateData.progressionValue.Description).ToArray();
|
|
381
|
+
|
|
382
|
+
int[] roomIndexes = ContainerUtil.Iota(rooms.Length, 0);
|
|
383
|
+
|
|
384
|
+
tester.SetObjectiveIndex(EditorGUILayout.IntPopup(tester.objectiveIndex, rooms,
|
|
385
|
+
roomIndexes, GUILayout.MaxWidth(130)));
|
|
386
|
+
|
|
387
|
+
if (section.Rooms.Count > 0 && tester.objectiveIndex < section.Rooms.Count)
|
|
388
|
+
tester.SetObjective(section.Rooms[tester.objectiveIndex].progressionValue);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#endregion
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
394
|
#endif
|