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
@@ -1,154 +1,154 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.Services;
3
- using DREditor.UI;
4
- using System.Globalization;
5
- using TMPro;
6
- using UnityEngine;
7
-
8
- namespace DREditor.Presents.UI
9
- {
10
- /// <summary>
11
- ///
12
- /// </summary>
13
- [ClassHeader("")]
14
- public class PresentDisplayer : SelectedItemDisplayer
15
- {
16
- /// <summary>
17
- ///
18
- /// </summary>
19
- [Header("")]
20
- [Divider]
21
- [Tooltip("")]
22
- [SerializeField] protected PresentDatabase presentDatabase = null;
23
-
24
-
25
- /// <summary>
26
- ///
27
- /// </summary>
28
- [Header("")]
29
- [Divider]
30
- [Tooltip("")]
31
- [SerializeField] protected TextMeshProUGUI percent = null;
32
-
33
- /// <summary>
34
- ///
35
- /// </summary>
36
- [Tooltip("")]
37
- [SerializeField] protected TextMeshProUGUI id = null;
38
-
39
- /// <summary>
40
- ///
41
- /// </summary>
42
- [Tooltip("")]
43
- [SerializeField] protected TextMeshProUGUI named = null;
44
-
45
- /// <summary>
46
- ///
47
- /// </summary>
48
- [Tooltip("")]
49
- [SerializeField] protected TextMeshProUGUI amount = null;
50
-
51
- /// <summary>
52
- ///
53
- /// </summary>
54
- [Tooltip("")]
55
- [SerializeField] protected TextMeshProUGUI description = null;
56
-
57
-
58
- /// <summary>
59
- ///
60
- /// </summary>
61
- [Header("")]
62
- [Divider]
63
- [Tooltip("")]
64
- [SerializeField] protected string amountPrefix = "X ";
65
-
66
- /// <summary>
67
- ///
68
- /// </summary>
69
- [Tooltip("")]
70
- [SerializeField] protected string amountFormat = "D3";
71
-
72
- /// <summary>
73
- ///
74
- /// </summary>
75
- [Tooltip("")]
76
- [SerializeField] protected string idPrefix = "NO. ";
77
-
78
- /// <summary>
79
- ///
80
- /// </summary>
81
- [Tooltip("")]
82
- [SerializeField] protected string unknownDataText = "???";
83
-
84
- /// <summary>
85
- ///
86
- /// </summary>
87
- [Tooltip("")]
88
- [SerializeField] protected string percentFormat = "000";
89
-
90
- /// <summary>
91
- ///
92
- /// </summary>
93
- [Tooltip("")]
94
- [SerializeField] protected bool roundPercent = true;
95
-
96
-
97
- /// <inheritdoc/>
98
- public override void DisplaySelectedItem(int index)
99
- {
100
- Present present = presentDatabase.presents[index];
101
-
102
- IAmountablePresent presentData = ServiceLocator.GetService<IPresentManager>().Get<IAmountablePresent>(present.ID);
103
-
104
- percent.text = GetPercent(ServiceLocator.GetService<IPresentManager>().Count, presentDatabase.presents.Count);
105
-
106
- id.text = GetFormattedAmount(idPrefix, present.ID, amountFormat);
107
-
108
- if (presentData != null)
109
- {
110
- amount.text = GetFormattedAmount(amountPrefix, presentData.Amount, amountFormat);
111
-
112
- named.text = present.DisplayName;
113
-
114
- description.text = present.Description;
115
- }
116
- else
117
- {
118
- amount.text = unknownDataText;
119
-
120
- named.text = unknownDataText;
121
-
122
- description.text = unknownDataText;
123
- }
124
- }
125
-
126
- /// <summary>
127
- ///
128
- /// </summary>
129
- /// <param name="prefix"></param>
130
- /// <param name="value"></param>
131
- /// <param name="format"></param>
132
- /// <returns></returns>
133
- protected virtual string GetFormattedAmount(string prefix, int value, string format)
134
- => $"{prefix}{value.ToString(format)}";
135
-
136
- /// <summary>
137
- ///
138
- /// </summary>
139
- /// <param name="part"></param>
140
- /// <param name="whole"></param>
141
- /// <returns></returns>
142
- protected virtual string GetPercent(int part, int whole)
143
- {
144
- float percent;
145
-
146
- percent = (float)((double)part / whole * 100);
147
-
148
- if (roundPercent)
149
- percent = (float)Mathf.Round((float)percent);
150
-
151
- return percent.ToString(percentFormat, CultureInfo.InvariantCulture) + " %";
152
- }
153
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Services;
3
+ using DREditor.UI;
4
+ using System.Globalization;
5
+ using TMPro;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.Presents.UI
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader("")]
14
+ public class PresentDisplayer : SelectedItemDisplayer
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ [Header("")]
20
+ [Divider]
21
+ [Tooltip("")]
22
+ [SerializeField] protected PresentDatabase presentDatabase = null;
23
+
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ [Header("")]
29
+ [Divider]
30
+ [Tooltip("")]
31
+ [SerializeField] protected TextMeshProUGUI percent = null;
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ [Tooltip("")]
37
+ [SerializeField] protected TextMeshProUGUI id = null;
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ [Tooltip("")]
43
+ [SerializeField] protected TextMeshProUGUI named = null;
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ [Tooltip("")]
49
+ [SerializeField] protected TextMeshProUGUI amount = null;
50
+
51
+ /// <summary>
52
+ ///
53
+ /// </summary>
54
+ [Tooltip("")]
55
+ [SerializeField] protected TextMeshProUGUI description = null;
56
+
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ [Header("")]
62
+ [Divider]
63
+ [Tooltip("")]
64
+ [SerializeField] protected string amountPrefix = "X ";
65
+
66
+ /// <summary>
67
+ ///
68
+ /// </summary>
69
+ [Tooltip("")]
70
+ [SerializeField] protected string amountFormat = "D3";
71
+
72
+ /// <summary>
73
+ ///
74
+ /// </summary>
75
+ [Tooltip("")]
76
+ [SerializeField] protected string idPrefix = "NO. ";
77
+
78
+ /// <summary>
79
+ ///
80
+ /// </summary>
81
+ [Tooltip("")]
82
+ [SerializeField] protected string unknownDataText = "???";
83
+
84
+ /// <summary>
85
+ ///
86
+ /// </summary>
87
+ [Tooltip("")]
88
+ [SerializeField] protected string percentFormat = "000";
89
+
90
+ /// <summary>
91
+ ///
92
+ /// </summary>
93
+ [Tooltip("")]
94
+ [SerializeField] protected bool roundPercent = true;
95
+
96
+
97
+ /// <inheritdoc/>
98
+ public override void DisplaySelectedItem(int index)
99
+ {
100
+ Present present = presentDatabase.presents[index];
101
+
102
+ IAmountablePresent presentData = ServiceLocator.GetService<IPresentManager>().Get<IAmountablePresent>(present.ID);
103
+
104
+ percent.text = GetPercent(ServiceLocator.GetService<IPresentManager>().Count, presentDatabase.presents.Count);
105
+
106
+ id.text = GetFormattedAmount(idPrefix, present.ID, amountFormat);
107
+
108
+ if (presentData != null)
109
+ {
110
+ amount.text = GetFormattedAmount(amountPrefix, presentData.Amount, amountFormat);
111
+
112
+ named.text = present.DisplayName;
113
+
114
+ description.text = present.Description;
115
+ }
116
+ else
117
+ {
118
+ amount.text = unknownDataText;
119
+
120
+ named.text = unknownDataText;
121
+
122
+ description.text = unknownDataText;
123
+ }
124
+ }
125
+
126
+ /// <summary>
127
+ ///
128
+ /// </summary>
129
+ /// <param name="prefix"></param>
130
+ /// <param name="value"></param>
131
+ /// <param name="format"></param>
132
+ /// <returns></returns>
133
+ protected virtual string GetFormattedAmount(string prefix, int value, string format)
134
+ => $"{prefix}{value.ToString(format)}";
135
+
136
+ /// <summary>
137
+ ///
138
+ /// </summary>
139
+ /// <param name="part"></param>
140
+ /// <param name="whole"></param>
141
+ /// <returns></returns>
142
+ protected virtual string GetPercent(int part, int whole)
143
+ {
144
+ float percent;
145
+
146
+ percent = (float)((double)part / whole * 100);
147
+
148
+ if (roundPercent)
149
+ percent = (float)Mathf.Round((float)percent);
150
+
151
+ return percent.ToString(percentFormat, CultureInfo.InvariantCulture) + " %";
152
+ }
153
+ }
154
154
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 065a6cb69cb8af44da9069125fbd3764
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: 065a6cb69cb8af44da9069125fbd3764
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,144 +1,144 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.Processables;
3
- using DREditor.Services;
4
- using DREditor.UI;
5
- using TMPro;
6
- using UnityEngine;
7
- using UnityEngine.UI;
8
-
9
- namespace DREditor.Presents.UI
10
- {
11
- /// <summary>
12
- ///
13
- /// </summary>
14
- [ClassHeader(nameof(IGridIconSlot) +
15
- "\n\n")]
16
- public class PresentIconSlot : MonoBehaviour, IGridIconSlot
17
- {
18
- /// <summary>
19
- ///
20
- /// </summary>
21
- [Tooltip("")]
22
- [SerializeField] protected PresentDatabase presentDatabase = null;
23
-
24
-
25
- /// <summary>
26
- ///
27
- /// </summary>
28
- [Header("")]
29
- [Divider]
30
- [Tooltip("")]
31
- [SerializeField] protected Image presentIcon = null;
32
-
33
- /// <summary>
34
- ///
35
- /// </summary>
36
- [Tooltip("")]
37
- [SerializeField] protected Sprite undiscoveredIcon;
38
-
39
- /// <summary>
40
- ///
41
- /// </summary>
42
- [Tooltip("")]
43
- [SerializeField] protected GameObject newIcon = null;
44
-
45
-
46
- /// <summary>
47
- ///
48
- /// </summary>
49
- [Header("")]
50
- [Divider]
51
- [Tooltip("")]
52
- [SerializeField] protected Color selectedColor = Color.white;
53
-
54
- /// <summary>
55
- ///
56
- /// </summary>
57
- [Tooltip("")]
58
- [SerializeField] protected Color unselectedColor = Color.gray;
59
-
60
-
61
- /// <summary>
62
- ///
63
- /// </summary>
64
- [Header("")]
65
- [Divider]
66
- [Tooltip("")]
67
- [SerializeField] protected TextMeshProUGUI amountText = null;
68
-
69
- /// <summary>
70
- ///
71
- /// </summary>
72
- [Tooltip("")]
73
- [SerializeField] protected string amountPrefix = "X ";
74
-
75
- /// <summary>
76
- ///
77
- /// </summary>
78
- [Tooltip("")]
79
- [SerializeField] protected string amountFormat = "D3";
80
-
81
-
82
- /// <inheritdoc/>
83
- public virtual void UpdateSlot(int globalIndex, bool selected)
84
- {
85
- Present entry = presentDatabase.presents[globalIndex];
86
-
87
- var pres = ServiceLocator.GetService<IPresentManager>().Get<IIdentifiable>(entry.ID);
88
-
89
- if (selected && pres is INewPresentObtained obtainable && obtainable.JustObtained)
90
- obtainable.NoLongerNew();
91
-
92
- presentIcon.gameObject.SetActive(true);
93
-
94
- if (selected)
95
- presentIcon.color = selectedColor;
96
- else
97
- presentIcon.color = unselectedColor;
98
-
99
- UpdateIcon(entry, pres);
100
- }
101
-
102
- /// <summary>
103
- ///
104
- /// </summary>
105
- /// <param name="entry"></param>
106
- /// <param name="presentData"></param>
107
- protected virtual void UpdateIcon(Present entry, IIdentifiable presentData)
108
- {
109
- if (presentData != null)
110
- {
111
- presentIcon.sprite = entry.Image;
112
-
113
- if (newIcon != null && presentData is INewPresentObtained obtainable)
114
- newIcon.SetActive(obtainable.JustObtained);
115
-
116
- if (presentData is IAmountablePresent amountable)
117
- amountText.text = $"{amountPrefix} {amountable.Amount.ToString(amountFormat)}";
118
- }
119
- else
120
- {
121
- presentIcon.sprite = undiscoveredIcon;
122
-
123
- if (newIcon != null)
124
- newIcon.SetActive(false);
125
-
126
- amountText.text = string.Empty;
127
- }
128
- }
129
-
130
-
131
- /// <inheritdoc/>
132
- public virtual void ClearSlotState()
133
- {
134
- presentIcon.gameObject.SetActive(false);
135
-
136
- presentIcon.sprite = undiscoveredIcon;
137
-
138
- if (newIcon != null)
139
- newIcon.SetActive(false);
140
-
141
- amountText.text = string.Empty;
142
- }
143
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Processables;
3
+ using DREditor.Services;
4
+ using DREditor.UI;
5
+ using TMPro;
6
+ using UnityEngine;
7
+ using UnityEngine.UI;
8
+
9
+ namespace DREditor.Presents.UI
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ [ClassHeader(nameof(IGridIconSlot) +
15
+ "\n\n")]
16
+ public class PresentIconSlot : MonoBehaviour, IGridIconSlot
17
+ {
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ [SerializeField] protected PresentDatabase presentDatabase = null;
23
+
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ [Header("")]
29
+ [Divider]
30
+ [Tooltip("")]
31
+ [SerializeField] protected Image presentIcon = null;
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ [Tooltip("")]
37
+ [SerializeField] protected Sprite undiscoveredIcon;
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ [Tooltip("")]
43
+ [SerializeField] protected GameObject newIcon = null;
44
+
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ [Header("")]
50
+ [Divider]
51
+ [Tooltip("")]
52
+ [SerializeField] protected Color selectedColor = Color.white;
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ [Tooltip("")]
58
+ [SerializeField] protected Color unselectedColor = Color.gray;
59
+
60
+
61
+ /// <summary>
62
+ ///
63
+ /// </summary>
64
+ [Header("")]
65
+ [Divider]
66
+ [Tooltip("")]
67
+ [SerializeField] protected TextMeshProUGUI amountText = null;
68
+
69
+ /// <summary>
70
+ ///
71
+ /// </summary>
72
+ [Tooltip("")]
73
+ [SerializeField] protected string amountPrefix = "X ";
74
+
75
+ /// <summary>
76
+ ///
77
+ /// </summary>
78
+ [Tooltip("")]
79
+ [SerializeField] protected string amountFormat = "D3";
80
+
81
+
82
+ /// <inheritdoc/>
83
+ public virtual void UpdateSlot(int globalIndex, bool selected)
84
+ {
85
+ Present entry = presentDatabase.presents[globalIndex];
86
+
87
+ var pres = ServiceLocator.GetService<IPresentManager>().Get<IIdentifiable>(entry.ID);
88
+
89
+ if (selected && pres is INewPresentObtained obtainable && obtainable.JustObtained)
90
+ obtainable.NoLongerNew();
91
+
92
+ presentIcon.gameObject.SetActive(true);
93
+
94
+ if (selected)
95
+ presentIcon.color = selectedColor;
96
+ else
97
+ presentIcon.color = unselectedColor;
98
+
99
+ UpdateIcon(entry, pres);
100
+ }
101
+
102
+ /// <summary>
103
+ ///
104
+ /// </summary>
105
+ /// <param name="entry"></param>
106
+ /// <param name="presentData"></param>
107
+ protected virtual void UpdateIcon(Present entry, IIdentifiable presentData)
108
+ {
109
+ if (presentData != null)
110
+ {
111
+ presentIcon.sprite = entry.Image;
112
+
113
+ if (newIcon != null && presentData is INewPresentObtained obtainable)
114
+ newIcon.SetActive(obtainable.JustObtained);
115
+
116
+ if (presentData is IAmountablePresent amountable)
117
+ amountText.text = $"{amountPrefix} {amountable.Amount.ToString(amountFormat)}";
118
+ }
119
+ else
120
+ {
121
+ presentIcon.sprite = undiscoveredIcon;
122
+
123
+ if (newIcon != null)
124
+ newIcon.SetActive(false);
125
+
126
+ amountText.text = string.Empty;
127
+ }
128
+ }
129
+
130
+
131
+ /// <inheritdoc/>
132
+ public virtual void ClearSlotState()
133
+ {
134
+ presentIcon.gameObject.SetActive(false);
135
+
136
+ presentIcon.sprite = undiscoveredIcon;
137
+
138
+ if (newIcon != null)
139
+ newIcon.SetActive(false);
140
+
141
+ amountText.text = string.Empty;
142
+ }
143
+ }
144
144
  }
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 6ac22df3dc71cd947b6ebcdfba8aed9e
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: 6ac22df3dc71cd947b6ebcdfba8aed9e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: