net.dreditor.debugtesting 0.0.0-stage → 0.1.6

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.
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "DREditor.DebugTesting",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "Unity.RenderPipelines.Universal.Runtime",
6
+ "Unity.InputSystem",
7
+ "DREditor.Editor",
8
+ "DREditor",
9
+ "DREditor.Controls",
10
+ "DREditor.Audio",
11
+ "DREditor.Fading",
12
+ "DREditor.Progressing.Handling",
13
+ "DREditor.DialogueMechanics.Investigation",
14
+ "DREditor.RoomLoading",
15
+ "DREditor.RoomStateBuilding",
16
+ "DREditor.RoomBuilding",
17
+ "DREditor.Actors",
18
+ "DREditor.Doors",
19
+ "DREditor.SubAreas",
20
+ "DREditor.Talkables",
21
+ "DREditor.Triggers",
22
+ "DREditor.States"
23
+ ],
24
+ "includePlatforms": [],
25
+ "excludePlatforms": [],
26
+ "allowUnsafeCode": false,
27
+ "overrideReferences": false,
28
+ "precompiledReferences": [],
29
+ "autoReferenced": true,
30
+ "defineConstraints": [],
31
+ "versionDefines": [],
32
+ "noEngineReferences": false
33
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 483c5aba8a74b1042bffd68bb699a642
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/DebugTester.cs ADDED
@@ -0,0 +1,176 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Audio;
3
+ using DREditor.Dialogues.Events;
4
+ using DREditor.EventObjects;
5
+ using DREditor.Fading;
6
+ using DREditor.Gates;
7
+ using DREditor.Progressing.Handling;
8
+ using DREditor.RoomLoading;
9
+ using DREditor.Saving;
10
+ using DREditor.Services;
11
+ using DREditor.States;
12
+ using System.Collections;
13
+ using UnityEngine;
14
+ using UnityEngine.EventSystems;
15
+ using UnityEngine.InputSystem;
16
+ using UnityEngine.SceneManagement;
17
+ using static UnityEngine.InputSystem.InputAction;
18
+
19
+ namespace DREditor.DebugTesting
20
+ {
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ public class DebugTester : DebugTesterBase
25
+ {
26
+ /// <summary>
27
+ ///
28
+ /// </summary>
29
+ [Header("")]
30
+ [Divider]
31
+ [Tooltip("")]
32
+ [SerializeField] protected InputActionReference startTest = null;
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ public StateDatabase stateDatabase = null;
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ [Tooltip("")]
44
+ public ScriptableObject pauseData = null;
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ [Space]
50
+
51
+ [Tooltip("")]
52
+ [SerializeField] protected SceneEvent newGameSelected = null;
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ [Tooltip("")]
58
+ [SerializeField] protected SceneEvent startedNewGame = null;
59
+
60
+ /// <summary>
61
+ ///
62
+ /// </summary>
63
+ [Tooltip("")]
64
+ [SerializeField] protected BoolWithEvent hasLoadedSaveData = null;
65
+
66
+ /// <summary>
67
+ ///
68
+ /// </summary>
69
+ [Tooltip("")]
70
+ [SerializeField] protected BoolWithEvent startedNewWithLoaded = null;
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ [Tooltip("")]
76
+ [SerializeField] protected TransformWithEvent playerSpawnPoint = null;
77
+
78
+ /// <summary>
79
+ ///
80
+ /// </summary>
81
+ [Tooltip("")]
82
+ [SerializeField] protected IntWithEvent currentState = null;
83
+
84
+ /// <summary>
85
+ ///
86
+ /// </summary>
87
+ [Tooltip("")]
88
+ [SerializeField] protected IntWithEvent currentChapterIndex = null;
89
+
90
+ /// <summary>
91
+ ///
92
+ /// </summary>
93
+ [Tooltip("")]
94
+ [SerializeField] protected string generatePastEvent = "FadeOutGeneratePastOnDebugTest";
95
+
96
+
97
+ protected virtual void OnEnable() => startTest.action.started += StartNewGame;
98
+
99
+ protected virtual void OnDisable() => startTest.action.started -= StartNewGame;
100
+
101
+ /// <summary>
102
+ ///
103
+ /// </summary>
104
+ /// <param name="ctx"></param>
105
+ protected virtual void StartNewGame(CallbackContext ctx)
106
+ {
107
+ FindAnyObjectByType<PlayerDataClearHandler>().Clear();
108
+
109
+ if (hasLoadedSaveData.Value)
110
+ {
111
+ startedNewWithLoaded.SetValue(true);
112
+
113
+ newGameSelected.Raise();
114
+
115
+ startedNewGame.Raise();
116
+ }
117
+
118
+ EventSystem.current.SetSelectedGameObject(null);
119
+
120
+ StartCoroutine(FadeIntoGame());
121
+ }
122
+
123
+ /// <summary>
124
+ ///
125
+ /// </summary>
126
+ /// <returns></returns>
127
+ protected virtual IEnumerator FadeIntoGame()
128
+ {
129
+ newGameSelected.Raise();
130
+
131
+ startedNewGame.Raise();
132
+
133
+ // This section differs from the normal new game initialization logic.
134
+ currentChapterIndex.SetValue(chapterIndex);
135
+
136
+ ServiceLocator.GetService<ProgressionManagerBase>().SetCurrentObjective(objective);
137
+
138
+ if (toGate != null || (position == Vector3.zero && rotation == Vector3.zero))
139
+ OverrideFromGate(fromGate);
140
+ else
141
+ playerSpawnPoint.SetValue(new(position, Quaternion.Euler(rotation)));
142
+
143
+ currentState.SetValue(state);
144
+
145
+ ServiceLocator.GetService<MusicManagerBase>().FadeMusic(1f);
146
+
147
+ yield return ServiceLocator.GetService<GlobalFade>().FadeToRoutine(1);
148
+
149
+ ServiceLocator.GetService<RoomLoaderBase>().AllowRoomsToLoad();
150
+
151
+ if (GoToScene == "" && toGate != null)
152
+ GoToScene = toGate.ToAreaName;
153
+
154
+ SceneManager.LoadSceneAsync(GoToScene);
155
+
156
+ DialogueEventSystem.TriggerEvent(generatePastEvent);
157
+
158
+ yield break;
159
+ }
160
+
161
+ /// <summary>
162
+ ///
163
+ /// </summary>
164
+ /// <param name="fromG"></param>
165
+ protected virtual void OverrideFromGate(GateFrom fromG)
166
+ {
167
+ if (fromG != null)
168
+ UnityEngine.Debug.Log($"{ToString()}: OverrideFromGate: FromG was Null , most likely TPFD Area");
169
+
170
+ if (fromG != null)
171
+ playerSpawnPoint.SetValue(new(fromG.position, Quaternion.Euler(fromG.rotation)));
172
+ else
173
+ playerSpawnPoint.SetValue(new(Vector3.zero, Quaternion.Euler(Vector3.zero)));
174
+ }
175
+ }
176
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d921924d639c2104ca2c79eb67f94788
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,158 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Gates;
3
+ using DREditor.Progressing;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.DebugTesting
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public class DebugTesterBase : MonoBehaviour
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [HideInInspector]
17
+ public int state = 0;
18
+
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ [HideInInspector]
23
+ public int chapterIndex = 0;
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ [HideInInspector]
29
+ public Objective objective = null;
30
+
31
+ /// <summary>
32
+ ///
33
+ /// </summary>
34
+ [HideInInspector]
35
+ public int objectiveIndex = 0;
36
+
37
+ /// <summary>
38
+ ///
39
+ /// </summary>
40
+ [HideInInspector]
41
+ public string GoToScene = "";
42
+
43
+ /// <summary>
44
+ ///
45
+ /// </summary>
46
+ [HideInInspector]
47
+ public Gate toGate = null;
48
+
49
+ /// <summary>
50
+ ///
51
+ /// </summary>
52
+ [HideInInspector]
53
+ public int toGateIdx = 0;
54
+
55
+ /// <summary>
56
+ ///
57
+ /// </summary>
58
+ [HideInInspector]
59
+ public GateFrom fromGate = null;
60
+
61
+ /// <summary>
62
+ ///
63
+ /// </summary>
64
+ [HideInInspector]
65
+ public int fromGateIdx = 0;
66
+
67
+ /// <summary>
68
+ ///
69
+ /// </summary>
70
+ [HideInInspector]
71
+ public int invGateIdx = -1;
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ [HideInInspector]
77
+ public Vector3 position = Vector3.zero;
78
+
79
+ /// <summary>
80
+ ///
81
+ /// </summary>
82
+ [HideInInspector]
83
+ public Vector3 rotation = Vector3.zero;
84
+
85
+
86
+ /// <summary>
87
+ ///
88
+ /// </summary>
89
+ /// <param name="state"></param>
90
+ public virtual void SetState(int state) => this.state = state;
91
+
92
+ /// <summary>
93
+ ///
94
+ /// </summary>
95
+ /// <param name="chapterIndex"></param>
96
+ public virtual void SetChapterIndex(int chapterIndex) => this.chapterIndex = chapterIndex;
97
+
98
+ /// <summary>
99
+ ///
100
+ /// </summary>
101
+ /// <param name="value"></param>
102
+ public virtual void SetObjective(Objective value) => objective = value;
103
+
104
+ /// <summary>
105
+ ///
106
+ /// </summary>
107
+ /// <param name="value"></param>
108
+ public virtual void SetObjectiveIndex(int value) => objectiveIndex = value;
109
+
110
+ /// <summary>
111
+ ///
112
+ /// </summary>
113
+ /// <param name="toGateIdx"></param>
114
+ /// <param name="toGate"></param>
115
+ public virtual void SetToGate(int toGateIdx, Gate toGate)
116
+ {
117
+ this.toGateIdx = toGateIdx;
118
+
119
+ this.toGate = toGate;
120
+ }
121
+
122
+ /// <summary>
123
+ ///
124
+ /// </summary>
125
+ /// <param name="fromGateIdx"></param>
126
+ /// <param name="fromGate"></param>
127
+ public virtual void SetFromGate(int fromGateIdx, GateFrom fromGate)
128
+ {
129
+ this.fromGateIdx = fromGateIdx;
130
+
131
+ this.fromGate = fromGate;
132
+ }
133
+
134
+ /// <summary>
135
+ ///
136
+ /// </summary>
137
+ /// <param name="GoToScene"></param>
138
+ /// <param name="invGateIdx"></param>
139
+ public virtual void SetInvestigationScene(string GoToScene, int invGateIdx)
140
+ {
141
+ this.GoToScene = GoToScene;
142
+
143
+ this.invGateIdx = invGateIdx;
144
+ }
145
+
146
+ /// <summary>
147
+ ///
148
+ /// </summary>
149
+ /// <param name="position"></param>
150
+ /// <param name="rotation"></param>
151
+ public virtual void SetPositionAndRotation(Vector3 position, Vector3 rotation)
152
+ {
153
+ this.position = position;
154
+
155
+ this.rotation = rotation;
156
+ }
157
+ }
158
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 01307d444e5fe304487ebe6882b5d607
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "DREditor.DebugTesting.Editor",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "Unity.RenderPipelines.Universal.Runtime",
6
+ "Unity.InputSystem",
7
+ "DREditor.Editor",
8
+ "DREditor",
9
+ "DREditor.Controls",
10
+ "DREditor.Audio",
11
+ "DREditor.Fading",
12
+ "DREditor.Progressing.Handling",
13
+ "DREditor.DialogueMechanics.Investigation",
14
+ "DREditor.RoomLoading",
15
+ "DREditor.RoomStateBuilding",
16
+ "DREditor.RoomBuilding",
17
+ "DREditor.Actors",
18
+ "DREditor.Doors",
19
+ "DREditor.SubAreas",
20
+ "DREditor.Talkables",
21
+ "DREditor.Triggers",
22
+ "DREditor.States",
23
+ "DREditor.DebugTesting"
24
+ ],
25
+ "includePlatforms": [],
26
+ "excludePlatforms": [],
27
+ "allowUnsafeCode": false,
28
+ "overrideReferences": false,
29
+ "precompiledReferences": [],
30
+ "autoReferenced": true,
31
+ "defineConstraints": [],
32
+ "versionDefines": [],
33
+ "noEngineReferences": false
34
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: b3c9b90e902c87d4b8a9373d098e634f
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,75 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if UNITY_EDITOR
3
+ using UnityEditor;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.DebugTesting.Editor
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public abstract class DebugTesterBaseEditor : UnityEditor.Editor
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ protected bool eventFoldout = false;
17
+
18
+
19
+ /// <inheritdoc/>
20
+ public override void OnInspectorGUI()
21
+ {
22
+ if (!PassInitialization())
23
+ return;
24
+
25
+ serializedObject.Update();
26
+
27
+ CreateForm();
28
+
29
+ serializedObject.ApplyModifiedProperties();
30
+ }
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ /// <returns></returns>
36
+ protected abstract bool PassInitialization();
37
+
38
+ /// <summary>
39
+ ///
40
+ /// </summary>
41
+ protected virtual void CreateForm()
42
+ {
43
+ SaveChangesButton();
44
+
45
+ DisplayEventFields();
46
+ }
47
+
48
+ /// <summary>
49
+ ///
50
+ /// </summary>
51
+ protected virtual void SaveChangesButton()
52
+ {
53
+ if (GUILayout.Button("Save Changes", GUILayout.Width(100)))
54
+ EditorUtility.SetDirty(target);
55
+
56
+ GUILayout.Space(20);
57
+ }
58
+
59
+ /// <summary>
60
+ ///
61
+ /// </summary>
62
+ protected virtual void DisplayEventFields()
63
+ {
64
+ eventFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(eventFoldout, "Initialized Objects and Events");
65
+
66
+ if (eventFoldout)
67
+ DrawDefaultInspector();
68
+
69
+ EditorGUILayout.EndFoldoutHeaderGroup();
70
+
71
+ GUILayout.Space(10);
72
+ }
73
+ }
74
+ }
75
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 790e42b969798d640af6202641dce49b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +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
+ }
394
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d2664266a93bb8841b135de2860fd745
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/Editor.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 8aa115794519bef4ab66676028d5c074
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,92 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!1 &5430106416877515027
4
+ GameObject:
5
+ m_ObjectHideFlags: 0
6
+ m_CorrespondingSourceObject: {fileID: 0}
7
+ m_PrefabInstance: {fileID: 0}
8
+ m_PrefabAsset: {fileID: 0}
9
+ serializedVersion: 6
10
+ m_Component:
11
+ - component: {fileID: 5430106416877515117}
12
+ - component: {fileID: 5430106416877515116}
13
+ m_Layer: 0
14
+ m_Name: Debug_Tester_ETemplate
15
+ m_TagString: Untagged
16
+ m_Icon: {fileID: 0}
17
+ m_NavMeshLayer: 0
18
+ m_StaticEditorFlags: 0
19
+ m_IsActive: 1
20
+ --- !u!4 &5430106416877515117
21
+ Transform:
22
+ m_ObjectHideFlags: 0
23
+ m_CorrespondingSourceObject: {fileID: 0}
24
+ m_PrefabInstance: {fileID: 0}
25
+ m_PrefabAsset: {fileID: 0}
26
+ m_GameObject: {fileID: 5430106416877515027}
27
+ serializedVersion: 2
28
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29
+ m_LocalPosition: {x: 0, y: 0, z: 0}
30
+ m_LocalScale: {x: 1, y: 1, z: 1}
31
+ m_ConstrainProportionsScale: 0
32
+ m_Children: []
33
+ m_Father: {fileID: 0}
34
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35
+ --- !u!114 &5430106416877515116
36
+ MonoBehaviour:
37
+ m_ObjectHideFlags: 0
38
+ m_CorrespondingSourceObject: {fileID: 0}
39
+ m_PrefabInstance: {fileID: 0}
40
+ m_PrefabAsset: {fileID: 0}
41
+ m_GameObject: {fileID: 5430106416877515027}
42
+ m_Enabled: 0
43
+ m_EditorHideFlags: 0
44
+ m_Script: {fileID: 11500000, guid: d921924d639c2104ca2c79eb67f94788, type: 3}
45
+ m_Name:
46
+ m_EditorClassIdentifier: DREditor.DebugTesting::DREditor.DebugTesting.DebugTester
47
+ state: 0
48
+ chapterIndex: 0
49
+ objective:
50
+ Description: First Objective
51
+ ProgressionGate: {fileID: 0}
52
+ KeepInstanceData: 0
53
+ ProgressionGateways: []
54
+ Flags:
55
+ - name: Talk To Boxes
56
+ triggered: 0
57
+ optional: 0
58
+ toObjective:
59
+ - name: Talk To Generator
60
+ triggered: 0
61
+ optional: 0
62
+ toObjective:
63
+ - name: Talk To Security Camera
64
+ triggered: 0
65
+ optional: 0
66
+ toObjective:
67
+ objectiveIndex: 0
68
+ GoToScene:
69
+ toGate: {fileID: 0}
70
+ toGateIdx: 0
71
+ fromGate:
72
+ gateFrom: {fileID: 0}
73
+ position: {x: -8, y: 1.5799998, z: -1.07}
74
+ rotation: {x: 0, y: 90, z: 0}
75
+ fromGateIdx: 0
76
+ invGateIdx: -1
77
+ position: {x: 0, y: 0, z: 0}
78
+ rotation: {x: 0, y: 0, z: 0}
79
+ startTest: {fileID: 5244787972025070874, guid: 5db4984853779e74db3e8e6c0ebb48c9,
80
+ type: 3}
81
+ stateDatabase: {fileID: 0}
82
+ pauseData: {fileID: 11400000, guid: 25a364aeebff28e4aa48ba3eebf4bd0a, type: 2}
83
+ newGameSelected: {fileID: 11400000, guid: aedb15ce0bc81f64aba03a47893580a9, type: 2}
84
+ startedNewGame: {fileID: 11400000, guid: 7905f84979818c34baf12a4982f46e9e, type: 2}
85
+ hasLoadedSaveData: {fileID: 11400000, guid: a033ae39d23ed014893fcfc565e4da85, type: 2}
86
+ startedNewWithLoaded: {fileID: 11400000, guid: 4cee6a90e1d9ded4192028bb66a184e0,
87
+ type: 2}
88
+ playerSpawnPoint: {fileID: 11400000, guid: cb6bbeaa532cdf144a4588b0102e27bf, type: 2}
89
+ currentState: {fileID: 11400000, guid: fde96ad06c12a05408aae94901800edc, type: 2}
90
+ currentChapterIndex: {fileID: 11400000, guid: 6d18d42a2d8a0b743aa967dd08702cd8,
91
+ type: 2}
92
+ generatePastEvent: FadeOutGeneratePastOnDebugTest
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 9b2bfc9c62cf68f4ea5b820f908ccf4b
3
+ PrefabImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Samples.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: b67ab1789bff96a45aa753fe4cfe4c64
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
- {
2
- "name": "net.dreditor.debugtesting",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "net.dreditor.debugtesting",
3
+ "version": "0.1.6",
4
+ "displayName": "DREditor Debug Testing",
5
+ "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
+ "unity": "6000.4",
7
+ "dependencies": {
8
+ "com.unity.render-pipelines.universal": "17.4.0",
9
+ "com.unity.inputsystem": "1.19.0",
10
+ "net.dreditor.core": "0.1.6",
11
+ "net.dreditor.audio": "0.1.6",
12
+ "net.dreditor.fading": "0.1.6",
13
+ "net.dreditor.progressing.handling": "0.1.6",
14
+ "net.dreditor.dialoguemechanics.investigation": "0.1.6",
15
+ "net.dreditor.roomloading": "0.1.6",
16
+ "net.dreditor.roomstatebuilding": "0.1.6",
17
+ "net.dreditor.roombuilding": "0.1.6",
18
+ "net.dreditor.actors": "0.1.6",
19
+ "net.dreditor.doors": "0.1.6",
20
+ "net.dreditor.subareas": "0.1.6",
21
+ "net.dreditor.talkables": "0.1.6",
22
+ "net.dreditor.triggers": "0.1.6",
23
+ "net.dreditor.states": "0.1.6"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "author": {
29
+ "name": "Benjamin \"Sweden\" Jillson",
30
+ "email": "dreditortool@gmail.com",
31
+ "url": "https://dreditor.net"
32
+ },
33
+ "keywords": [
34
+ "editor",
35
+ "tool",
36
+ "dreditor"
37
+ ],
38
+ "samples": [
39
+ {
40
+ "displayName": "Samples",
41
+ "description": "",
42
+ "path": "Samples~"
43
+ }
44
+ ],
45
+ "documentationUrl": "https://dreditor.net",
46
+ "license": "Apache-2.0",
47
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
48
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html"
49
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: fb8f84ea105c5314cb3d24951af91566
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.