net.dreditor.presents 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.
- package/.attestation.p7m +0 -0
- package/DREditor.Presents.asmdef +15 -15
- package/DREditor.Presents.asmdef.meta +7 -7
- package/Editor/CreatePresentsWizard.cs +159 -159
- package/Editor/CreatePresentsWizard.cs.meta +11 -11
- package/Editor/DREditor.Presents.Editor.asmdef +17 -17
- package/Editor/DREditor.Presents.Editor.asmdef.meta +7 -7
- package/Editor/DescriptionsByIDOption.cs +105 -105
- package/Editor/DescriptionsByIDOption.cs.meta +1 -1
- package/Editor/PresentDatabaseEditor.cs +183 -183
- package/Editor/PresentDatabaseEditor.cs.meta +11 -11
- package/Editor/PresentEditor.cs +152 -152
- package/Editor/PresentEditor.cs.meta +11 -11
- package/Editor/PresentGoogleSheetsImportOption.cs +54 -54
- package/Editor/PresentGoogleSheetsImportOption.cs.meta +1 -1
- package/Editor/PresentImportOptionBase.cs +131 -131
- package/Editor/PresentImportOptionBase.cs.meta +1 -1
- package/Editor/PresentReactionLevelOption.cs +80 -80
- package/Editor/PresentReactionLevelOption.cs.meta +1 -1
- package/Editor/PresentUtility.cs +41 -41
- package/Editor/PresentUtility.cs.meta +11 -11
- package/Editor/ReactionByIDCharactersOption.cs +135 -135
- package/Editor/ReactionByIDCharactersOption.cs.meta +1 -1
- package/Editor/ReactionByIDOption.cs +53 -53
- package/Editor/ReactionByIDOption.cs.meta +1 -1
- package/Editor/ReactionImportOption.cs +73 -73
- package/Editor/ReactionImportOption.cs.meta +1 -1
- package/Editor/ReactionImporter.cs +58 -58
- package/Editor/ReactionImporter.cs.meta +11 -11
- package/Editor/RenamePresentsByIDOption.cs +95 -95
- package/Editor/RenamePresentsByIDOption.cs.meta +1 -1
- package/Editor/StudentReactionCollectionEditor.cs +103 -103
- package/Editor/StudentReactionCollectionEditor.cs.meta +1 -1
- package/Editor/StudentReactionEditor.cs +82 -82
- package/Editor/StudentReactionEditor.cs.meta +1 -1
- package/Editor.meta +8 -8
- package/IAmountablePresent.cs +28 -28
- package/IAmountablePresent.cs.meta +1 -1
- package/INewPresentObtained.cs +21 -21
- package/INewPresentObtained.cs.meta +1 -1
- package/IPresentData.cs +9 -9
- package/IPresentData.cs.meta +1 -1
- package/IPresentManager.cs +37 -37
- package/IPresentManager.cs.meta +1 -1
- package/IReactionEntry.cs +20 -20
- package/IReactionEntry.cs.meta +1 -1
- package/Present.cs +23 -23
- package/Present.cs.meta +11 -11
- package/PresentData.cs +49 -49
- package/PresentData.cs.meta +11 -11
- package/PresentDatabase.cs +27 -27
- package/PresentDatabase.cs.meta +11 -11
- package/PresentManager.cs +70 -70
- package/PresentManager.cs.meta +11 -11
- package/PresentManagerBase.cs +34 -34
- package/PresentManagerBase.cs.meta +1 -1
- package/PresentReactionLevel.cs +12 -12
- package/PresentReactionLevel.cs.meta +11 -11
- package/PresentSaveBase.cs +25 -25
- package/PresentSaveBase.cs.meta +1 -1
- package/ReactionLevelDatabase.cs +34 -34
- package/ReactionLevelDatabase.cs.meta +11 -11
- package/{Samples → Samples~}/Present_Manager.prefab +54 -54
- package/{Samples → Samples~}/Present_Manager.prefab.meta +7 -7
- package/StudentReaction.cs +27 -27
- package/StudentReaction.cs.meta +1 -1
- package/StudentReactionCollection.cs +44 -44
- package/StudentReactionCollection.cs.meta +1 -1
- package/package.json +39 -34
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
// Original Author: KHeartz
|
|
2
|
-
// Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
3
|
-
#if UNITY_EDITOR
|
|
4
|
-
using DREditor.Editor.Utility;
|
|
5
|
-
using System;
|
|
6
|
-
using System.Text.RegularExpressions;
|
|
7
|
-
using UnityEditor;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.Presents.Editor
|
|
11
|
-
{
|
|
12
|
-
[CustomEditor(typeof(PresentDatabase))]
|
|
13
|
-
public class PresentDatabaseEditor : UnityEditor.Editor
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
protected PresentDatabase database;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
protected virtual void OnEnable() => database = target as PresentDatabase;
|
|
22
|
-
|
|
23
|
-
/// <inheritdoc/>
|
|
24
|
-
public override void OnInspectorGUI()
|
|
25
|
-
{
|
|
26
|
-
CreateForm();
|
|
27
|
-
|
|
28
|
-
EditorUtility.SetDirty(database);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// <summary>
|
|
32
|
-
///
|
|
33
|
-
/// </summary>
|
|
34
|
-
protected virtual void CreateForm()
|
|
35
|
-
{
|
|
36
|
-
DisplayHeader();
|
|
37
|
-
|
|
38
|
-
RestorePresentIDsFromImageButton();
|
|
39
|
-
|
|
40
|
-
if (ImportPresents())
|
|
41
|
-
return;
|
|
42
|
-
|
|
43
|
-
ClearPresentsButton();
|
|
44
|
-
|
|
45
|
-
if (AddNewPresent())
|
|
46
|
-
return;
|
|
47
|
-
|
|
48
|
-
DisplayPresentPreviews();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/// <summary>
|
|
52
|
-
///
|
|
53
|
-
/// </summary>
|
|
54
|
-
protected virtual void DisplayHeader()
|
|
55
|
-
{
|
|
56
|
-
HandyFields.Label("Present Database");
|
|
57
|
-
|
|
58
|
-
if (database != null && database.presents != null)
|
|
59
|
-
HandyFields.Label("Present Count: " + database.presents.Count);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/// <summary>
|
|
63
|
-
///
|
|
64
|
-
/// </summary>
|
|
65
|
-
/// <returns></returns>
|
|
66
|
-
protected virtual bool ImportPresents()
|
|
67
|
-
{
|
|
68
|
-
bool result = HandyFields.Button("Import Presents", "Adds all currently selected Present assets in the project to the database.");
|
|
69
|
-
|
|
70
|
-
if (result)
|
|
71
|
-
foreach (var present in Selection.objects)
|
|
72
|
-
database.presents.Add((Present)present);
|
|
73
|
-
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/// <summary>
|
|
78
|
-
///
|
|
79
|
-
/// </summary>
|
|
80
|
-
protected virtual void ClearPresentsButton()
|
|
81
|
-
{
|
|
82
|
-
if (HandyFields.Button("Clear Presents") &&
|
|
83
|
-
EditorUtility.DisplayDialog("Clear Presents", "Are you sure you want to clear presents?", "Yes", "No"))
|
|
84
|
-
database.presents.Clear();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/// <summary>
|
|
88
|
-
///
|
|
89
|
-
/// </summary>
|
|
90
|
-
/// <returns></returns>
|
|
91
|
-
protected virtual bool AddNewPresent()
|
|
92
|
-
{
|
|
93
|
-
if (HandyFields.Button("Add New Present"))
|
|
94
|
-
database.presents.Add(CreateInstance<Present>());
|
|
95
|
-
|
|
96
|
-
return database.presents == null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/// <summary>
|
|
100
|
-
///
|
|
101
|
-
/// </summary>
|
|
102
|
-
protected virtual void DisplayPresentPreviews()
|
|
103
|
-
{
|
|
104
|
-
if (database != null && database.presents != null)
|
|
105
|
-
for (int i = 0; i < database.presents.Count; i++)
|
|
106
|
-
using (new GUILayout.HorizontalScope("Box"))
|
|
107
|
-
DisplayPresentPreview(i);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/// <summary>
|
|
111
|
-
///
|
|
112
|
-
/// </summary>
|
|
113
|
-
/// <param name="i"></param>
|
|
114
|
-
protected virtual void DisplayPresentPreview(int i)
|
|
115
|
-
{
|
|
116
|
-
ShowPresentImage(database.presents[i]);
|
|
117
|
-
|
|
118
|
-
SelectPresent(database.presents[i], i);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/// <summary>
|
|
122
|
-
///
|
|
123
|
-
/// </summary>
|
|
124
|
-
/// <param name="present"></param>
|
|
125
|
-
protected virtual void ShowPresentImage(Present present)
|
|
126
|
-
{
|
|
127
|
-
using (new EditorGUILayout.VerticalScope())
|
|
128
|
-
GUILayout.Label(AssetPreview.GetAssetPreview(present.Image));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/// <summary>
|
|
132
|
-
///
|
|
133
|
-
/// </summary>
|
|
134
|
-
/// <param name="present"></param>
|
|
135
|
-
/// <param name="index"></param>
|
|
136
|
-
protected virtual void SelectPresent(Present present, int index)
|
|
137
|
-
{
|
|
138
|
-
GUILayout.FlexibleSpace();
|
|
139
|
-
|
|
140
|
-
database.presents[index] = HandyFields.UnityField(present, 200, 40);
|
|
141
|
-
|
|
142
|
-
RemovePresentButton(index);
|
|
143
|
-
|
|
144
|
-
GUILayout.FlexibleSpace();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/// <summary>
|
|
148
|
-
///
|
|
149
|
-
/// </summary>
|
|
150
|
-
/// <param name="index"></param>
|
|
151
|
-
protected virtual void RemovePresentButton(int index)
|
|
152
|
-
{
|
|
153
|
-
if (HandyFields.Button("X"))
|
|
154
|
-
database.presents.RemoveAt(index);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/// <summary>
|
|
158
|
-
///
|
|
159
|
-
/// </summary>
|
|
160
|
-
protected virtual void RestorePresentIDsFromImageButton()
|
|
161
|
-
{
|
|
162
|
-
if (HandyFields.Button("Restore Present IDs from their image"))
|
|
163
|
-
RestorePresentIDsFromImage();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/// <summary>
|
|
167
|
-
///
|
|
168
|
-
/// </summary>
|
|
169
|
-
protected virtual void RestorePresentIDsFromImage()
|
|
170
|
-
{
|
|
171
|
-
foreach (Present present in database.presents)
|
|
172
|
-
{
|
|
173
|
-
if (present.Image != null)
|
|
174
|
-
{
|
|
175
|
-
present.ID = Int32.Parse(Regex.Match(present.Image.name, @"\d+").Value);
|
|
176
|
-
|
|
177
|
-
EditorUtility.SetDirty(present);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
1
|
+
// Original Author: KHeartz
|
|
2
|
+
// Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using DREditor.Editor.Utility;
|
|
5
|
+
using System;
|
|
6
|
+
using System.Text.RegularExpressions;
|
|
7
|
+
using UnityEditor;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.Presents.Editor
|
|
11
|
+
{
|
|
12
|
+
[CustomEditor(typeof(PresentDatabase))]
|
|
13
|
+
public class PresentDatabaseEditor : UnityEditor.Editor
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
protected PresentDatabase database;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
protected virtual void OnEnable() => database = target as PresentDatabase;
|
|
22
|
+
|
|
23
|
+
/// <inheritdoc/>
|
|
24
|
+
public override void OnInspectorGUI()
|
|
25
|
+
{
|
|
26
|
+
CreateForm();
|
|
27
|
+
|
|
28
|
+
EditorUtility.SetDirty(database);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
protected virtual void CreateForm()
|
|
35
|
+
{
|
|
36
|
+
DisplayHeader();
|
|
37
|
+
|
|
38
|
+
RestorePresentIDsFromImageButton();
|
|
39
|
+
|
|
40
|
+
if (ImportPresents())
|
|
41
|
+
return;
|
|
42
|
+
|
|
43
|
+
ClearPresentsButton();
|
|
44
|
+
|
|
45
|
+
if (AddNewPresent())
|
|
46
|
+
return;
|
|
47
|
+
|
|
48
|
+
DisplayPresentPreviews();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
///
|
|
53
|
+
/// </summary>
|
|
54
|
+
protected virtual void DisplayHeader()
|
|
55
|
+
{
|
|
56
|
+
HandyFields.Label("Present Database");
|
|
57
|
+
|
|
58
|
+
if (database != null && database.presents != null)
|
|
59
|
+
HandyFields.Label("Present Count: " + database.presents.Count);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
/// <returns></returns>
|
|
66
|
+
protected virtual bool ImportPresents()
|
|
67
|
+
{
|
|
68
|
+
bool result = HandyFields.Button("Import Presents", "Adds all currently selected Present assets in the project to the database.");
|
|
69
|
+
|
|
70
|
+
if (result)
|
|
71
|
+
foreach (var present in Selection.objects)
|
|
72
|
+
database.presents.Add((Present)present);
|
|
73
|
+
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
///
|
|
79
|
+
/// </summary>
|
|
80
|
+
protected virtual void ClearPresentsButton()
|
|
81
|
+
{
|
|
82
|
+
if (HandyFields.Button("Clear Presents") &&
|
|
83
|
+
EditorUtility.DisplayDialog("Clear Presents", "Are you sure you want to clear presents?", "Yes", "No"))
|
|
84
|
+
database.presents.Clear();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// <summary>
|
|
88
|
+
///
|
|
89
|
+
/// </summary>
|
|
90
|
+
/// <returns></returns>
|
|
91
|
+
protected virtual bool AddNewPresent()
|
|
92
|
+
{
|
|
93
|
+
if (HandyFields.Button("Add New Present"))
|
|
94
|
+
database.presents.Add(CreateInstance<Present>());
|
|
95
|
+
|
|
96
|
+
return database.presents == null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// <summary>
|
|
100
|
+
///
|
|
101
|
+
/// </summary>
|
|
102
|
+
protected virtual void DisplayPresentPreviews()
|
|
103
|
+
{
|
|
104
|
+
if (database != null && database.presents != null)
|
|
105
|
+
for (int i = 0; i < database.presents.Count; i++)
|
|
106
|
+
using (new GUILayout.HorizontalScope("Box"))
|
|
107
|
+
DisplayPresentPreview(i);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// <summary>
|
|
111
|
+
///
|
|
112
|
+
/// </summary>
|
|
113
|
+
/// <param name="i"></param>
|
|
114
|
+
protected virtual void DisplayPresentPreview(int i)
|
|
115
|
+
{
|
|
116
|
+
ShowPresentImage(database.presents[i]);
|
|
117
|
+
|
|
118
|
+
SelectPresent(database.presents[i], i);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// <summary>
|
|
122
|
+
///
|
|
123
|
+
/// </summary>
|
|
124
|
+
/// <param name="present"></param>
|
|
125
|
+
protected virtual void ShowPresentImage(Present present)
|
|
126
|
+
{
|
|
127
|
+
using (new EditorGUILayout.VerticalScope())
|
|
128
|
+
GUILayout.Label(AssetPreview.GetAssetPreview(present.Image));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/// <summary>
|
|
132
|
+
///
|
|
133
|
+
/// </summary>
|
|
134
|
+
/// <param name="present"></param>
|
|
135
|
+
/// <param name="index"></param>
|
|
136
|
+
protected virtual void SelectPresent(Present present, int index)
|
|
137
|
+
{
|
|
138
|
+
GUILayout.FlexibleSpace();
|
|
139
|
+
|
|
140
|
+
database.presents[index] = HandyFields.UnityField(present, 200, 40);
|
|
141
|
+
|
|
142
|
+
RemovePresentButton(index);
|
|
143
|
+
|
|
144
|
+
GUILayout.FlexibleSpace();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/// <summary>
|
|
148
|
+
///
|
|
149
|
+
/// </summary>
|
|
150
|
+
/// <param name="index"></param>
|
|
151
|
+
protected virtual void RemovePresentButton(int index)
|
|
152
|
+
{
|
|
153
|
+
if (HandyFields.Button("X"))
|
|
154
|
+
database.presents.RemoveAt(index);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/// <summary>
|
|
158
|
+
///
|
|
159
|
+
/// </summary>
|
|
160
|
+
protected virtual void RestorePresentIDsFromImageButton()
|
|
161
|
+
{
|
|
162
|
+
if (HandyFields.Button("Restore Present IDs from their image"))
|
|
163
|
+
RestorePresentIDsFromImage();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/// <summary>
|
|
167
|
+
///
|
|
168
|
+
/// </summary>
|
|
169
|
+
protected virtual void RestorePresentIDsFromImage()
|
|
170
|
+
{
|
|
171
|
+
foreach (Present present in database.presents)
|
|
172
|
+
{
|
|
173
|
+
if (present.Image != null)
|
|
174
|
+
{
|
|
175
|
+
present.ID = Int32.Parse(Regex.Match(present.Image.name, @"\d+").Value);
|
|
176
|
+
|
|
177
|
+
EditorUtility.SetDirty(present);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
184
|
#endif
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: a6caf8f58a1e0aa48a691c544f0fab0f
|
|
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: a6caf8f58a1e0aa48a691c544f0fab0f
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|