net.dreditor.doors 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,23 @@
1
+ {
2
+ "name": "DREditor.Doors",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "Unity.InputSystem",
6
+ "DREditor",
7
+ "DREditor.Input",
8
+ "DREditor.Controls",
9
+ "DREditor.LocalDialogues",
10
+ "DREditor.Progressing.Handling",
11
+ "DREditor.RoomLoading",
12
+ "DREditor.Choices"
13
+ ],
14
+ "includePlatforms": [],
15
+ "excludePlatforms": [],
16
+ "allowUnsafeCode": false,
17
+ "overrideReferences": false,
18
+ "precompiledReferences": [],
19
+ "autoReferenced": true,
20
+ "defineConstraints": [],
21
+ "versionDefines": [],
22
+ "noEngineReferences": false
23
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 3ee7ba857d8674540b50fc8ec0bad26e
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,30 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using UnityEngine;
4
+
5
+ namespace DREditor.Doors
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ [ClassHeader(nameof(LeaveAskManager) +
11
+ "\n\n")]
12
+ public class DialogueLeaveAskManager : LeaveAskManager
13
+ {
14
+ /// <summary>
15
+ ///
16
+ /// </summary>
17
+ [Tooltip("")]
18
+ [SerializeField] protected DialogueCore leaveAsk = null;
19
+
20
+
21
+ /// <inheritdoc/>
22
+ public override DialogueCore GetLeaveAskDialogue()
23
+ {
24
+ if (leaveAsk == null)
25
+ UnityEngine.Debug.LogWarning("Leave Ask has not been added! please add it to the progression manager");
26
+
27
+ return leaveAsk;
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: b3447c775421bee489cfab66c03b42a1
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/Door.cs ADDED
@@ -0,0 +1,191 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Dialogues.Events;
4
+ using DREditor.EventObjects;
5
+ using DREditor.Input;
6
+ using DREditor.LocalDialogues;
7
+ using DREditor.RoomLoading;
8
+ using DREditor.Services;
9
+ using UnityEngine;
10
+ using static UnityEngine.InputSystem.InputAction;
11
+
12
+ namespace DREditor.Doors
13
+ {
14
+ /// <summary>
15
+ ///
16
+ /// </summary>
17
+ [ClassHeader(nameof(DoorBase) + ", " + nameof(IDoor) + ", " + nameof(IDialogueHolder) + ", " + nameof(ISelectableObject) + ", " +
18
+ nameof(ISceneEventListener) +
19
+ "\n\n")]
20
+ public class Door : DoorBase, IDoor, IDialogueHolder, ISelectableObject, ISceneEventListener
21
+ {
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Tooltip("")]
26
+ [SerializeField] protected SceneEvent onFinishedLoadingRoom = null;
27
+
28
+ /// <summary>
29
+ ///
30
+ /// </summary>
31
+ [Tooltip("")]
32
+ [SerializeField] protected BoolWithEvent changingObserve = null;
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ [SerializeField] protected BoolWithEvent inMenu = null;
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ [Tooltip("")]
44
+ [SerializeField] protected BoolWithEvent isLoadingToRoom = null;
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ [Tooltip("")]
50
+ [SerializeField] protected BoolWithEvent inDialogue = null;
51
+
52
+ /// <summary>
53
+ ///
54
+ /// </summary>
55
+ [Tooltip("")]
56
+ [SerializeField] protected string leaveAskEvent = "OnLeaveAsk";
57
+
58
+
59
+ /// <summary>
60
+ ///
61
+ /// </summary>
62
+ protected override void Start()
63
+ {
64
+ if (isTPFD)
65
+ onFinishedLoadingRoom.RegisterListener(this);
66
+
67
+ base.Start();
68
+ }
69
+
70
+
71
+ /// <inheritdoc/>
72
+ public virtual void OnEventRaised() => AddDoorControl();
73
+
74
+ /// <inheritdoc/>
75
+ public virtual void AddDoorControl()
76
+ {
77
+ onFinishedLoadingRoom.UnregisterListener(this);
78
+
79
+ ServiceLocator.GetService<IInputManager>().GetLeave().performed += EvaluateLock;
80
+ }
81
+
82
+ /// <summary>
83
+ ///
84
+ /// </summary>
85
+ protected virtual void OnDestroy() => RemoveDoorControl();
86
+
87
+ /// <inheritdoc/>
88
+ public virtual void RemoveDoorControl()
89
+ {
90
+ if (ServiceLocator.HasService<IInputManager>())
91
+ ServiceLocator.GetService<IInputManager>().GetLeave().performed -= EvaluateLock;
92
+ }
93
+
94
+ /// <summary>
95
+ ///
96
+ /// </summary>
97
+ protected virtual void EvaluateLock(CallbackContext context)
98
+ {
99
+ if (!inLeaveProcess.Value && !changingObserve.Value)
100
+ LockCheck();
101
+ }
102
+
103
+ /// <summary>
104
+ ///
105
+ /// </summary>
106
+ protected virtual void OnTriggerEnter(Collider other)
107
+ {
108
+ if (isHitbox && !inLeaveProcess.Value && !isLoadingToRoom.Value)
109
+ LockCheck();
110
+ }
111
+
112
+ /// <inheritdoc/>
113
+ public virtual void SelectObject() => LockCheck();
114
+
115
+ /// <summary>
116
+ ///
117
+ /// </summary>
118
+ protected virtual void LockCheck()
119
+ {
120
+ if (inMenu.Value || inDialogue.Value)
121
+ return;
122
+
123
+ inLeaveProcess.SetValue(true);
124
+
125
+ if (isTPFD)
126
+ DialogueEventSystem.TriggerEvent(leaveAskEvent);
127
+
128
+ CheckLocks();
129
+ }
130
+
131
+
132
+ /// <inheritdoc/>
133
+ public virtual void ClearLockData()
134
+ {
135
+ SetIdentified(true);
136
+
137
+ data.ClearLockData();
138
+ }
139
+
140
+ /// <inheritdoc/>
141
+ public virtual string GetGameObjectName() => gameObject.name;
142
+
143
+ /// <inheritdoc/>
144
+ public virtual bool IsTPFD() => isTPFD;
145
+
146
+ /// <inheritdoc/>
147
+ public virtual string GetDoorName() => ((DoorData)Save()).doorName;
148
+
149
+ /// <inheritdoc/>
150
+ public virtual string GetSaveDisplayName() => ((DoorData)Save()).displayName;
151
+
152
+ /// <inheritdoc/>
153
+ public virtual object Save()
154
+ {
155
+ data.SetName(gameObject.name);
156
+
157
+ return (DoorData)data.Clone();
158
+ }
159
+
160
+ /// <inheritdoc/>
161
+ public virtual void Load(object data)
162
+ {
163
+ this.data = (DoorData)data;
164
+
165
+ SetIdentified(this.data.identified);
166
+
167
+ CheckIfBeenThroughDoor();
168
+ }
169
+
170
+ /// <summary>
171
+ ///
172
+ /// </summary>
173
+ /// <remarks></remarks>
174
+ protected virtual void CheckIfBeenThroughDoor()
175
+ {
176
+ if (Application.isPlaying && setGateway != null)
177
+ {
178
+ bool beenThroughDoor = ServiceLocator.GetService<InstanceManagerBase>().ContainsRoomDataFor(setGateway.ToAreaName);
179
+
180
+ if (beenThroughDoor && !data.identified)
181
+ SetIdentified(beenThroughDoor);
182
+ }
183
+ }
184
+
185
+
186
+ /// <inheritdoc/>
187
+ public virtual bool CheckIfSaveDialogue()
188
+ => data.lockData.lockDialogues.CheckIfSaveDialogue()
189
+ || data.lockData.unlockedDialogues.CheckIfSaveDialogue();
190
+ }
191
+ }
package/Door.cs.meta ADDED
@@ -0,0 +1,23 @@
1
+ fileFormatVersion: 2
2
+ guid: 001586f9d1f2df74b95bb703ffe5308d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences:
7
+ - setGateway: {instanceID: 0}
8
+ - inLeaveProcess: {fileID: 11400000, guid: 787d287b8159b5049bbd73ee10c03b1b, type: 2}
9
+ - hasMenuAccess: {fileID: 11400000, guid: d969ff2ab7dd92342a1ac9ed2767ed51, type: 2}
10
+ - currentControlsKey: {fileID: 11400000, guid: 076e48fabb7b9164f8f3255e13868b1a,
11
+ type: 2}
12
+ - checkOverlay: {fileID: 11400000, guid: 5cdcd237342722541999a1c2f9df856d, type: 2}
13
+ - onFinishedLoadingRoom: {fileID: 11400000, guid: 7ae605a8b5a363040a5cedfe06a3040d,
14
+ type: 2}
15
+ - changingObserve: {fileID: 11400000, guid: bcc2f2368c3bcfc46ba4da22ee1674f1, type: 2}
16
+ - inMenu: {fileID: 11400000, guid: ecf132a66f959974d84a1d2292242bdf, type: 2}
17
+ - isLoadingToRoom: {fileID: 11400000, guid: 40489b01cccaf4f44b02b6d1b6ff4e8e, type: 2}
18
+ - inDialogue: {fileID: 11400000, guid: b2839fc222ba4bc4eb8bcfee73b0c53d, type: 2}
19
+ executionOrder: 0
20
+ icon: {instanceID: 0}
21
+ userData:
22
+ assetBundleName:
23
+ assetBundleVariant:
package/DoorBase.cs ADDED
@@ -0,0 +1,312 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Cameras;
3
+ using DREditor.Choices;
4
+ using DREditor.Dialogues;
5
+ using DREditor.Dialogues.Events;
6
+ using DREditor.Dialogues.Finishing;
7
+ using DREditor.EventObjects;
8
+ using DREditor.Gates;
9
+ using DREditor.LocalDialogues;
10
+ using DREditor.Processables;
11
+ using DREditor.RoomLoading;
12
+ using DREditor.Services;
13
+ using System;
14
+ using System.Linq;
15
+ using UnityEngine;
16
+ using UnityEngine.EventSystems;
17
+
18
+ namespace DREditor.Doors
19
+ {
20
+ /// <summary>
21
+ ///
22
+ /// </summary>
23
+ [ClassHeader("")]
24
+ public class DoorBase : MonoBehaviour, IGateHolder, INameDisplayable
25
+ {
26
+ /// <summary>
27
+ ///
28
+ /// </summary>
29
+ [Tooltip("")]
30
+ [SerializeField] protected Gate setGateway = null;
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ [Tooltip("")]
36
+ [SerializeField] protected string tpfdControlsKey = "tpfd";
37
+
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ [Header("")]
43
+ [Divider]
44
+ [Tooltip("")]
45
+ [SerializeField] protected bool isHitbox = false;
46
+
47
+ /// <summary>
48
+ ///
49
+ /// </summary>
50
+ [Tooltip("")]
51
+ [SerializeField] protected bool isTPFD = false;
52
+
53
+ /// <summary>
54
+ ///
55
+ /// </summary>
56
+ [Tooltip("")]
57
+ [SerializeField] protected DoorData data = new();
58
+
59
+
60
+ /// <summary>
61
+ ///
62
+ /// </summary>
63
+ [Header("")]
64
+ [Divider]
65
+ [Tooltip("")]
66
+ [SerializeField] protected string disableAbilityEvent = "DisableAbility";
67
+
68
+ /// <summary>
69
+ ///
70
+ /// </summary>
71
+ [Tooltip("")]
72
+ [SerializeField] protected BoolWithEvent inLeaveProcess = null;
73
+
74
+ /// <summary>
75
+ ///
76
+ /// </summary>
77
+ [Tooltip("")]
78
+ [SerializeField] protected BoolWithEvent hasMenuAccess = null;
79
+
80
+ /// <summary>
81
+ ///
82
+ /// </summary>
83
+ [Tooltip("")]
84
+ [SerializeField] protected StringWithEvent currentControlsKey = null;
85
+
86
+ /// <summary>
87
+ ///
88
+ /// </summary>
89
+ [Tooltip("")]
90
+ [SerializeField] protected SceneEvent checkOverlay = null;
91
+
92
+
93
+ /// <summary>
94
+ ///
95
+ /// </summary>
96
+ protected IDialogueManager DialogueManager;
97
+
98
+
99
+ /// <summary>
100
+ ///
101
+ /// </summary>
102
+ protected virtual void Start()
103
+ {
104
+ if (ServiceLocator.HasService<IDialogueManager>())
105
+ DialogueManager = ServiceLocator.GetService<IDialogueManager>();
106
+ }
107
+
108
+
109
+ #region Check Locks
110
+
111
+ /// <summary>
112
+ ///
113
+ /// </summary>
114
+ protected virtual void CheckLocks()
115
+ {
116
+ if (DoorIsLocked())
117
+ EvaluateLock();
118
+ else
119
+ PassedLock();
120
+ }
121
+
122
+ /// <summary>
123
+ ///
124
+ /// </summary>
125
+ /// <returns></returns>
126
+ protected virtual bool DoorIsLocked() => data.lockData.IsLocked();
127
+
128
+ /// <summary>
129
+ ///
130
+ /// </summary>
131
+ protected virtual void EvaluateLock()
132
+ {
133
+ UnityEngine.Debug.Log($"Door {gameObject.name} is checking for locked dialogue.");
134
+
135
+ Dialogue dialogue = ServiceLocator.GetService<LocalDialogueHandlerBase>().EvaluateDialogue(data.lockData.lockDialogues);
136
+
137
+ if (DialogueIsValid(dialogue))
138
+ DoorLocked(dialogue);
139
+ else
140
+ PassedLock();
141
+ }
142
+
143
+ /// <summary>
144
+ ///
145
+ /// </summary>
146
+ /// <param name="dialogue"></param>
147
+ /// <returns></returns>
148
+ protected virtual bool DialogueIsValid(Dialogue dialogue) => dialogue != null;
149
+
150
+ /// <summary>
151
+ ///
152
+ /// </summary>
153
+ /// <param name="dialogue"></param>
154
+ protected virtual void DoorLocked(Dialogue dialogue)
155
+ {
156
+ hasMenuAccess.SetValue(false);
157
+
158
+ DialogueManager.StartDialogue(null, dialogue);
159
+
160
+ inLeaveProcess.SetValue(false);
161
+ }
162
+
163
+ /// <summary>
164
+ ///
165
+ /// </summary>
166
+ protected virtual void PassedLock()
167
+ {
168
+ if (isTPFD)
169
+ PassedLockTPFD();
170
+ else
171
+ PassedLockThreeD();
172
+ }
173
+
174
+ #endregion
175
+
176
+ #region PassedLockTPFD
177
+
178
+ /// <summary>
179
+ ///
180
+ /// </summary>
181
+ protected virtual void PassedLockTPFD()
182
+ {
183
+ UnityEngine.Debug.Log($"REPORT: Door {gameObject.name}: TPFD Room Unlocked");
184
+
185
+ hasMenuAccess.SetValue(false);
186
+
187
+ if (ServiceLocator.GetService<LeaveAskManager>().GetLeaveAskDialogue() == null)
188
+ UnityEngine.Debug.LogError($"ALERT: Leave Ask has not been added! Please add it to the {nameof(LeaveAskManager)}!");
189
+
190
+ Dialogue dialogue = (Dialogue)ServiceLocator.GetService<LeaveAskManager>().GetLeaveAskDialogue();
191
+
192
+ ServiceLocator.GetService<IChoiceManager>().SubscribeAllChoices(new Action[2] { ChangeRoom, DummyNoOption });
193
+
194
+ DialogueManager.StartDialogue(null, dialogue, true);
195
+ }
196
+
197
+ /// <summary>
198
+ ///
199
+ /// </summary>
200
+ protected virtual void DummyNoOption()
201
+ {
202
+ ServiceLocator.GetService<IChoiceManager>().UnsubscribeAllChoices();
203
+
204
+ EventSystem.current.SetSelectedGameObject(null);
205
+
206
+ currentControlsKey.SetValue(tpfdControlsKey);
207
+
208
+ inLeaveProcess.SetValue(false);
209
+ }
210
+
211
+ #endregion
212
+
213
+ #region PassedLockThreeD
214
+
215
+ /// <summary>
216
+ ///
217
+ /// </summary>
218
+ protected virtual void PassedLockThreeD()
219
+ {
220
+ if (data.lockData.unlockedDialogues.Count > 0)
221
+ EvaluateUnlockDialogue();
222
+ else
223
+ ChangeRoom();
224
+ }
225
+
226
+ /// <summary>
227
+ ///
228
+ /// </summary>
229
+ protected virtual void EvaluateUnlockDialogue()
230
+ {
231
+ Dialogue dialogue = ServiceLocator.GetService<LocalDialogueHandlerBase>().EvaluateDialogue(data.lockData.unlockedDialogues);
232
+
233
+ if (DialogueIsValid(dialogue))
234
+ PlayUnlockedDialogue(dialogue);
235
+ else
236
+ ChangeRoom();
237
+ }
238
+
239
+ /// <summary>
240
+ ///
241
+ /// </summary>
242
+ /// <param name="dialogue"></param>
243
+ protected virtual void PlayUnlockedDialogue(Dialogue dialogue)
244
+ {
245
+ DialogueManager.StartDialogue(null, dialogue);
246
+
247
+ var endDialogueEvents = FindObjectsByType<MonoBehaviour>().OfType<IEndDialogueEvent>();
248
+
249
+ foreach(var endEvent in endDialogueEvents)
250
+ endEvent.OnDialogueEnd += ChangeRoom;
251
+ }
252
+
253
+ #endregion
254
+
255
+ #region ChangeRoom
256
+
257
+ /// <summary>
258
+ ///
259
+ /// </summary>
260
+ protected virtual void ChangeRoom()
261
+ {
262
+ ServiceLocator.GetService<IChoiceManager>().UnsubscribeAllChoices();
263
+
264
+ var endDialogueEvents = FindObjectsByType<MonoBehaviour>().OfType<IEndDialogueEvent>();
265
+
266
+ foreach (var endEvent in endDialogueEvents)
267
+ endEvent.OnDialogueEnd -= ChangeRoom;
268
+
269
+ if (gameObject == null)
270
+ {
271
+ UnityEngine.Debug.LogWarning($"ALERT: The door trying to change the room does not exist!");
272
+
273
+ return;
274
+ }
275
+
276
+ UnityEngine.Debug.Log($"REPORT: Entering door {gameObject.name} to change room.");
277
+
278
+ checkOverlay.Raise();
279
+
280
+ SetIdentified(true);
281
+
282
+ DialogueEventSystem.TriggerEvent(disableAbilityEvent);
283
+
284
+ FindAnyObjectByType<PnCCamera>().Controllable = false;
285
+
286
+ FindAnyObjectByType<SmoothMouseLook>().enabled = false;
287
+
288
+ ServiceLocator.GetService<RoomChangerBase>().ChangeRoom(setGateway, data.roomLoadOptions);
289
+ }
290
+
291
+ /// <summary>
292
+ ///
293
+ /// </summary>
294
+ /// <param name="identified"></param>
295
+ protected virtual void SetIdentified(bool identified) => data.SetIdentified(identified);
296
+
297
+ #endregion
298
+
299
+
300
+ /// <inheritdoc/>
301
+ public virtual string DisplayName
302
+ {
303
+ get => data.identified ? data.displayName
304
+ : data.unidentifiedDisplayName == "" ? "???" : data.unidentifiedDisplayName;
305
+
306
+ set => data.SetDisplayName(value);
307
+ }
308
+
309
+ /// <inheritdoc/>
310
+ public virtual Gate GetSetGateway() => setGateway;
311
+ }
312
+ }
@@ -0,0 +1,17 @@
1
+ fileFormatVersion: 2
2
+ guid: 136bfbe57fdd7424d88be7005b892f79
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences:
7
+ - setGateway: {instanceID: 0}
8
+ - inLeaveProcess: {fileID: 11400000, guid: 787d287b8159b5049bbd73ee10c03b1b, type: 2}
9
+ - hasMenuAccess: {fileID: 11400000, guid: d969ff2ab7dd92342a1ac9ed2767ed51, type: 2}
10
+ - currentControlsKey: {fileID: 11400000, guid: 076e48fabb7b9164f8f3255e13868b1a,
11
+ type: 2}
12
+ - checkOverlay: {fileID: 11400000, guid: 5cdcd237342722541999a1c2f9df856d, type: 2}
13
+ executionOrder: 0
14
+ icon: {instanceID: 0}
15
+ userData:
16
+ assetBundleName:
17
+ assetBundleVariant:
package/DoorData.cs ADDED
@@ -0,0 +1,97 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using System;
3
+ using UnityEngine;
4
+
5
+ namespace DREditor.Doors
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ [Serializable]
11
+ public class DoorData
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [Header("")]
17
+ [Divider]
18
+ [Tooltip("")]
19
+ public string doorName;
20
+
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ [Tooltip("")]
25
+ public bool identified;
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ [Tooltip("")]
31
+ public string displayName;
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ [Tooltip("")]
37
+ public string unidentifiedDisplayName = "???";
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ [Tooltip("")]
43
+ public ScriptableObject roomLoadOptions;
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ [Tooltip("")]
49
+ public LockData lockData;
50
+
51
+
52
+ /// <summary>
53
+ ///
54
+ /// </summary>
55
+ /// <param name="doorName"></param>
56
+ public virtual void SetName(string doorName) => this.doorName = doorName;
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ /// <param name="displayName"></param>
62
+ public virtual void SetDisplayName(string displayName) => this.displayName = displayName;
63
+
64
+ /// <summary>
65
+ ///
66
+ /// </summary>
67
+ /// <param name="identified"></param>
68
+ public virtual void SetIdentified(bool identified) => this.identified = identified;
69
+
70
+
71
+ /// <summary>
72
+ ///
73
+ /// </summary>
74
+ public virtual void ClearLockData() => lockData.ClearData();
75
+
76
+ /// <summary>
77
+ ///
78
+ /// </summary>
79
+ /// <returns></returns>
80
+ public virtual object Clone()
81
+ {
82
+ DoorData copy = (DoorData)MemberwiseClone();
83
+
84
+ DoorData data = new()
85
+ {
86
+ doorName = copy.doorName,
87
+ displayName = copy.displayName,
88
+ unidentifiedDisplayName = copy.unidentifiedDisplayName,
89
+ roomLoadOptions = copy.roomLoadOptions,
90
+ lockData = (LockData)lockData.Clone(),
91
+ identified = copy.identified
92
+ };
93
+
94
+ return data;
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4fec27573110c4a4aae68e866e3cf77f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/IDoor.cs ADDED
@@ -0,0 +1,61 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+
3
+ namespace DREditor.Doors
4
+ {
5
+ /// <summary>
6
+ ///
7
+ /// </summary>
8
+ public interface IDoor
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ void ClearLockData();
14
+
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ /// <returns></returns>
19
+ object Save();
20
+
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ /// <param name="data"></param>
25
+ void Load(object data);
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ /// <returns></returns>
31
+ string GetGameObjectName();
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ /// <returns></returns>
37
+ string GetDoorName();
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ /// <returns></returns>
43
+ string GetSaveDisplayName();
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ void AddDoorControl();
49
+
50
+ /// <summary>
51
+ ///
52
+ /// </summary>
53
+ void RemoveDoorControl();
54
+
55
+ /// <summary>
56
+ ///
57
+ /// </summary>
58
+ /// <returns></returns>
59
+ bool IsTPFD();
60
+ }
61
+ }
package/IDoor.cs.meta ADDED
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e540fc55ca3946345a6218e566ef940e
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,18 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Services;
4
+
5
+ namespace DREditor.Doors
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ public abstract class LeaveAskManager : ServiceHolder<LeaveAskManager>
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ /// <returns></returns>
16
+ public abstract DialogueCore GetLeaveAskDialogue();
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 18151fdbad944834aa9903331c954d96
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/LockData.cs ADDED
@@ -0,0 +1,127 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.LocalDialogues;
4
+ using DREditor.Progressing.Handling;
5
+ using DREditor.Services;
6
+ using System;
7
+ using System.Collections.Generic;
8
+ using System.Linq;
9
+ using UnityEngine;
10
+ using UnityEngine.Serialization;
11
+
12
+ namespace DREditor.Doors
13
+ {
14
+ /// <summary>
15
+ ///
16
+ /// </summary>
17
+ [Serializable]
18
+ public class LockData : IDialogueHolder
19
+ {
20
+ /// <summary>
21
+ ///
22
+ /// </summary>
23
+ [Header("")]
24
+ [Divider]
25
+ [Tooltip("")]
26
+ [FormerlySerializedAs("unlockedDialogue")]
27
+ public List<LocalDialogue> unlockedDialogues = new();
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ [Tooltip("")]
33
+ [FormerlySerializedAs("flagList")]
34
+ public List<string> flags = new();
35
+
36
+ /// <summary>
37
+ ///
38
+ /// </summary>
39
+ [Space]
40
+
41
+ [Tooltip("")]
42
+ public bool locked = false;
43
+
44
+ /// <summary>
45
+ ///
46
+ /// </summary>
47
+ [Tooltip("")]
48
+ [FormerlySerializedAs("lockDialogue")]
49
+ public List<LocalDialogue> lockDialogues = new();
50
+
51
+
52
+ /// <summary>
53
+ ///
54
+ /// </summary>
55
+ /// <returns></returns>
56
+ public virtual bool IsLocked() => locked || !IsUnlocked();
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ /// <returns></returns>
62
+ public virtual bool IsUnlocked()
63
+ {
64
+ if (flags.Count == 0 && lockDialogues != null && lockDialogues.Count > 0)
65
+ return false;
66
+
67
+ var list = flags.ToArray().Where(flagName =>
68
+ ServiceLocator.GetService<FlagTriggerHandlerBase>().IsFlagTriggered(flagName));
69
+
70
+ return list.Count() == flags.Count;
71
+ }
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ public virtual void ClearData()
77
+ {
78
+ unlockedDialogues.Clear();
79
+
80
+ flags.Clear();
81
+
82
+ lockDialogues.Clear();
83
+
84
+ locked = false;
85
+ }
86
+
87
+ /// <summary>
88
+ ///
89
+ /// </summary>
90
+ /// <returns></returns>
91
+ public virtual object Clone()
92
+ {
93
+ LockData copy = (LockData)MemberwiseClone();
94
+
95
+ LockData data = new()
96
+ {
97
+ unlockedDialogues = CloneList(copy.unlockedDialogues),
98
+ lockDialogues = CloneList(copy.lockDialogues),
99
+ flags = CloneList(copy.flags),
100
+ locked = copy.locked
101
+ };
102
+
103
+ return data;
104
+ }
105
+
106
+ /// <summary>
107
+ ///
108
+ /// </summary>
109
+ /// <typeparam name="T"></typeparam>
110
+ /// <param name="copy"></param>
111
+ /// <returns></returns>
112
+ /// <remarks></remarks>
113
+ static List<T> CloneList<T>(List<T> copy)
114
+ {
115
+ List<T> dupe = new();
116
+
117
+ foreach (T obj in copy)
118
+ dupe.Add(obj);
119
+
120
+ return dupe;
121
+ }
122
+
123
+
124
+ /// <inheritdoc/>
125
+ public virtual bool CheckIfSaveDialogue() => unlockedDialogues.CheckIfSaveDialogue() || lockDialogues.CheckIfSaveDialogue();
126
+ }
127
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0e519024531367947a7cb1727a4dc211
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,49 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!1 &3871638339314370693
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: 3871638339314370698}
12
+ - component: {fileID: 3871638339314370699}
13
+ m_Layer: 0
14
+ m_Name: Leave_Ask_Manager_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 &3871638339314370698
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: 3871638339314370693}
27
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
28
+ m_LocalPosition: {x: 0, y: 0, z: 0}
29
+ m_LocalScale: {x: 1, y: 1, z: 1}
30
+ m_ConstrainProportionsScale: 0
31
+ m_Children: []
32
+ m_Father: {fileID: 0}
33
+ m_RootOrder: 0
34
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35
+ --- !u!114 &3871638339314370699
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: 3871638339314370693}
42
+ m_Enabled: 1
43
+ m_EditorHideFlags: 0
44
+ m_Script: {fileID: 11500000, guid: b3447c775421bee489cfab66c03b42a1, type: 3}
45
+ m_Name:
46
+ m_EditorClassIdentifier:
47
+ registerService: 1
48
+ dontDestroyOnLoad: 0
49
+ leaveAsk: {fileID: 0}
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 4d54f5336ac718b459dfff9b3de3f0a7
3
+ PrefabImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Samples.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: dd1b7790a91ce654abf4d4bc4802ccdd
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
- {
2
- "name": "net.dreditor.doors",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "net.dreditor.doors",
3
+ "version": "0.1.6",
4
+ "displayName": "DREditor Doors",
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.inputsystem": "1.19.0",
9
+ "net.dreditor.core": "0.1.6",
10
+ "net.dreditor.input": "0.1.6",
11
+ "net.dreditor.localdialogues": "0.1.6",
12
+ "net.dreditor.progressing.handling": "0.1.6",
13
+ "net.dreditor.roomloading": "0.1.6",
14
+ "net.dreditor.choices": "0.1.6"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "author": {
20
+ "name": "Benjamin \"Sweden\" Jillson",
21
+ "email": "dreditortool@gmail.com",
22
+ "url": "https://dreditor.net"
23
+ },
24
+ "keywords": [
25
+ "editor",
26
+ "tool",
27
+ "dreditor"
28
+ ],
29
+ "samples": [
30
+ {
31
+ "displayName": "Samples",
32
+ "description": "",
33
+ "path": "Samples~"
34
+ }
35
+ ],
36
+ "documentationUrl": "https://dreditor.net",
37
+ "license": "Apache-2.0",
38
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
39
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html"
40
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: f0946be56e4898a488fa5505111790f4
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.