net.dreditor.subareas 0.1.6 → 0.1.8

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.
@@ -1,24 +1,24 @@
1
- fileFormatVersion: 2
2
- guid: 7fab2d3935c5e2a45aba26841b9b9851
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences:
7
- - currentDisplayName: {fileID: 11400000, guid: 88aacd5fe1fd23845940ecec407ac869,
8
- type: 2}
9
- - inDialogue: {fileID: 11400000, guid: b2839fc222ba4bc4eb8bcfee73b0c53d, type: 2}
10
- - inTPFD: {fileID: 11400000, guid: 7f90df5202cae904292188e37c9076d3, type: 2}
11
- - subAreaCollider: {instanceID: 0}
12
- - tpfdManager: {instanceID: 0}
13
- - objectGroup: {instanceID: 0}
14
- - inLeaveProcess: {fileID: 11400000, guid: 787d287b8159b5049bbd73ee10c03b1b, type: 2}
15
- - hasMenuAccess: {fileID: 11400000, guid: d969ff2ab7dd92342a1ac9ed2767ed51, type: 2}
16
- - isLoadingFile: {fileID: 11400000, guid: 1d94fdc8796dc9f43b2a3bedb0f5d4dd, type: 2}
17
- - inMenu: {fileID: 11400000, guid: ecf132a66f959974d84a1d2292242bdf, type: 2}
18
- - OnSAMDeactivateVisuals: {fileID: 11400000, guid: 3b1289797aec73f45be8b548325b0f46,
19
- type: 2}
20
- executionOrder: 0
21
- icon: {instanceID: 0}
22
- userData:
23
- assetBundleName:
24
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 7fab2d3935c5e2a45aba26841b9b9851
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences:
7
+ - currentDisplayName: {fileID: 11400000, guid: 88aacd5fe1fd23845940ecec407ac869,
8
+ type: 2}
9
+ - inDialogue: {fileID: 11400000, guid: b2839fc222ba4bc4eb8bcfee73b0c53d, type: 2}
10
+ - inTPFD: {fileID: 11400000, guid: 7f90df5202cae904292188e37c9076d3, type: 2}
11
+ - subAreaCollider: {instanceID: 0}
12
+ - tpfdManager: {instanceID: 0}
13
+ - objectGroup: {instanceID: 0}
14
+ - inLeaveProcess: {fileID: 11400000, guid: 787d287b8159b5049bbd73ee10c03b1b, type: 2}
15
+ - hasMenuAccess: {fileID: 11400000, guid: d969ff2ab7dd92342a1ac9ed2767ed51, type: 2}
16
+ - isLoadingFile: {fileID: 11400000, guid: 1d94fdc8796dc9f43b2a3bedb0f5d4dd, type: 2}
17
+ - inMenu: {fileID: 11400000, guid: ecf132a66f959974d84a1d2292242bdf, type: 2}
18
+ - OnSAMDeactivateVisuals: {fileID: 11400000, guid: 3b1289797aec73f45be8b548325b0f46,
19
+ type: 2}
20
+ executionOrder: 0
21
+ icon: {instanceID: 0}
22
+ userData:
23
+ assetBundleName:
24
+ assetBundleVariant:
package/SubAreaManager.cs CHANGED
@@ -1,191 +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.LocalDialogues;
6
- using System.Collections;
7
- using System.Collections.Generic;
8
- using UnityEngine;
9
-
10
- namespace DREditor.SubAreas
11
- {
12
- /// <summary>
13
- ///
14
- /// </summary>
15
- /// <remarks></remarks>
16
- [RequireComponent(typeof(BoxCollider))]
17
- [ClassHeader(nameof(SubAreaManagerBase) + ", " + nameof(ISubArea) + ", " + nameof(ISelectableObject) +
18
- "\n\n")]
19
- public class SubAreaManager : SubAreaManagerBase, ISubArea
20
- {
21
- /// <summary>
22
- ///
23
- /// </summary>
24
- [Header("")]
25
- [Divider]
26
- [Tooltip("")]
27
- [SerializeField] protected SelectableObject focusedActor = null;
28
-
29
- /// <summary>
30
- ///
31
- /// </summary>
32
- [Tooltip("")]
33
- [SerializeField] protected string displayName;
34
-
35
- /// <summary>
36
- ///
37
- /// </summary>
38
- [Tooltip("")]
39
- [SerializeField] protected SubAreaData Data = new();
40
-
41
-
42
- /// <summary>
43
- ///
44
- /// </summary>
45
- [Space(10)]
46
- [Header("")]
47
- [Divider]
48
- [Tooltip("")]
49
- [SerializeField] protected SubAreaActivationHandler activator = null;
50
-
51
- /// <summary>
52
- ///
53
- /// </summary>
54
- [Tooltip("")]
55
- [SerializeField] protected List<SubAreaActivationHandler> subAreaHandlers = new();
56
-
57
-
58
- /// <summary>
59
- ///
60
- /// </summary>
61
- [Header("")]
62
- [Divider]
63
- [Tooltip("")]
64
- [SerializeField] protected SceneEventListener onLoadingThreeDRoom = null;
65
-
66
- /// <summary>
67
- ///
68
- /// </summary>
69
- [Tooltip("")]
70
- [SerializeField] protected SceneEventListener onFinishedRoomTransitions = null;
71
-
72
- /// <summary>
73
- ///
74
- /// </summary>
75
- [Tooltip("")]
76
- [SerializeField] protected string enableMonobehavioursEvent = "EnableControlMonobehaviour";
77
-
78
-
79
- /// <summary>
80
- ///
81
- /// </summary>
82
- protected virtual void OnEnable()
83
- {
84
- onFinishedRoomTransitions.Response.AddListener(CheckLoad);
85
-
86
- onLoadingThreeDRoom.Response.AddListener(SetControlsFromLoadedData);
87
- }
88
-
89
- /// <summary>
90
- ///
91
- /// </summary>
92
- protected virtual void OnDisable()
93
- {
94
- onFinishedRoomTransitions.Response.RemoveListener(CheckLoad);
95
-
96
- onLoadingThreeDRoom.Response.RemoveListener(SetControlsFromLoadedData);
97
- }
98
-
99
- /// <summary>
100
- ///
101
- /// </summary>
102
- protected virtual void CheckLoad() => StartCoroutine(BufferCheckLoad());
103
-
104
- /// <summary>
105
- ///
106
- /// </summary>
107
- protected virtual IEnumerator BufferCheckLoad()
108
- {
109
- yield return null;
110
-
111
- if (ActivateSubAreaOnLoad())
112
- ActivateSubArea();
113
- }
114
-
115
- /// <summary>
116
- ///
117
- /// </summary>
118
- /// <returns></returns>
119
- protected virtual bool ActivateSubAreaOnLoad() => Data.activated && Data.EnterMissingOrUnlocked();
120
-
121
- /// <summary>
122
- ///
123
- /// </summary>
124
- protected virtual void ActivateSubArea() => activator.BeginActivationState();
125
-
126
-
127
- /// <summary>
128
- ///
129
- /// </summary>
130
- protected virtual void SetControlsFromLoadedData()
131
- {
132
- if (!Data.activated)
133
- DialogueEventSystem.TriggerEvent(enableMonobehavioursEvent);
134
- }
135
-
136
-
137
- /// <inheritdoc/>
138
- public virtual void SelectObject()
139
- {
140
- if (!SubAreaLocked())
141
- ActivateSubArea();
142
- }
143
-
144
- /// <summary>
145
- ///
146
- /// </summary>
147
- /// <returns></returns>
148
- protected virtual bool SubAreaLocked() =>
149
- Data.EnterDataValid() &&
150
- (DialoguePlayedOnAccessBlocked(Data.EnteringPermanentlyLocked(), Data.leaveData.lockDialogues) ||
151
- DialoguePlayedOnAccessBlocked(!Data.EnteringUnlocked(), Data.enterData.lockDialogues));
152
-
153
- /// <summary>
154
- ///
155
- /// </summary>
156
- /// <param name="blocked"></param>
157
- /// <param name="dialogues"></param>
158
- /// <returns></returns>
159
- protected virtual bool DialoguePlayedOnAccessBlocked(bool blocked, List<LocalDialogue> dialogues)
160
- => blocked && TryPlayingDialogue(focusedActor, dialogues);
161
-
162
-
163
- /// <inheritdoc/>
164
- public virtual string DisplayName
165
- {
166
- get => displayName;
167
-
168
- set => displayName = value;
169
- }
170
-
171
-
172
- /// <inheritdoc/>
173
- public virtual object Save() => (SubAreaData)Data.Clone();
174
-
175
- /// <inheritdoc/>
176
- public virtual void Load(object areaData)
177
- {
178
- Data = (SubAreaData)((SubAreaData)areaData).Clone();
179
-
180
- if (Data.activated)
181
- inTPFD.Value = true;
182
-
183
- foreach (var handler in subAreaHandlers)
184
- handler.Initialize(Data);
185
- }
186
-
187
-
188
- /// <inheritdoc/>
189
- public virtual bool CheckIfSaveDialogue() => Data is IDialogueHolder holder && holder.CheckIfSaveDialogue();
190
- }
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.LocalDialogues;
6
+ using System.Collections;
7
+ using System.Collections.Generic;
8
+ using UnityEngine;
9
+
10
+ namespace DREditor.SubAreas
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ /// <remarks></remarks>
16
+ [RequireComponent(typeof(BoxCollider))]
17
+ [ClassHeader(nameof(SubAreaManagerBase) + ", " + nameof(ISubArea) + ", " + nameof(ISelectableObject) +
18
+ "\n\n")]
19
+ public class SubAreaManager : SubAreaManagerBase, ISubArea
20
+ {
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ [Header("")]
25
+ [Divider]
26
+ [Tooltip("")]
27
+ [SerializeField] protected SelectableObject focusedActor = null;
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ [Tooltip("")]
33
+ [SerializeField] protected string displayName;
34
+
35
+ /// <summary>
36
+ ///
37
+ /// </summary>
38
+ [Tooltip("")]
39
+ [SerializeField] protected SubAreaData Data = new();
40
+
41
+
42
+ /// <summary>
43
+ ///
44
+ /// </summary>
45
+ [Space(10)]
46
+ [Header("")]
47
+ [Divider]
48
+ [Tooltip("")]
49
+ [SerializeField] protected SubAreaActivationHandler activator = null;
50
+
51
+ /// <summary>
52
+ ///
53
+ /// </summary>
54
+ [Tooltip("")]
55
+ [SerializeField] protected List<SubAreaActivationHandler> subAreaHandlers = new();
56
+
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ [Header("")]
62
+ [Divider]
63
+ [Tooltip("")]
64
+ [SerializeField] protected SceneEventListener onLoadingThreeDRoom = null;
65
+
66
+ /// <summary>
67
+ ///
68
+ /// </summary>
69
+ [Tooltip("")]
70
+ [SerializeField] protected SceneEventListener onFinishedRoomTransitions = null;
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ [Tooltip("")]
76
+ [SerializeField] protected string enableMonobehavioursEvent = "EnableControlMonobehaviour";
77
+
78
+
79
+ /// <summary>
80
+ ///
81
+ /// </summary>
82
+ protected virtual void OnEnable()
83
+ {
84
+ onFinishedRoomTransitions.Response.AddListener(CheckLoad);
85
+
86
+ onLoadingThreeDRoom.Response.AddListener(SetControlsFromLoadedData);
87
+ }
88
+
89
+ /// <summary>
90
+ ///
91
+ /// </summary>
92
+ protected virtual void OnDisable()
93
+ {
94
+ onFinishedRoomTransitions.Response.RemoveListener(CheckLoad);
95
+
96
+ onLoadingThreeDRoom.Response.RemoveListener(SetControlsFromLoadedData);
97
+ }
98
+
99
+ /// <summary>
100
+ ///
101
+ /// </summary>
102
+ protected virtual void CheckLoad() => StartCoroutine(BufferCheckLoad());
103
+
104
+ /// <summary>
105
+ ///
106
+ /// </summary>
107
+ protected virtual IEnumerator BufferCheckLoad()
108
+ {
109
+ yield return null;
110
+
111
+ if (ActivateSubAreaOnLoad())
112
+ ActivateSubArea();
113
+ }
114
+
115
+ /// <summary>
116
+ ///
117
+ /// </summary>
118
+ /// <returns></returns>
119
+ protected virtual bool ActivateSubAreaOnLoad() => Data.activated && Data.EnterMissingOrUnlocked();
120
+
121
+ /// <summary>
122
+ ///
123
+ /// </summary>
124
+ protected virtual void ActivateSubArea() => activator.BeginActivationState();
125
+
126
+
127
+ /// <summary>
128
+ ///
129
+ /// </summary>
130
+ protected virtual void SetControlsFromLoadedData()
131
+ {
132
+ if (!Data.activated)
133
+ DialogueEventSystem.TriggerEvent(enableMonobehavioursEvent);
134
+ }
135
+
136
+
137
+ /// <inheritdoc/>
138
+ public virtual void SelectObject()
139
+ {
140
+ if (!SubAreaLocked())
141
+ ActivateSubArea();
142
+ }
143
+
144
+ /// <summary>
145
+ ///
146
+ /// </summary>
147
+ /// <returns></returns>
148
+ protected virtual bool SubAreaLocked() =>
149
+ Data.EnterDataValid() &&
150
+ (DialoguePlayedOnAccessBlocked(Data.EnteringPermanentlyLocked(), Data.leaveData.lockDialogues) ||
151
+ DialoguePlayedOnAccessBlocked(!Data.EnteringUnlocked(), Data.enterData.lockDialogues));
152
+
153
+ /// <summary>
154
+ ///
155
+ /// </summary>
156
+ /// <param name="blocked"></param>
157
+ /// <param name="dialogues"></param>
158
+ /// <returns></returns>
159
+ protected virtual bool DialoguePlayedOnAccessBlocked(bool blocked, List<LocalDialogue> dialogues)
160
+ => blocked && TryPlayingDialogue(focusedActor, dialogues);
161
+
162
+
163
+ /// <inheritdoc/>
164
+ public virtual string DisplayName
165
+ {
166
+ get => displayName;
167
+
168
+ set => displayName = value;
169
+ }
170
+
171
+
172
+ /// <inheritdoc/>
173
+ public virtual object Save() => (SubAreaData)Data.Clone();
174
+
175
+ /// <inheritdoc/>
176
+ public virtual void Load(object areaData)
177
+ {
178
+ Data = (SubAreaData)((SubAreaData)areaData).Clone();
179
+
180
+ if (Data.activated)
181
+ inTPFD.Value = true;
182
+
183
+ foreach (var handler in subAreaHandlers)
184
+ handler.Initialize(Data);
185
+ }
186
+
187
+
188
+ /// <inheritdoc/>
189
+ public virtual bool CheckIfSaveDialogue() => Data is IDialogueHolder holder && holder.CheckIfSaveDialogue();
190
+ }
191
191
  }
