net.dreditor.presents.ui 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.
Files changed (49) hide show
  1. package/.attestation.p7m +0 -0
  2. package/CharacterReactionIndicator.cs +180 -180
  3. package/CharacterReactionIndicator.cs.meta +11 -11
  4. package/DREditor.Presents.UI.asmdef +24 -24
  5. package/DREditor.Presents.UI.asmdef.meta +7 -7
  6. package/DialoguePresentResolver.cs +118 -118
  7. package/DialoguePresentResolver.cs.meta +11 -11
  8. package/GivePresentEventHandler.cs +67 -67
  9. package/GivePresentEventHandler.cs.meta +11 -11
  10. package/MenuPresentSelectEvaluator.cs +94 -94
  11. package/MenuPresentSelectEvaluator.cs.meta +11 -11
  12. package/PresentDisplayer.cs +153 -153
  13. package/PresentDisplayer.cs.meta +11 -11
  14. package/PresentIconSlot.cs +143 -143
  15. package/PresentIconSlot.cs.meta +11 -11
  16. package/PresentIconSpawner.cs +42 -42
  17. package/PresentIconSpawner.cs.meta +11 -11
  18. package/PresentResolver.cs +19 -19
  19. package/PresentResolver.cs.meta +11 -11
  20. package/PresentSelectEvaluator.cs +167 -167
  21. package/PresentSelectEvaluator.cs.meta +11 -11
  22. package/PresentUI.cs +280 -280
  23. package/PresentUI.cs.meta +11 -11
  24. package/ReactionIndicatorSpawner.cs +57 -57
  25. package/ReactionIndicatorSpawner.cs.meta +11 -11
  26. package/{Samples → Samples~}/Animations/Present_UI.controller +220 -220
  27. package/{Samples → Samples~}/Animations/Present_UI.controller.meta +8 -8
  28. package/{Samples → Samples~}/Animations/UI_Pr_HideAnim.anim +232 -232
  29. package/{Samples → Samples~}/Animations/UI_Pr_HideAnim.anim.meta +8 -8
  30. package/{Samples → Samples~}/Animations.meta +8 -8
  31. package/{Samples → Samples~}/DRE_Present_UI.unity +381 -381
  32. package/{Samples → Samples~}/DRE_Present_UI.unity.meta +7 -7
  33. package/{Samples → Samples~}/Present_Displayer_UI_ETemplate.prefab +900 -900
  34. package/{Samples → Samples~}/Present_Displayer_UI_ETemplate.prefab.meta +7 -7
  35. package/{Samples → Samples~}/Present_Icon_Slot_ETemplate.prefab +351 -351
  36. package/{Samples → Samples~}/Present_Icon_Slot_ETemplate.prefab.meta +7 -7
  37. package/{Samples → Samples~}/Present_UI_Canvas_Shell.prefab +1523 -1523
  38. package/{Samples → Samples~}/Present_UI_Canvas_Shell.prefab.meta +7 -7
  39. package/{Samples → Samples~}/Present_UI_Canvas_Template.prefab +11800 -11800
  40. package/{Samples → Samples~}/Present_UI_Canvas_Template.prefab.meta +7 -7
  41. package/{Samples → Samples~}/Present_UI_Character_Grid_ETemplate.prefab +154 -154
  42. package/{Samples → Samples~}/Present_UI_Character_Grid_ETemplate.prefab.meta +7 -7
  43. package/{Samples → Samples~}/Present_UI_Reaction_Indicator_ETemplate.prefab +95 -95
  44. package/{Samples → Samples~}/Present_UI_Reaction_Indicator_ETemplate.prefab.meta +7 -7
  45. package/{Samples → Samples~}/Present_UI_Slots_ETemplate.prefab +79 -79
  46. package/{Samples → Samples~}/Present_UI_Slots_ETemplate.prefab.meta +7 -7
  47. package/package.json +47 -42
  48. package/package.json.meta +7 -7
  49. package/Samples.meta +0 -8
package/PresentUI.cs CHANGED
@@ -1,281 +1,281 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.EventObjects;
3
- using DREditor.Services;
4
- using DREditor.UI;
5
- using DREditor.UIHandling;
6
- using System.Collections;
7
- using UnityEngine;
8
- using UnityEngine.EventSystems;
9
- using static UnityEngine.InputSystem.InputAction;
10
-
11
- namespace DREditor.Presents.UI
12
- {
13
- /// <summary>
14
- ///
15
- /// </summary>
16
- /// <remarks></remarks>
17
- [ClassHeader(nameof(ScrollGridUI) + ", " + nameof(MenuGroupBase) + ", " +
18
- nameof(IUIVisibility) + ", " + nameof(IToTitleScreen) +
19
- "\n\n")]
20
- public class PresentUI : ScrollGridUI
21
- {
22
- /// <summary>
23
- ///
24
- /// </summary>
25
- [Divider]
26
- [Space]
27
- [Header("")]
28
- [Divider]
29
- [Tooltip("")]
30
- [SerializeField] protected PresentDatabase presentDatabase = null;
31
-
32
- /// <summary>
33
- ///
34
- /// </summary>
35
- [Tooltip("")]
36
- [SerializeField] protected PresentSelectEvaluator presentSelectEvaluator = null;
37
-
38
-
39
- /// <summary>
40
- ///
41
- /// </summary>
42
- [Header("")]
43
- [Divider]
44
- [Tooltip("")]
45
- [SerializeField] protected BoolWithEvent inMenu = null;
46
-
47
- /// <summary>
48
- ///
49
- /// </summary>
50
- [Tooltip("")]
51
- [SerializeField] protected BoolWithEvent inPause = null;
52
-
53
- /// <summary>
54
- ///
55
- /// </summary>
56
- [Tooltip("")]
57
- [SerializeField] protected UIVisibilityComponent visibilityComponent = null;
58
-
59
-
60
- /// <summary>
61
- ///
62
- /// </summary>
63
- [Header("")]
64
- [Divider]
65
- [Tooltip("")]
66
- [SerializeField] protected Transform selector;
67
-
68
- /// <summary>
69
- ///
70
- /// </summary>
71
- [Tooltip("")]
72
- [SerializeField] protected SelectedItemDisplayer displayer = null;
73
-
74
- /// <summary>
75
- ///
76
- /// </summary>
77
- [Tooltip("")]
78
- [SerializeField] protected SelectedItemDisplayer[] indicatorDisplayers = null;
79
-
80
-
81
- /// <inheritdoc/>
82
- protected override void SubscribeControls()
83
- {
84
- base.SubscribeControls();
85
-
86
- AddBackInput();
87
-
88
- if (!inPause.Value)
89
- {
90
- presentSelectEvaluator.OnChoiceMenuStarted += UnsubscribeControls;
91
-
92
- presentSelectEvaluator.SubscribeCheckPresentSelect();
93
- }
94
- }
95
-
96
- /// <inheritdoc/>
97
- protected override void OnEnable()
98
- {
99
- base.OnEnable();
100
-
101
- presentSelectEvaluator.onGavePresentSelected.AddListener(OnGavePresent);
102
-
103
- presentSelectEvaluator.onDidntGivePresentSelected.AddListener(OnDidntGivePresent);
104
- }
105
-
106
- /// <inheritdoc/>
107
- protected override void OnDisable()
108
- {
109
- base.OnDisable();
110
-
111
- presentSelectEvaluator.onGavePresentSelected.RemoveListener(OnGavePresent);
112
-
113
- presentSelectEvaluator.onDidntGivePresentSelected.RemoveListener(OnDidntGivePresent);
114
- }
115
-
116
- /// <inheritdoc/>
117
- protected override void UnsubscribeControls()
118
- {
119
- base.UnsubscribeControls();
120
-
121
- RemoveBackInput();
122
-
123
- if (!inPause.Value)
124
- {
125
- presentSelectEvaluator.OnChoiceMenuStarted -= UnsubscribeControls;
126
-
127
- presentSelectEvaluator.UnsubscribeCheckPresentSelect();
128
- }
129
- }
130
-
131
- /// <summary>
132
- ///
133
- /// </summary>
134
- protected virtual void OnGavePresent() => Hide();
135
-
136
- /// <summary>
137
- ///
138
- /// </summary>
139
- protected virtual void OnDidntGivePresent() => SubscribeControls();
140
-
141
-
142
- /// <inheritdoc/>
143
- public override void Show()
144
- {
145
- BeforeStart?.Invoke();
146
-
147
- if (backGroup != null && backGroup.isActive)
148
- backGroup.Hide();
149
-
150
- EventSystem.current.SetSelectedGameObject(null);
151
-
152
- Time.timeScale = 0;
153
-
154
- inMenu.Value = true;
155
-
156
- StartCoroutine(ShowProcess());
157
- }
158
-
159
- /// <summary>
160
- ///
161
- /// </summary>
162
- protected virtual IEnumerator ShowProcess()
163
- {
164
- if (visibilityComponent != null)
165
- visibilityComponent.Show(); // We show before initialization so that the grid initializes properly.
166
-
167
- InitializeScrollGrid();
168
-
169
- RegenerateUI();
170
-
171
- if (visibilityComponent != null)
172
- yield return visibilityComponent.WaitForChangeToComplete();
173
-
174
- SubscribeControls();
175
-
176
- StartEvents?.Invoke();
177
-
178
- SetActive(true);
179
-
180
- ServiceLocator.GetService<MenuState>().SetChanging(false);
181
- }
182
-
183
- /// <inheritdoc/>
184
- public override void BackGroup(CallbackContext context)
185
- {
186
- if (backGroup != null && inPause.Value)
187
- {
188
- backGroup.SetEvaluateSelect();
189
-
190
- backGroup.AddBackInput();
191
-
192
- base.BackGroup(context);
193
- }
194
- else
195
- {
196
- OnBack?.Invoke();
197
-
198
- Hide();
199
- }
200
- }
201
-
202
- /// <inheritdoc/>
203
- public override void Hide()
204
- {
205
- UnsubscribeControls();
206
-
207
- EventSystem.current.SetSelectedGameObject(null);
208
-
209
- Time.timeScale = 1;
210
-
211
- EndEvents?.Invoke();
212
-
213
- StartCoroutine(HideProcess());
214
- }
215
-
216
- /// <summary>
217
- ///
218
- /// </summary>
219
- protected virtual IEnumerator HideProcess()
220
- {
221
- if (visibilityComponent != null)
222
- {
223
- visibilityComponent.Hide();
224
-
225
- yield return visibilityComponent.WaitForChangeToComplete();
226
- }
227
-
228
- if (!inPause.Value)
229
- yield return presentSelectEvaluator.HandlePresentSelection(selectedSlotIndex);
230
-
231
- if (!inPause.Value)
232
- inMenu.Value = false;
233
-
234
- SetActive(false);
235
- }
236
-
237
-
238
- /// <inheritdoc/>
239
- protected override void OnSlotHovered()
240
- {
241
- UpdateSelector();
242
-
243
- UpdateDisplayers();
244
-
245
- presentSelectEvaluator.UpdateSelectedPresentIndex(selectedSlotIndex);
246
- }
247
-
248
- /// <summary>
249
- ///
250
- /// </summary>
251
- protected virtual void UpdateSelector()
252
- {
253
- selector.SetParent(slots[GetSlotIndex()]);
254
-
255
- selector.localPosition = Vector3.zero;
256
-
257
- selector.localScale = Vector3.one;
258
- }
259
-
260
- /// <summary>
261
- ///
262
- /// </summary>
263
- protected virtual void UpdateDisplayers()
264
- {
265
- displayer.DisplaySelectedItem(globalIndex);
266
-
267
- foreach (var displayer in indicatorDisplayers)
268
- displayer.DisplaySelectedItem(globalIndex);
269
- }
270
-
271
-
272
- /// <inheritdoc/>
273
- public override void SetEvaluateSelect() => RegenerateUI();
274
-
275
- /// <inheritdoc/>
276
- protected override void ResetGroup() => UnsubscribeControls();
277
-
278
- /// <inheritdoc/>
279
- protected override int InitializeTotalObjectCount() => presentDatabase.presents.Count;
280
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using DREditor.Services;
4
+ using DREditor.UI;
5
+ using DREditor.UIHandling;
6
+ using System.Collections;
7
+ using UnityEngine;
8
+ using UnityEngine.EventSystems;
9
+ using static UnityEngine.InputSystem.InputAction;
10
+
11
+ namespace DREditor.Presents.UI
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ /// <remarks></remarks>
17
+ [ClassHeader(nameof(ScrollGridUI) + ", " + nameof(MenuGroupBase) + ", " +
18
+ nameof(IUIVisibility) + ", " + nameof(IToTitleScreen) +
19
+ "\n\n")]
20
+ public class PresentUI : ScrollGridUI
21
+ {
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Divider]
26
+ [Space]
27
+ [Header("")]
28
+ [Divider]
29
+ [Tooltip("")]
30
+ [SerializeField] protected PresentDatabase presentDatabase = null;
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ [Tooltip("")]
36
+ [SerializeField] protected PresentSelectEvaluator presentSelectEvaluator = null;
37
+
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ [Header("")]
43
+ [Divider]
44
+ [Tooltip("")]
45
+ [SerializeField] protected BoolWithEvent inMenu = null;
46
+
47
+ /// <summary>
48
+ ///
49
+ /// </summary>
50
+ [Tooltip("")]
51
+ [SerializeField] protected BoolWithEvent inPause = null;
52
+
53
+ /// <summary>
54
+ ///
55
+ /// </summary>
56
+ [Tooltip("")]
57
+ [SerializeField] protected UIVisibilityComponent visibilityComponent = null;
58
+
59
+
60
+ /// <summary>
61
+ ///
62
+ /// </summary>
63
+ [Header("")]
64
+ [Divider]
65
+ [Tooltip("")]
66
+ [SerializeField] protected Transform selector;
67
+
68
+ /// <summary>
69
+ ///
70
+ /// </summary>
71
+ [Tooltip("")]
72
+ [SerializeField] protected SelectedItemDisplayer displayer = null;
73
+
74
+ /// <summary>
75
+ ///
76
+ /// </summary>
77
+ [Tooltip("")]
78
+ [SerializeField] protected SelectedItemDisplayer[] indicatorDisplayers = null;
79
+
80
+
81
+ /// <inheritdoc/>
82
+ protected override void SubscribeControls()
83
+ {
84
+ base.SubscribeControls();
85
+
86
+ AddBackInput();
87
+
88
+ if (!inPause.Value)
89
+ {
90
+ presentSelectEvaluator.OnChoiceMenuStarted += UnsubscribeControls;
91
+
92
+ presentSelectEvaluator.SubscribeCheckPresentSelect();
93
+ }
94
+ }
95
+
96
+ /// <inheritdoc/>
97
+ protected override void OnEnable()
98
+ {
99
+ base.OnEnable();
100
+
101
+ presentSelectEvaluator.onGavePresentSelected.AddListener(OnGavePresent);
102
+
103
+ presentSelectEvaluator.onDidntGivePresentSelected.AddListener(OnDidntGivePresent);
104
+ }
105
+
106
+ /// <inheritdoc/>
107
+ protected override void OnDisable()
108
+ {
109
+ base.OnDisable();
110
+
111
+ presentSelectEvaluator.onGavePresentSelected.RemoveListener(OnGavePresent);
112
+
113
+ presentSelectEvaluator.onDidntGivePresentSelected.RemoveListener(OnDidntGivePresent);
114
+ }
115
+
116
+ /// <inheritdoc/>
117
+ protected override void UnsubscribeControls()
118
+ {
119
+ base.UnsubscribeControls();
120
+
121
+ RemoveBackInput();
122
+
123
+ if (!inPause.Value)
124
+ {
125
+ presentSelectEvaluator.OnChoiceMenuStarted -= UnsubscribeControls;
126
+
127
+ presentSelectEvaluator.UnsubscribeCheckPresentSelect();
128
+ }
129
+ }
130
+
131
+ /// <summary>
132
+ ///
133
+ /// </summary>
134
+ protected virtual void OnGavePresent() => Hide();
135
+
136
+ /// <summary>
137
+ ///
138
+ /// </summary>
139
+ protected virtual void OnDidntGivePresent() => SubscribeControls();
140
+
141
+
142
+ /// <inheritdoc/>
143
+ public override void Show()
144
+ {
145
+ BeforeStart?.Invoke();
146
+
147
+ if (backGroup != null && backGroup.isActive)
148
+ backGroup.Hide();
149
+
150
+ EventSystem.current.SetSelectedGameObject(null);
151
+
152
+ Time.timeScale = 0;
153
+
154
+ inMenu.Value = true;
155
+
156
+ StartCoroutine(ShowProcess());
157
+ }
158
+
159
+ /// <summary>
160
+ ///
161
+ /// </summary>
162
+ protected virtual IEnumerator ShowProcess()
163
+ {
164
+ if (visibilityComponent != null)
165
+ visibilityComponent.Show(); // We show before initialization so that the grid initializes properly.
166
+
167
+ InitializeScrollGrid();
168
+
169
+ RegenerateUI();
170
+
171
+ if (visibilityComponent != null)
172
+ yield return visibilityComponent.WaitForChangeToComplete();
173
+
174
+ SubscribeControls();
175
+
176
+ StartEvents?.Invoke();
177
+
178
+ SetActive(true);
179
+
180
+ ServiceLocator.GetService<MenuState>().SetChanging(false);
181
+ }
182
+
183
+ /// <inheritdoc/>
184
+ public override void BackGroup(CallbackContext context)
185
+ {
186
+ if (backGroup != null && inPause.Value)
187
+ {
188
+ backGroup.SetEvaluateSelect();
189
+
190
+ backGroup.AddBackInput();
191
+
192
+ base.BackGroup(context);
193
+ }
194
+ else
195
+ {
196
+ OnBack?.Invoke();
197
+
198
+ Hide();
199
+ }
200
+ }
201
+
202
+ /// <inheritdoc/>
203
+ public override void Hide()
204
+ {
205
+ UnsubscribeControls();
206
+
207
+ EventSystem.current.SetSelectedGameObject(null);
208
+
209
+ Time.timeScale = 1;
210
+
211
+ EndEvents?.Invoke();
212
+
213
+ StartCoroutine(HideProcess());
214
+ }
215
+
216
+ /// <summary>
217
+ ///
218
+ /// </summary>
219
+ protected virtual IEnumerator HideProcess()
220
+ {
221
+ if (visibilityComponent != null)
222
+ {
223
+ visibilityComponent.Hide();
224
+
225
+ yield return visibilityComponent.WaitForChangeToComplete();
226
+ }
227
+
228
+ if (!inPause.Value)
229
+ yield return presentSelectEvaluator.HandlePresentSelection(selectedSlotIndex);
230
+
231
+ if (!inPause.Value)
232
+ inMenu.Value = false;
233
+
234
+ SetActive(false);
235
+ }
236
+
237
+
238
+ /// <inheritdoc/>
239
+ protected override void OnSlotHovered()
240
+ {
241
+ UpdateSelector();
242
+
243
+ UpdateDisplayers();
244
+
245
+ presentSelectEvaluator.UpdateSelectedPresentIndex(selectedSlotIndex);
246
+ }
247
+
248
+ /// <summary>
249
+ ///
250
+ /// </summary>
251
+ protected virtual void UpdateSelector()
252
+ {
253
+ selector.SetParent(slots[GetSlotIndex()]);
254
+
255
+ selector.localPosition = Vector3.zero;
256
+
257
+ selector.localScale = Vector3.one;
258
+ }
259
+
260
+ /// <summary>
261
+ ///
262
+ /// </summary>
263
+ protected virtual void UpdateDisplayers()
264
+ {
265
+ displayer.DisplaySelectedItem(globalIndex);
266
+
267
+ foreach (var displayer in indicatorDisplayers)
268
+ displayer.DisplaySelectedItem(globalIndex);
269
+ }
270
+
271
+
272
+ /// <inheritdoc/>
273
+ public override void SetEvaluateSelect() => RegenerateUI();
274
+
275
+ /// <inheritdoc/>
276
+ protected override void ResetGroup() => UnsubscribeControls();
277
+
278
+ /// <inheritdoc/>
279
+ protected override int InitializeTotalObjectCount() => presentDatabase.presents.Count;
280
+ }
281
281
  }
package/PresentUI.cs.meta CHANGED
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 05191b7299c0e0a488ba2b91f139091b
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 05191b7299c0e0a488ba2b91f139091b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: