net.dreditor.presents 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/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
package/.attestation.p7m
ADDED
|
Binary file
|
package/DREditor.Presents.asmdef
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "DREditor.Presents",
|
|
3
|
-
"rootNamespace": "",
|
|
4
|
-
"references": [
|
|
5
|
-
"DREditor"
|
|
6
|
-
],
|
|
7
|
-
"includePlatforms": [],
|
|
8
|
-
"excludePlatforms": [],
|
|
9
|
-
"allowUnsafeCode": false,
|
|
10
|
-
"overrideReferences": false,
|
|
11
|
-
"precompiledReferences": [],
|
|
12
|
-
"autoReferenced": true,
|
|
13
|
-
"defineConstraints": [],
|
|
14
|
-
"versionDefines": [],
|
|
15
|
-
"noEngineReferences": false
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.Presents",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"DREditor"
|
|
6
|
+
],
|
|
7
|
+
"includePlatforms": [],
|
|
8
|
+
"excludePlatforms": [],
|
|
9
|
+
"allowUnsafeCode": false,
|
|
10
|
+
"overrideReferences": false,
|
|
11
|
+
"precompiledReferences": [],
|
|
12
|
+
"autoReferenced": true,
|
|
13
|
+
"defineConstraints": [],
|
|
14
|
+
"versionDefines": [],
|
|
15
|
+
"noEngineReferences": false
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 79855995bd1fdca4bba543d1fbf339c8
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 79855995bd1fdca4bba543d1fbf339c8
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For DREditor
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using DREditor.Characters;
|
|
4
|
-
using DREditor.Editor.Utility;
|
|
5
|
-
using System;
|
|
6
|
-
using System.Collections.Generic;
|
|
7
|
-
using System.Linq;
|
|
8
|
-
using System.Text.RegularExpressions;
|
|
9
|
-
using UnityEditor;
|
|
10
|
-
using UnityEngine;
|
|
11
|
-
|
|
12
|
-
namespace DREditor.Presents.Editor
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
public class CreatePresentsWizard : ScriptableWizard
|
|
18
|
-
{
|
|
19
|
-
/// <summary>
|
|
20
|
-
///
|
|
21
|
-
/// </summary>
|
|
22
|
-
[Header("")]
|
|
23
|
-
[Divider]
|
|
24
|
-
[Tooltip("")]
|
|
25
|
-
[SerializeField] protected int startID = 0;
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
[Tooltip("")]
|
|
31
|
-
[SerializeField] protected bool spriteHasIDNum = false;
|
|
32
|
-
|
|
33
|
-
/// <summary>
|
|
34
|
-
///
|
|
35
|
-
/// </summary>
|
|
36
|
-
[ShowIf(nameof(IDWillBeInSpriteName))]
|
|
37
|
-
[Tooltip("")]
|
|
38
|
-
[SerializeField] protected string matchSpriteID = @"\d+";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
protected CharacterDatabase database;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
[MenuItem("DREditor/FTE/Create Presents")]
|
|
48
|
-
static void CreateWizard() => DisplayWizard<CreatePresentsWizard>("Create Materials", "Create");
|
|
49
|
-
|
|
50
|
-
protected virtual void OnEnable() => database = DatabaseUtility.LoadDatabase<CharacterDatabase>();
|
|
51
|
-
|
|
52
|
-
protected virtual void OnWizardCreate()
|
|
53
|
-
{
|
|
54
|
-
try
|
|
55
|
-
{
|
|
56
|
-
AssetDatabase.StartAssetEditing();
|
|
57
|
-
|
|
58
|
-
CreatePresents();
|
|
59
|
-
}
|
|
60
|
-
finally
|
|
61
|
-
{
|
|
62
|
-
AssetDatabase.StopAssetEditing();
|
|
63
|
-
|
|
64
|
-
AssetDatabase.SaveAssets();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/// <summary>
|
|
69
|
-
///
|
|
70
|
-
/// </summary>
|
|
71
|
-
protected virtual void CreatePresents()
|
|
72
|
-
{
|
|
73
|
-
var textures = Selection.GetFiltered(typeof(Texture2D), SelectionMode.Assets).Cast<Texture2D>();
|
|
74
|
-
|
|
75
|
-
int id = startID;
|
|
76
|
-
|
|
77
|
-
foreach (var texture in textures)
|
|
78
|
-
{
|
|
79
|
-
string path = AssetDatabase.GetAssetPath(texture);
|
|
80
|
-
|
|
81
|
-
Sprite sprite = AssetDatabase.LoadAssetAtPath<Sprite>(path);
|
|
82
|
-
|
|
83
|
-
path = path[..path.LastIndexOf(".")] + ".asset";
|
|
84
|
-
|
|
85
|
-
if (PresentAlreadyExists(path))
|
|
86
|
-
continue;
|
|
87
|
-
|
|
88
|
-
CreatePresent(path, id, sprite);
|
|
89
|
-
|
|
90
|
-
id += 1;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/// <summary>
|
|
95
|
-
///
|
|
96
|
-
/// </summary>
|
|
97
|
-
/// <param name="path"></param>
|
|
98
|
-
/// <returns></returns>
|
|
99
|
-
protected virtual bool PresentAlreadyExists(string path)
|
|
100
|
-
{
|
|
101
|
-
bool result = AssetDatabase.LoadAssetAtPath(path, typeof(Present)) != null;
|
|
102
|
-
|
|
103
|
-
if (result)
|
|
104
|
-
UnityEngine.Debug.LogWarning("ALERT: Can't create present, it already exists: " + path);
|
|
105
|
-
|
|
106
|
-
return result;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/// <summary>
|
|
110
|
-
///
|
|
111
|
-
/// </summary>
|
|
112
|
-
/// <param name="path"></param>
|
|
113
|
-
/// <param name="id"></param>
|
|
114
|
-
/// <param name="image"></param>
|
|
115
|
-
protected virtual void CreatePresent(string path, int id, Sprite image)
|
|
116
|
-
{
|
|
117
|
-
List<Character> characters = database.GetFTECharacterList();
|
|
118
|
-
|
|
119
|
-
var present = CreateInstance<Present>();
|
|
120
|
-
|
|
121
|
-
present.DisplayName = image.name;
|
|
122
|
-
|
|
123
|
-
present.ID = EvaluatePresentID(image, id);
|
|
124
|
-
|
|
125
|
-
present.Image = image;
|
|
126
|
-
|
|
127
|
-
StudentReactionCollection collection = new();
|
|
128
|
-
|
|
129
|
-
foreach (Character character in characters)
|
|
130
|
-
{
|
|
131
|
-
StudentReaction reaction = new()
|
|
132
|
-
{
|
|
133
|
-
Character = character
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
collection.studentReactions.Add(reaction);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
present.attributes.Add(collection);
|
|
140
|
-
|
|
141
|
-
AssetDatabase.CreateAsset(present, path);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/// <summary>
|
|
145
|
-
///
|
|
146
|
-
/// </summary>
|
|
147
|
-
/// <param name="sprite"></param>
|
|
148
|
-
/// <param name="id"></param>
|
|
149
|
-
/// <returns></returns>
|
|
150
|
-
protected virtual int EvaluatePresentID(Sprite sprite, int id)
|
|
151
|
-
=> IDWillBeInSpriteName() ? Int32.Parse(Regex.Match(sprite.name, matchSpriteID).Value) : id;
|
|
152
|
-
|
|
153
|
-
/// <summary>
|
|
154
|
-
///
|
|
155
|
-
/// </summary>
|
|
156
|
-
/// <returns></returns>
|
|
157
|
-
protected virtual bool IDWillBeInSpriteName() => spriteHasIDNum;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For DREditor
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Characters;
|
|
4
|
+
using DREditor.Editor.Utility;
|
|
5
|
+
using System;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using System.Linq;
|
|
8
|
+
using System.Text.RegularExpressions;
|
|
9
|
+
using UnityEditor;
|
|
10
|
+
using UnityEngine;
|
|
11
|
+
|
|
12
|
+
namespace DREditor.Presents.Editor
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
public class CreatePresentsWizard : ScriptableWizard
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Header("")]
|
|
23
|
+
[Divider]
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected int startID = 0;
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Tooltip("")]
|
|
31
|
+
[SerializeField] protected bool spriteHasIDNum = false;
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
///
|
|
35
|
+
/// </summary>
|
|
36
|
+
[ShowIf(nameof(IDWillBeInSpriteName))]
|
|
37
|
+
[Tooltip("")]
|
|
38
|
+
[SerializeField] protected string matchSpriteID = @"\d+";
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
protected CharacterDatabase database;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
[MenuItem("DREditor/FTE/Create Presents")]
|
|
48
|
+
static void CreateWizard() => DisplayWizard<CreatePresentsWizard>("Create Materials", "Create");
|
|
49
|
+
|
|
50
|
+
protected virtual void OnEnable() => database = DatabaseUtility.LoadDatabase<CharacterDatabase>();
|
|
51
|
+
|
|
52
|
+
protected virtual void OnWizardCreate()
|
|
53
|
+
{
|
|
54
|
+
try
|
|
55
|
+
{
|
|
56
|
+
AssetDatabase.StartAssetEditing();
|
|
57
|
+
|
|
58
|
+
CreatePresents();
|
|
59
|
+
}
|
|
60
|
+
finally
|
|
61
|
+
{
|
|
62
|
+
AssetDatabase.StopAssetEditing();
|
|
63
|
+
|
|
64
|
+
AssetDatabase.SaveAssets();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
///
|
|
70
|
+
/// </summary>
|
|
71
|
+
protected virtual void CreatePresents()
|
|
72
|
+
{
|
|
73
|
+
var textures = Selection.GetFiltered(typeof(Texture2D), SelectionMode.Assets).Cast<Texture2D>();
|
|
74
|
+
|
|
75
|
+
int id = startID;
|
|
76
|
+
|
|
77
|
+
foreach (var texture in textures)
|
|
78
|
+
{
|
|
79
|
+
string path = AssetDatabase.GetAssetPath(texture);
|
|
80
|
+
|
|
81
|
+
Sprite sprite = AssetDatabase.LoadAssetAtPath<Sprite>(path);
|
|
82
|
+
|
|
83
|
+
path = path[..path.LastIndexOf(".")] + ".asset";
|
|
84
|
+
|
|
85
|
+
if (PresentAlreadyExists(path))
|
|
86
|
+
continue;
|
|
87
|
+
|
|
88
|
+
CreatePresent(path, id, sprite);
|
|
89
|
+
|
|
90
|
+
id += 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// <summary>
|
|
95
|
+
///
|
|
96
|
+
/// </summary>
|
|
97
|
+
/// <param name="path"></param>
|
|
98
|
+
/// <returns></returns>
|
|
99
|
+
protected virtual bool PresentAlreadyExists(string path)
|
|
100
|
+
{
|
|
101
|
+
bool result = AssetDatabase.LoadAssetAtPath(path, typeof(Present)) != null;
|
|
102
|
+
|
|
103
|
+
if (result)
|
|
104
|
+
UnityEngine.Debug.LogWarning("ALERT: Can't create present, it already exists: " + path);
|
|
105
|
+
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
///
|
|
111
|
+
/// </summary>
|
|
112
|
+
/// <param name="path"></param>
|
|
113
|
+
/// <param name="id"></param>
|
|
114
|
+
/// <param name="image"></param>
|
|
115
|
+
protected virtual void CreatePresent(string path, int id, Sprite image)
|
|
116
|
+
{
|
|
117
|
+
List<Character> characters = database.GetFTECharacterList();
|
|
118
|
+
|
|
119
|
+
var present = CreateInstance<Present>();
|
|
120
|
+
|
|
121
|
+
present.DisplayName = image.name;
|
|
122
|
+
|
|
123
|
+
present.ID = EvaluatePresentID(image, id);
|
|
124
|
+
|
|
125
|
+
present.Image = image;
|
|
126
|
+
|
|
127
|
+
StudentReactionCollection collection = new();
|
|
128
|
+
|
|
129
|
+
foreach (Character character in characters)
|
|
130
|
+
{
|
|
131
|
+
StudentReaction reaction = new()
|
|
132
|
+
{
|
|
133
|
+
Character = character
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
collection.studentReactions.Add(reaction);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
present.attributes.Add(collection);
|
|
140
|
+
|
|
141
|
+
AssetDatabase.CreateAsset(present, path);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// <summary>
|
|
145
|
+
///
|
|
146
|
+
/// </summary>
|
|
147
|
+
/// <param name="sprite"></param>
|
|
148
|
+
/// <param name="id"></param>
|
|
149
|
+
/// <returns></returns>
|
|
150
|
+
protected virtual int EvaluatePresentID(Sprite sprite, int id)
|
|
151
|
+
=> IDWillBeInSpriteName() ? Int32.Parse(Regex.Match(sprite.name, matchSpriteID).Value) : id;
|
|
152
|
+
|
|
153
|
+
/// <summary>
|
|
154
|
+
///
|
|
155
|
+
/// </summary>
|
|
156
|
+
/// <returns></returns>
|
|
157
|
+
protected virtual bool IDWillBeInSpriteName() => spriteHasIDNum;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
160
|
#endif
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 05dd01c6ee6f4a544947dfad4ab6d746
|
|
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: 05dd01c6ee6f4a544947dfad4ab6d746
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "DREditor.Presents.Editor",
|
|
3
|
-
"rootNamespace": "",
|
|
4
|
-
"references": [
|
|
5
|
-
"DREditor",
|
|
6
|
-
"DREditor.Editor",
|
|
7
|
-
"DREditor.Presents"
|
|
8
|
-
],
|
|
9
|
-
"includePlatforms": [],
|
|
10
|
-
"excludePlatforms": [],
|
|
11
|
-
"allowUnsafeCode": false,
|
|
12
|
-
"overrideReferences": false,
|
|
13
|
-
"precompiledReferences": [],
|
|
14
|
-
"autoReferenced": true,
|
|
15
|
-
"defineConstraints": [],
|
|
16
|
-
"versionDefines": [],
|
|
17
|
-
"noEngineReferences": false
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.Presents.Editor",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"DREditor",
|
|
6
|
+
"DREditor.Editor",
|
|
7
|
+
"DREditor.Presents"
|
|
8
|
+
],
|
|
9
|
+
"includePlatforms": [],
|
|
10
|
+
"excludePlatforms": [],
|
|
11
|
+
"allowUnsafeCode": false,
|
|
12
|
+
"overrideReferences": false,
|
|
13
|
+
"precompiledReferences": [],
|
|
14
|
+
"autoReferenced": true,
|
|
15
|
+
"defineConstraints": [],
|
|
16
|
+
"versionDefines": [],
|
|
17
|
+
"noEngineReferences": false
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: fda6968fb6bdccb4f8148dfdacef269b
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: fda6968fb6bdccb4f8148dfdacef269b
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using System.Linq;
|
|
6
|
-
using System.Text.RegularExpressions;
|
|
7
|
-
using UnityEditor;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.Presents.Editor
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
[Serializable]
|
|
16
|
-
public class DescriptionsByIDOption : PresentGoogleSheetsImportOption
|
|
17
|
-
{
|
|
18
|
-
/// <summary>
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
[Header("")]
|
|
22
|
-
[Divider]
|
|
23
|
-
[Header("")]
|
|
24
|
-
[ReadOnly]
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected string googleSheetsRegex = "\\t(.+)";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
protected Dictionary<int, string> entries;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/// <inheritdoc/>
|
|
36
|
-
public override void Invoke()
|
|
37
|
-
{
|
|
38
|
-
List<int> ids = CollectIDs(GetMatches());
|
|
39
|
-
|
|
40
|
-
List<string> words = GetListOfNamesGoogleSheetFormat(googleSheetsRegex);
|
|
41
|
-
|
|
42
|
-
if (HasInvalidPairCount(ids.Count != words.Count))
|
|
43
|
-
return;
|
|
44
|
-
|
|
45
|
-
CreatePairing(ids, words, out entries);
|
|
46
|
-
|
|
47
|
-
AssetDatabase.StartAssetEditing();
|
|
48
|
-
|
|
49
|
-
ImportDescriptions();
|
|
50
|
-
|
|
51
|
-
AssetDatabase.StopAssetEditing();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// <summary>
|
|
55
|
-
///
|
|
56
|
-
/// </summary>
|
|
57
|
-
/// <returns></returns>
|
|
58
|
-
protected virtual string[] GetMatches()
|
|
59
|
-
{
|
|
60
|
-
var matched = Regex.Matches(textArea, "\\d+\\t");
|
|
61
|
-
|
|
62
|
-
return matched.Select(m => m.Value).ToArray();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/// <summary>
|
|
66
|
-
///
|
|
67
|
-
/// </summary>
|
|
68
|
-
/// <param name="condition"></param>
|
|
69
|
-
/// <returns></returns>
|
|
70
|
-
protected virtual bool HasInvalidPairCount(bool condition)
|
|
71
|
-
{
|
|
72
|
-
if (condition)
|
|
73
|
-
{
|
|
74
|
-
EditorUtility.DisplayDialog("Sheet Format Incorrect: Inconsistent " +
|
|
75
|
-
"ID's and Name count", "Please Copy each column on your google sheets with the ID and Name to" +
|
|
76
|
-
" use this functionality!", "OK");
|
|
77
|
-
|
|
78
|
-
Close();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return condition;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/// <summary>
|
|
85
|
-
///
|
|
86
|
-
/// </summary>
|
|
87
|
-
protected virtual void ImportDescriptions()
|
|
88
|
-
{
|
|
89
|
-
foreach (Present present in presentDatabase.presents)
|
|
90
|
-
{
|
|
91
|
-
if (entries.ContainsKey(present.ID))
|
|
92
|
-
{
|
|
93
|
-
if (entries[present.ID] == present.DisplayName)
|
|
94
|
-
continue;
|
|
95
|
-
|
|
96
|
-
present.Description = entries[present.ID];
|
|
97
|
-
|
|
98
|
-
EditorUtility.SetDirty(present);
|
|
99
|
-
}
|
|
100
|
-
else
|
|
101
|
-
UnityEngine.Debug.Log("Couldn't find import data to match with ID: " + present.ID);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Linq;
|
|
6
|
+
using System.Text.RegularExpressions;
|
|
7
|
+
using UnityEditor;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.Presents.Editor
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[Serializable]
|
|
16
|
+
public class DescriptionsByIDOption : PresentGoogleSheetsImportOption
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Header("")]
|
|
22
|
+
[Divider]
|
|
23
|
+
[Header("")]
|
|
24
|
+
[ReadOnly]
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected string googleSheetsRegex = "\\t(.+)";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
protected Dictionary<int, string> entries;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/// <inheritdoc/>
|
|
36
|
+
public override void Invoke()
|
|
37
|
+
{
|
|
38
|
+
List<int> ids = CollectIDs(GetMatches());
|
|
39
|
+
|
|
40
|
+
List<string> words = GetListOfNamesGoogleSheetFormat(googleSheetsRegex);
|
|
41
|
+
|
|
42
|
+
if (HasInvalidPairCount(ids.Count != words.Count))
|
|
43
|
+
return;
|
|
44
|
+
|
|
45
|
+
CreatePairing(ids, words, out entries);
|
|
46
|
+
|
|
47
|
+
AssetDatabase.StartAssetEditing();
|
|
48
|
+
|
|
49
|
+
ImportDescriptions();
|
|
50
|
+
|
|
51
|
+
AssetDatabase.StopAssetEditing();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
/// <returns></returns>
|
|
58
|
+
protected virtual string[] GetMatches()
|
|
59
|
+
{
|
|
60
|
+
var matched = Regex.Matches(textArea, "\\d+\\t");
|
|
61
|
+
|
|
62
|
+
return matched.Select(m => m.Value).ToArray();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
///
|
|
67
|
+
/// </summary>
|
|
68
|
+
/// <param name="condition"></param>
|
|
69
|
+
/// <returns></returns>
|
|
70
|
+
protected virtual bool HasInvalidPairCount(bool condition)
|
|
71
|
+
{
|
|
72
|
+
if (condition)
|
|
73
|
+
{
|
|
74
|
+
EditorUtility.DisplayDialog("Sheet Format Incorrect: Inconsistent " +
|
|
75
|
+
"ID's and Name count", "Please Copy each column on your google sheets with the ID and Name to" +
|
|
76
|
+
" use this functionality!", "OK");
|
|
77
|
+
|
|
78
|
+
Close();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return condition;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// <summary>
|
|
85
|
+
///
|
|
86
|
+
/// </summary>
|
|
87
|
+
protected virtual void ImportDescriptions()
|
|
88
|
+
{
|
|
89
|
+
foreach (Present present in presentDatabase.presents)
|
|
90
|
+
{
|
|
91
|
+
if (entries.ContainsKey(present.ID))
|
|
92
|
+
{
|
|
93
|
+
if (entries[present.ID] == present.DisplayName)
|
|
94
|
+
continue;
|
|
95
|
+
|
|
96
|
+
present.Description = entries[present.ID];
|
|
97
|
+
|
|
98
|
+
EditorUtility.SetDirty(present);
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
UnityEngine.Debug.Log("Couldn't find import data to match with ID: " + present.ID);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
106
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: 06676343256b36645a519d34ca66b74f
|