@@ -1,19 +1,19 @@
1
- fileFormatVersion: 2
2
- guid: fce8491c363b00c4bace3da5b6788452
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences:
7
- - currentDisplayName: {fileID: 11400000, guid: 88aacd5fe1fd23845940ecec407ac869,
8
- type: 2}
9
- - inDialogue: {fileID: 11400000, guid: b2839fc222ba4bc4eb8bcfee73b0c53d, type: 2}
10
- - inTPFD: {fileID: 11400000, guid: 7f90df5202cae904292188e37c9076d3, type: 2}
11
- - focusedActor: {instanceID: 0}
12
- - activator: {instanceID: 0}
13
- - onLoadingThreeDRoom: {instanceID: 0}
14
- - onFinishedRoomTransitions: {instanceID: 0}
15
- executionOrder: 0
16
- icon: {instanceID: 0}
17
- userData:
18
- assetBundleName:
19
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: fce8491c363b00c4bace3da5b6788452
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences:
7
+ - currentDisplayName: {fileID: 11400000, guid: 88aacd5fe1fd23845940ecec407ac869,
8
+ type: 2}
9
+ - inDialogue: {fileID: 11400000, guid: b2839fc222ba4bc4eb8bcfee73b0c53d, type: 2}
10
+ - inTPFD: {fileID: 11400000, guid: 7f90df5202cae904292188e37c9076d3, type: 2}
11
+ - focusedActor: {instanceID: 0}
12
+ - activator: {instanceID: 0}
13
+ - onLoadingThreeDRoom: {instanceID: 0}
14
+ - onFinishedRoomTransitions: {instanceID: 0}
15
+ executionOrder: 0
16
+ icon: {instanceID: 0}
17
+ userData:
18
+ assetBundleName:
19
+ assetBundleVariant: