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/.attestation.p7m
ADDED
|
Binary file
|
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.UI;
|
|
3
|
-
using System.Linq;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
using UnityEngine.UI;
|
|
6
|
-
|
|
7
|
-
namespace DREditor.Presents.UI
|
|
8
|
-
{
|
|
9
|
-
/// <summary>
|
|
10
|
-
///
|
|
11
|
-
/// </summary>
|
|
12
|
-
[ClassHeader(nameof(SelectedItemDisplayer) +
|
|
13
|
-
"\n\n")]
|
|
14
|
-
[RequireComponent(typeof(Image))]
|
|
15
|
-
public class CharacterReactionIndicator : SelectedItemDisplayer
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected string characterName;
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected PresentDatabase presentDatabase = null;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/// <summary>
|
|
31
|
-
///
|
|
32
|
-
/// </summary>
|
|
33
|
-
[Header("")]
|
|
34
|
-
[Divider]
|
|
35
|
-
[Tooltip("")]
|
|
36
|
-
[SerializeField] protected Image indicatorImage = null;
|
|
37
|
-
|
|
38
|
-
/// <summary>
|
|
39
|
-
///
|
|
40
|
-
/// </summary>
|
|
41
|
-
[Tooltip("")]
|
|
42
|
-
[SerializeField] protected Sprite positiveArrow = null;
|
|
43
|
-
|
|
44
|
-
/// <summary>
|
|
45
|
-
///
|
|
46
|
-
/// </summary>
|
|
47
|
-
[Tooltip("")]
|
|
48
|
-
[SerializeField] protected Sprite negativeArrow = null;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/// <summary>
|
|
52
|
-
///
|
|
53
|
-
/// </summary>
|
|
54
|
-
protected Present currentPresent = null;
|
|
55
|
-
|
|
56
|
-
/// <summary>
|
|
57
|
-
///
|
|
58
|
-
/// </summary>
|
|
59
|
-
protected PresentManager presentDataHandler = null;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/// <summary>
|
|
63
|
-
///
|
|
64
|
-
/// </summary>
|
|
65
|
-
/// <param name="name"></param>
|
|
66
|
-
public virtual void InitializeName(string name) => characterName = name;
|
|
67
|
-
|
|
68
|
-
/// <inheritdoc/>
|
|
69
|
-
public override void DisplaySelectedItem(int globalIndex)
|
|
70
|
-
{
|
|
71
|
-
if (presentDatabase.presents[globalIndex] is Present present)
|
|
72
|
-
currentPresent = present;
|
|
73
|
-
else
|
|
74
|
-
currentPresent = null;
|
|
75
|
-
|
|
76
|
-
DisplayReaction();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/// <summary>
|
|
80
|
-
///
|
|
81
|
-
/// </summary>
|
|
82
|
-
protected virtual void DisplayReaction()
|
|
83
|
-
{
|
|
84
|
-
if (CurrentPresentValid())
|
|
85
|
-
return;
|
|
86
|
-
|
|
87
|
-
IReactionEntry reaction = currentPresent.attributes
|
|
88
|
-
.OfType<StudentReactionCollection>()
|
|
89
|
-
.FirstOrDefault()
|
|
90
|
-
.GetReactionByName(characterName);
|
|
91
|
-
|
|
92
|
-
if (reaction != null)
|
|
93
|
-
{
|
|
94
|
-
switch (reaction.ReactionIndex)
|
|
95
|
-
{
|
|
96
|
-
case 0:
|
|
97
|
-
DisplayLove();
|
|
98
|
-
return;
|
|
99
|
-
case 1:
|
|
100
|
-
DisplayLike();
|
|
101
|
-
return;
|
|
102
|
-
case 2:
|
|
103
|
-
DisplayNeutral();
|
|
104
|
-
return;
|
|
105
|
-
case 3:
|
|
106
|
-
DisplayDislike();
|
|
107
|
-
return;
|
|
108
|
-
case 4:
|
|
109
|
-
DisplayHate();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else
|
|
114
|
-
{
|
|
115
|
-
UnityEngine.Debug.LogWarning("Couldn't find Student Reaction for: " + characterName +
|
|
116
|
-
". Make sure that the present has a reaction for the character and that the " +
|
|
117
|
-
"characterName property on this script is spelled correctly!");
|
|
118
|
-
|
|
119
|
-
OnPresentNotFound();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/// <summary>
|
|
124
|
-
///
|
|
125
|
-
/// </summary>
|
|
126
|
-
/// <returns></returns>
|
|
127
|
-
protected virtual bool CurrentPresentValid()
|
|
128
|
-
{
|
|
129
|
-
if (presentDataHandler == null)
|
|
130
|
-
presentDataHandler = FindAnyObjectByType<PresentManager>();
|
|
131
|
-
|
|
132
|
-
bool result = presentDataHandler != null && !presentDataHandler.HadPresent(currentPresent.ID);
|
|
133
|
-
|
|
134
|
-
if (result || currentPresent == null)
|
|
135
|
-
OnPresentNotFound();
|
|
136
|
-
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/// <summary>
|
|
141
|
-
///
|
|
142
|
-
/// </summary>
|
|
143
|
-
protected virtual void OnPresentNotFound() => DisplayNeutral();
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/// <summary>
|
|
147
|
-
///
|
|
148
|
-
/// </summary>
|
|
149
|
-
protected virtual void DisplayLove()
|
|
150
|
-
{
|
|
151
|
-
indicatorImage.sprite = positiveArrow;
|
|
152
|
-
|
|
153
|
-
indicatorImage.enabled = true;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/// <summary>
|
|
157
|
-
///
|
|
158
|
-
/// </summary>
|
|
159
|
-
protected virtual void DisplayLike() => DisplayLove();
|
|
160
|
-
|
|
161
|
-
/// <summary>
|
|
162
|
-
///
|
|
163
|
-
/// </summary>
|
|
164
|
-
protected virtual void DisplayNeutral() => indicatorImage.enabled = false;
|
|
165
|
-
|
|
166
|
-
/// <summary>
|
|
167
|
-
///
|
|
168
|
-
/// </summary>
|
|
169
|
-
protected virtual void DisplayDislike() => DisplayHate();
|
|
170
|
-
|
|
171
|
-
/// <summary>
|
|
172
|
-
///
|
|
173
|
-
/// </summary>
|
|
174
|
-
protected virtual void DisplayHate()
|
|
175
|
-
{
|
|
176
|
-
indicatorImage.sprite = negativeArrow;
|
|
177
|
-
|
|
178
|
-
indicatorImage.enabled = true;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.UI;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.UI;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Presents.UI
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[ClassHeader(nameof(SelectedItemDisplayer) +
|
|
13
|
+
"\n\n")]
|
|
14
|
+
[RequireComponent(typeof(Image))]
|
|
15
|
+
public class CharacterReactionIndicator : SelectedItemDisplayer
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected string characterName;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected PresentDatabase presentDatabase = null;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
[Header("")]
|
|
34
|
+
[Divider]
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected Image indicatorImage = null;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
[Tooltip("")]
|
|
42
|
+
[SerializeField] protected Sprite positiveArrow = null;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected Sprite negativeArrow = null;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
///
|
|
53
|
+
/// </summary>
|
|
54
|
+
protected Present currentPresent = null;
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
///
|
|
58
|
+
/// </summary>
|
|
59
|
+
protected PresentManager presentDataHandler = null;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
/// <param name="name"></param>
|
|
66
|
+
public virtual void InitializeName(string name) => characterName = name;
|
|
67
|
+
|
|
68
|
+
/// <inheritdoc/>
|
|
69
|
+
public override void DisplaySelectedItem(int globalIndex)
|
|
70
|
+
{
|
|
71
|
+
if (presentDatabase.presents[globalIndex] is Present present)
|
|
72
|
+
currentPresent = present;
|
|
73
|
+
else
|
|
74
|
+
currentPresent = null;
|
|
75
|
+
|
|
76
|
+
DisplayReaction();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
///
|
|
81
|
+
/// </summary>
|
|
82
|
+
protected virtual void DisplayReaction()
|
|
83
|
+
{
|
|
84
|
+
if (CurrentPresentValid())
|
|
85
|
+
return;
|
|
86
|
+
|
|
87
|
+
IReactionEntry reaction = currentPresent.attributes
|
|
88
|
+
.OfType<StudentReactionCollection>()
|
|
89
|
+
.FirstOrDefault()
|
|
90
|
+
.GetReactionByName(characterName);
|
|
91
|
+
|
|
92
|
+
if (reaction != null)
|
|
93
|
+
{
|
|
94
|
+
switch (reaction.ReactionIndex)
|
|
95
|
+
{
|
|
96
|
+
case 0:
|
|
97
|
+
DisplayLove();
|
|
98
|
+
return;
|
|
99
|
+
case 1:
|
|
100
|
+
DisplayLike();
|
|
101
|
+
return;
|
|
102
|
+
case 2:
|
|
103
|
+
DisplayNeutral();
|
|
104
|
+
return;
|
|
105
|
+
case 3:
|
|
106
|
+
DisplayDislike();
|
|
107
|
+
return;
|
|
108
|
+
case 4:
|
|
109
|
+
DisplayHate();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
{
|
|
115
|
+
UnityEngine.Debug.LogWarning("Couldn't find Student Reaction for: " + characterName +
|
|
116
|
+
". Make sure that the present has a reaction for the character and that the " +
|
|
117
|
+
"characterName property on this script is spelled correctly!");
|
|
118
|
+
|
|
119
|
+
OnPresentNotFound();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
///
|
|
125
|
+
/// </summary>
|
|
126
|
+
/// <returns></returns>
|
|
127
|
+
protected virtual bool CurrentPresentValid()
|
|
128
|
+
{
|
|
129
|
+
if (presentDataHandler == null)
|
|
130
|
+
presentDataHandler = FindAnyObjectByType<PresentManager>();
|
|
131
|
+
|
|
132
|
+
bool result = presentDataHandler != null && !presentDataHandler.HadPresent(currentPresent.ID);
|
|
133
|
+
|
|
134
|
+
if (result || currentPresent == null)
|
|
135
|
+
OnPresentNotFound();
|
|
136
|
+
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// <summary>
|
|
141
|
+
///
|
|
142
|
+
/// </summary>
|
|
143
|
+
protected virtual void OnPresentNotFound() => DisplayNeutral();
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
/// <summary>
|
|
147
|
+
///
|
|
148
|
+
/// </summary>
|
|
149
|
+
protected virtual void DisplayLove()
|
|
150
|
+
{
|
|
151
|
+
indicatorImage.sprite = positiveArrow;
|
|
152
|
+
|
|
153
|
+
indicatorImage.enabled = true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/// <summary>
|
|
157
|
+
///
|
|
158
|
+
/// </summary>
|
|
159
|
+
protected virtual void DisplayLike() => DisplayLove();
|
|
160
|
+
|
|
161
|
+
/// <summary>
|
|
162
|
+
///
|
|
163
|
+
/// </summary>
|
|
164
|
+
protected virtual void DisplayNeutral() => indicatorImage.enabled = false;
|
|
165
|
+
|
|
166
|
+
/// <summary>
|
|
167
|
+
///
|
|
168
|
+
/// </summary>
|
|
169
|
+
protected virtual void DisplayDislike() => DisplayHate();
|
|
170
|
+
|
|
171
|
+
/// <summary>
|
|
172
|
+
///
|
|
173
|
+
/// </summary>
|
|
174
|
+
protected virtual void DisplayHate()
|
|
175
|
+
{
|
|
176
|
+
indicatorImage.sprite = negativeArrow;
|
|
177
|
+
|
|
178
|
+
indicatorImage.enabled = true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
181
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: a8ea21c9e47b44f46b690da925add04c
|
|
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: a8ea21c9e47b44f46b690da925add04c
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "DREditor.Presents.UI",
|
|
3
|
-
"rootNamespace": "",
|
|
4
|
-
"references": [
|
|
5
|
-
"DREditor",
|
|
6
|
-
"DREditor.UI",
|
|
7
|
-
"DREditor.UIHandling",
|
|
8
|
-
"Unity.TextMeshPro",
|
|
9
|
-
"Unity.InputSystem",
|
|
10
|
-
"DREditor.Input",
|
|
11
|
-
"DREditor.UI.Menus",
|
|
12
|
-
"DREditor.DialogueEventHandling",
|
|
13
|
-
"DREditor.Controls",
|
|
14
|
-
"DREditor.Presents"
|
|
15
|
-
],
|
|
16
|
-
"includePlatforms": [],
|
|
17
|
-
"excludePlatforms": [],
|
|
18
|
-
"allowUnsafeCode": false,
|
|
19
|
-
"overrideReferences": false,
|
|
20
|
-
"precompiledReferences": [],
|
|
21
|
-
"autoReferenced": true,
|
|
22
|
-
"defineConstraints": [],
|
|
23
|
-
"versionDefines": [],
|
|
24
|
-
"noEngineReferences": false
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.Presents.UI",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"DREditor",
|
|
6
|
+
"DREditor.UI",
|
|
7
|
+
"DREditor.UIHandling",
|
|
8
|
+
"Unity.TextMeshPro",
|
|
9
|
+
"Unity.InputSystem",
|
|
10
|
+
"DREditor.Input",
|
|
11
|
+
"DREditor.UI.Menus",
|
|
12
|
+
"DREditor.DialogueEventHandling",
|
|
13
|
+
"DREditor.Controls",
|
|
14
|
+
"DREditor.Presents"
|
|
15
|
+
],
|
|
16
|
+
"includePlatforms": [],
|
|
17
|
+
"excludePlatforms": [],
|
|
18
|
+
"allowUnsafeCode": false,
|
|
19
|
+
"overrideReferences": false,
|
|
20
|
+
"precompiledReferences": [],
|
|
21
|
+
"autoReferenced": true,
|
|
22
|
+
"defineConstraints": [],
|
|
23
|
+
"versionDefines": [],
|
|
24
|
+
"noEngineReferences": false
|
|
25
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 14bf24eb8813c164f8d7ea4120abd7fb
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 14bf24eb8813c164f8d7ea4120abd7fb
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|