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.
- package/.attestation.p7m +0 -0
- package/CharacterReactionIndicator.cs +180 -180
- package/CharacterReactionIndicator.cs.meta +11 -11
- package/DREditor.Presents.UI.asmdef +24 -24
- package/DREditor.Presents.UI.asmdef.meta +7 -7
- package/DialoguePresentResolver.cs +118 -118
- package/DialoguePresentResolver.cs.meta +11 -11
- package/GivePresentEventHandler.cs +67 -67
- package/GivePresentEventHandler.cs.meta +11 -11
- package/MenuPresentSelectEvaluator.cs +94 -94
- package/MenuPresentSelectEvaluator.cs.meta +11 -11
- package/PresentDisplayer.cs +153 -153
- package/PresentDisplayer.cs.meta +11 -11
- package/PresentIconSlot.cs +143 -143
- package/PresentIconSlot.cs.meta +11 -11
- package/PresentIconSpawner.cs +42 -42
- package/PresentIconSpawner.cs.meta +11 -11
- package/PresentResolver.cs +19 -19
- package/PresentResolver.cs.meta +11 -11
- package/PresentSelectEvaluator.cs +167 -167
- package/PresentSelectEvaluator.cs.meta +11 -11
- package/PresentUI.cs +280 -280
- package/PresentUI.cs.meta +11 -11
- package/ReactionIndicatorSpawner.cs +57 -57
- package/ReactionIndicatorSpawner.cs.meta +11 -11
- package/{Samples → Samples~}/Animations/Present_UI.controller +220 -220
- package/{Samples → Samples~}/Animations/Present_UI.controller.meta +8 -8
- package/{Samples → Samples~}/Animations/UI_Pr_HideAnim.anim +232 -232
- package/{Samples → Samples~}/Animations/UI_Pr_HideAnim.anim.meta +8 -8
- package/{Samples → Samples~}/Animations.meta +8 -8
- package/{Samples → Samples~}/DRE_Present_UI.unity +381 -381
- package/{Samples → Samples~}/DRE_Present_UI.unity.meta +7 -7
- package/{Samples → Samples~}/Present_Displayer_UI_ETemplate.prefab +900 -900
- package/{Samples → Samples~}/Present_Displayer_UI_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Present_Icon_Slot_ETemplate.prefab +351 -351
- package/{Samples → Samples~}/Present_Icon_Slot_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Present_UI_Canvas_Shell.prefab +1523 -1523
- package/{Samples → Samples~}/Present_UI_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Present_UI_Canvas_Template.prefab +11800 -11800
- package/{Samples → Samples~}/Present_UI_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Present_UI_Character_Grid_ETemplate.prefab +154 -154
- package/{Samples → Samples~}/Present_UI_Character_Grid_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Present_UI_Reaction_Indicator_ETemplate.prefab +95 -95
- package/{Samples → Samples~}/Present_UI_Reaction_Indicator_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Present_UI_Slots_ETemplate.prefab +79 -79
- package/{Samples → Samples~}/Present_UI_Slots_ETemplate.prefab.meta +7 -7
- package/package.json +47 -42
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/PresentIconSpawner.cs
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using UnityEngine;
|
|
3
|
-
|
|
4
|
-
namespace DREditor.Presents.UI
|
|
5
|
-
{
|
|
6
|
-
/// <summary>
|
|
7
|
-
///
|
|
8
|
-
/// </summary>
|
|
9
|
-
[ClassHeader("")]
|
|
10
|
-
public class PresentIconSpawner : MonoBehaviour
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
[Tooltip("")]
|
|
16
|
-
[SerializeField] protected GameObject presentIconPrefab;
|
|
17
|
-
|
|
18
|
-
/// <summary>
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
[Tooltip("")]
|
|
22
|
-
[SerializeField] protected int spawnAmount = 32;
|
|
23
|
-
|
|
24
|
-
#if UNITY_EDITOR
|
|
25
|
-
/// <summary>
|
|
26
|
-
///
|
|
27
|
-
/// </summary>
|
|
28
|
-
[ContextMenu("Spawn Icons")]
|
|
29
|
-
public void SpawnIcons()
|
|
30
|
-
{
|
|
31
|
-
if (presentIconPrefab == null)
|
|
32
|
-
{
|
|
33
|
-
UnityEngine.Debug.LogWarning("ALERT: The prefab field must be filled out!");
|
|
34
|
-
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
for (int i = 0; i < spawnAmount; i++)
|
|
39
|
-
UnityEditor.PrefabUtility.InstantiatePrefab(presentIconPrefab, transform);
|
|
40
|
-
}
|
|
41
|
-
#endif
|
|
42
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.Presents.UI
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
[ClassHeader("")]
|
|
10
|
+
public class PresentIconSpawner : MonoBehaviour
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[Tooltip("")]
|
|
16
|
+
[SerializeField] protected GameObject presentIconPrefab;
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected int spawnAmount = 32;
|
|
23
|
+
|
|
24
|
+
#if UNITY_EDITOR
|
|
25
|
+
/// <summary>
|
|
26
|
+
///
|
|
27
|
+
/// </summary>
|
|
28
|
+
[ContextMenu("Spawn Icons")]
|
|
29
|
+
public void SpawnIcons()
|
|
30
|
+
{
|
|
31
|
+
if (presentIconPrefab == null)
|
|
32
|
+
{
|
|
33
|
+
UnityEngine.Debug.LogWarning("ALERT: The prefab field must be filled out!");
|
|
34
|
+
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (int i = 0; i < spawnAmount; i++)
|
|
39
|
+
UnityEditor.PrefabUtility.InstantiatePrefab(presentIconPrefab, transform);
|
|
40
|
+
}
|
|
41
|
+
#endif
|
|
42
|
+
}
|
|
43
43
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 9c13a730873b01d479bc3bf56f76d674
|
|
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: 9c13a730873b01d479bc3bf56f76d674
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/PresentResolver.cs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using System.Collections;
|
|
3
|
-
using UnityEngine;
|
|
4
|
-
|
|
5
|
-
namespace DREditor.Presents.UI
|
|
6
|
-
{
|
|
7
|
-
/// <summary>
|
|
8
|
-
///
|
|
9
|
-
/// </summary>
|
|
10
|
-
public abstract class PresentResolver : MonoBehaviour
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
/// <param name="gavePresent"></param>
|
|
16
|
-
/// <param name="selectedPresentIndex"></param>
|
|
17
|
-
/// <returns></returns>
|
|
18
|
-
public abstract IEnumerator ResolvePresentSelection(bool gavePresent, int selectedPresentIndex);
|
|
19
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.Presents.UI
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
public abstract class PresentResolver : MonoBehaviour
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
/// <param name="gavePresent"></param>
|
|
16
|
+
/// <param name="selectedPresentIndex"></param>
|
|
17
|
+
/// <returns></returns>
|
|
18
|
+
public abstract IEnumerator ResolvePresentSelection(bool gavePresent, int selectedPresentIndex);
|
|
19
|
+
}
|
|
20
20
|
}
|
package/PresentResolver.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 379578779d946c041b646e1bda2a7c08
|
|
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: 379578779d946c041b646e1bda2a7c08
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Services;
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
using UnityEngine.Events;
|
|
7
|
-
using UnityEngine.InputSystem;
|
|
8
|
-
using static UnityEngine.InputSystem.InputAction;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.Presents.UI
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
public abstract class PresentSelectEvaluator : MonoBehaviour
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected InputActionReference submit = null;
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected PresentDatabase presentDatabase = null;
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
[Tooltip("")]
|
|
33
|
-
[SerializeField] protected PresentResolver presentResolver = null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
[Header("")]
|
|
37
|
-
public UnityEvent onGavePresentSelected;
|
|
38
|
-
|
|
39
|
-
[Header("")]
|
|
40
|
-
public UnityEvent onDidntGivePresentSelected;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/// <summary>
|
|
44
|
-
///
|
|
45
|
-
/// </summary>
|
|
46
|
-
public event Action OnChoiceMenuStarted;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/// <summary>
|
|
50
|
-
///
|
|
51
|
-
/// </summary>
|
|
52
|
-
protected bool gavePresent = false;
|
|
53
|
-
|
|
54
|
-
/// <summary>
|
|
55
|
-
///
|
|
56
|
-
/// </summary>
|
|
57
|
-
protected int selectedPresentIndex = -1;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/// <summary>
|
|
61
|
-
///
|
|
62
|
-
/// </summary>
|
|
63
|
-
/// <param name="selectedPresentIndex"></param>
|
|
64
|
-
public virtual void UpdateSelectedPresentIndex(int selectedPresentIndex) => this.selectedPresentIndex = selectedPresentIndex;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/// <summary>
|
|
68
|
-
///
|
|
69
|
-
/// </summary>
|
|
70
|
-
protected abstract void OnEnable();
|
|
71
|
-
|
|
72
|
-
/// <summary>
|
|
73
|
-
///
|
|
74
|
-
/// </summary>
|
|
75
|
-
protected abstract void OnDisable();
|
|
76
|
-
|
|
77
|
-
/// <summary>
|
|
78
|
-
///
|
|
79
|
-
/// </summary>
|
|
80
|
-
protected virtual void OnChoiceMenuStart() => OnChoiceMenuStarted?.Invoke();
|
|
81
|
-
|
|
82
|
-
/// <summary>
|
|
83
|
-
///
|
|
84
|
-
/// </summary>
|
|
85
|
-
public virtual void SubscribeCheckPresentSelect()
|
|
86
|
-
=> submit.action.performed += CheckPresentSelection;
|
|
87
|
-
|
|
88
|
-
/// <summary>
|
|
89
|
-
///
|
|
90
|
-
/// </summary>
|
|
91
|
-
public virtual void UnsubscribeCheckPresentSelect()
|
|
92
|
-
=> submit.action.performed -= CheckPresentSelection;
|
|
93
|
-
|
|
94
|
-
/// <summary>
|
|
95
|
-
///
|
|
96
|
-
/// </summary>
|
|
97
|
-
/// <param name="ctx"></param>
|
|
98
|
-
protected virtual void CheckPresentSelection(CallbackContext ctx)
|
|
99
|
-
{
|
|
100
|
-
if (SelectedPresentIsValid())
|
|
101
|
-
{
|
|
102
|
-
submit.action.performed -= CheckPresentSelection;
|
|
103
|
-
|
|
104
|
-
submit.action.performed += EvaluatePresentChoice;
|
|
105
|
-
|
|
106
|
-
OnSelectedValidPresent();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/// <summary>
|
|
111
|
-
///
|
|
112
|
-
/// </summary>
|
|
113
|
-
protected abstract void OnSelectedValidPresent();
|
|
114
|
-
|
|
115
|
-
/// <summary>
|
|
116
|
-
///
|
|
117
|
-
/// </summary>
|
|
118
|
-
/// <returns></returns>
|
|
119
|
-
protected virtual bool SelectedPresentIsValid()
|
|
120
|
-
{
|
|
121
|
-
if (presentDatabase.presents.Count == 0)
|
|
122
|
-
return false;
|
|
123
|
-
|
|
124
|
-
Present present = presentDatabase.presents[selectedPresentIndex];
|
|
125
|
-
|
|
126
|
-
IAmountablePresent presentData = ServiceLocator.GetService<IPresentManager>().Get<IAmountablePresent>(present.ID);
|
|
127
|
-
|
|
128
|
-
return present != null && presentData != null && presentData.Amount > 0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/// <summary>
|
|
132
|
-
///
|
|
133
|
-
/// </summary>
|
|
134
|
-
/// <param name="ctx"></param>
|
|
135
|
-
protected virtual void EvaluatePresentChoice(CallbackContext ctx)
|
|
136
|
-
=> submit.action.performed -= EvaluatePresentChoice;
|
|
137
|
-
|
|
138
|
-
/// <summary>
|
|
139
|
-
///
|
|
140
|
-
/// </summary>
|
|
141
|
-
protected virtual void OnGivePresentSelected()
|
|
142
|
-
{
|
|
143
|
-
gavePresent = selectedPresentIndex < presentDatabase.presents.Count && presentDatabase.presents[selectedPresentIndex] != null;
|
|
144
|
-
|
|
145
|
-
onGavePresentSelected?.Invoke();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/// <summary>
|
|
149
|
-
///
|
|
150
|
-
/// </summary>
|
|
151
|
-
protected virtual void OnDontGivePresentSelected() => onDidntGivePresentSelected?.Invoke();
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/// <summary>
|
|
155
|
-
///
|
|
156
|
-
/// </summary>
|
|
157
|
-
/// <param name="selectedPresentIndex"></param>
|
|
158
|
-
/// <returns></returns>
|
|
159
|
-
public virtual IEnumerator HandlePresentSelection(int selectedPresentIndex)
|
|
160
|
-
{
|
|
161
|
-
UpdateSelectedPresentIndex(selectedPresentIndex);
|
|
162
|
-
|
|
163
|
-
yield return presentResolver.ResolvePresentSelection(gavePresent, selectedPresentIndex);
|
|
164
|
-
|
|
165
|
-
gavePresent = false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Services;
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using UnityEngine.Events;
|
|
7
|
+
using UnityEngine.InputSystem;
|
|
8
|
+
using static UnityEngine.InputSystem.InputAction;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.Presents.UI
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
public abstract class PresentSelectEvaluator : MonoBehaviour
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected InputActionReference submit = null;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected PresentDatabase presentDatabase = null;
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected PresentResolver presentResolver = null;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
[Header("")]
|
|
37
|
+
public UnityEvent onGavePresentSelected;
|
|
38
|
+
|
|
39
|
+
[Header("")]
|
|
40
|
+
public UnityEvent onDidntGivePresentSelected;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
public event Action OnChoiceMenuStarted;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
protected bool gavePresent = false;
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
protected int selectedPresentIndex = -1;
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
/// <param name="selectedPresentIndex"></param>
|
|
64
|
+
public virtual void UpdateSelectedPresentIndex(int selectedPresentIndex) => this.selectedPresentIndex = selectedPresentIndex;
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
///
|
|
69
|
+
/// </summary>
|
|
70
|
+
protected abstract void OnEnable();
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
///
|
|
74
|
+
/// </summary>
|
|
75
|
+
protected abstract void OnDisable();
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
///
|
|
79
|
+
/// </summary>
|
|
80
|
+
protected virtual void OnChoiceMenuStart() => OnChoiceMenuStarted?.Invoke();
|
|
81
|
+
|
|
82
|
+
/// <summary>
|
|
83
|
+
///
|
|
84
|
+
/// </summary>
|
|
85
|
+
public virtual void SubscribeCheckPresentSelect()
|
|
86
|
+
=> submit.action.performed += CheckPresentSelection;
|
|
87
|
+
|
|
88
|
+
/// <summary>
|
|
89
|
+
///
|
|
90
|
+
/// </summary>
|
|
91
|
+
public virtual void UnsubscribeCheckPresentSelect()
|
|
92
|
+
=> submit.action.performed -= CheckPresentSelection;
|
|
93
|
+
|
|
94
|
+
/// <summary>
|
|
95
|
+
///
|
|
96
|
+
/// </summary>
|
|
97
|
+
/// <param name="ctx"></param>
|
|
98
|
+
protected virtual void CheckPresentSelection(CallbackContext ctx)
|
|
99
|
+
{
|
|
100
|
+
if (SelectedPresentIsValid())
|
|
101
|
+
{
|
|
102
|
+
submit.action.performed -= CheckPresentSelection;
|
|
103
|
+
|
|
104
|
+
submit.action.performed += EvaluatePresentChoice;
|
|
105
|
+
|
|
106
|
+
OnSelectedValidPresent();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// <summary>
|
|
111
|
+
///
|
|
112
|
+
/// </summary>
|
|
113
|
+
protected abstract void OnSelectedValidPresent();
|
|
114
|
+
|
|
115
|
+
/// <summary>
|
|
116
|
+
///
|
|
117
|
+
/// </summary>
|
|
118
|
+
/// <returns></returns>
|
|
119
|
+
protected virtual bool SelectedPresentIsValid()
|
|
120
|
+
{
|
|
121
|
+
if (presentDatabase.presents.Count == 0)
|
|
122
|
+
return false;
|
|
123
|
+
|
|
124
|
+
Present present = presentDatabase.presents[selectedPresentIndex];
|
|
125
|
+
|
|
126
|
+
IAmountablePresent presentData = ServiceLocator.GetService<IPresentManager>().Get<IAmountablePresent>(present.ID);
|
|
127
|
+
|
|
128
|
+
return present != null && presentData != null && presentData.Amount > 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/// <summary>
|
|
132
|
+
///
|
|
133
|
+
/// </summary>
|
|
134
|
+
/// <param name="ctx"></param>
|
|
135
|
+
protected virtual void EvaluatePresentChoice(CallbackContext ctx)
|
|
136
|
+
=> submit.action.performed -= EvaluatePresentChoice;
|
|
137
|
+
|
|
138
|
+
/// <summary>
|
|
139
|
+
///
|
|
140
|
+
/// </summary>
|
|
141
|
+
protected virtual void OnGivePresentSelected()
|
|
142
|
+
{
|
|
143
|
+
gavePresent = selectedPresentIndex < presentDatabase.presents.Count && presentDatabase.presents[selectedPresentIndex] != null;
|
|
144
|
+
|
|
145
|
+
onGavePresentSelected?.Invoke();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// <summary>
|
|
149
|
+
///
|
|
150
|
+
/// </summary>
|
|
151
|
+
protected virtual void OnDontGivePresentSelected() => onDidntGivePresentSelected?.Invoke();
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
/// <summary>
|
|
155
|
+
///
|
|
156
|
+
/// </summary>
|
|
157
|
+
/// <param name="selectedPresentIndex"></param>
|
|
158
|
+
/// <returns></returns>
|
|
159
|
+
public virtual IEnumerator HandlePresentSelection(int selectedPresentIndex)
|
|
160
|
+
{
|
|
161
|
+
UpdateSelectedPresentIndex(selectedPresentIndex);
|
|
162
|
+
|
|
163
|
+
yield return presentResolver.ResolvePresentSelection(gavePresent, selectedPresentIndex);
|
|
164
|
+
|
|
165
|
+
gavePresent = false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
168
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 89b5cd2b452256f4fb127ed44cb720e5
|
|
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: 89b5cd2b452256f4fb127ed44cb720e5
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|