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
|
@@ -1,136 +1,136 @@
|
|
|
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.IO;
|
|
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 ReactionByIDCharactersOption : ReactionImportOption
|
|
17
|
-
{
|
|
18
|
-
/// <summary>
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
[Header("")]
|
|
22
|
-
[Divider]
|
|
23
|
-
[Header("")]
|
|
24
|
-
[ReadOnly]
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected string splitLineRegex = @"(?:^|[,\\s\\t]+)([A-Za-z]+(?:\\s+[A-Za-z]+)*)";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
protected List<int> idMatches;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/// <inheritdoc/>
|
|
36
|
-
public override void Invoke()
|
|
37
|
-
{
|
|
38
|
-
try
|
|
39
|
-
{
|
|
40
|
-
AssetDatabase.StartAssetEditing();
|
|
41
|
-
|
|
42
|
-
SetAllOfReactionType();
|
|
43
|
-
}
|
|
44
|
-
catch (Exception exception)
|
|
45
|
-
{
|
|
46
|
-
UnityEngine.Debug.LogError("ALERT: Failed to apply process so it was aborted. \nReason: " + exception.ToString());
|
|
47
|
-
}
|
|
48
|
-
finally
|
|
49
|
-
{
|
|
50
|
-
AssetDatabase.StopAssetEditing();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// <summary>
|
|
55
|
-
///
|
|
56
|
-
/// </summary>
|
|
57
|
-
protected virtual void SetAllOfReactionType()
|
|
58
|
-
{
|
|
59
|
-
using var stringReader = new StringReader(textArea);
|
|
60
|
-
|
|
61
|
-
string line;
|
|
62
|
-
|
|
63
|
-
while ((line = stringReader.ReadLine()) != null)
|
|
64
|
-
if (MatchedIDs(line))
|
|
65
|
-
ApplyMatchedNames(Regex.Split(line, splitLineRegex));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/// <summary>
|
|
69
|
-
///
|
|
70
|
-
/// </summary>
|
|
71
|
-
/// <param name="line"></param>
|
|
72
|
-
/// <returns></returns>
|
|
73
|
-
protected virtual bool MatchedIDs(string line)
|
|
74
|
-
{
|
|
75
|
-
idMatches = CollectIDs(Regex.Split(line, anyNumberRegex));
|
|
76
|
-
|
|
77
|
-
return idMatches != null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/// <summary>
|
|
81
|
-
///
|
|
82
|
-
/// </summary>
|
|
83
|
-
/// <param name="nameMatches"></param>
|
|
84
|
-
protected virtual void ApplyMatchedNames(string[] nameMatches)
|
|
85
|
-
{
|
|
86
|
-
for (int i = 0; i < nameMatches.Length; i++)
|
|
87
|
-
if (i == 0 || TotalFailedMatch(nameMatches[i]))
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/// <summary>
|
|
92
|
-
///
|
|
93
|
-
/// </summary>
|
|
94
|
-
/// <param name="tryMatch"></param>
|
|
95
|
-
/// <returns></returns>
|
|
96
|
-
protected virtual bool TotalFailedMatch(string tryMatch)
|
|
97
|
-
{
|
|
98
|
-
var nameMatch = tryMatch.Replace(",", "");
|
|
99
|
-
|
|
100
|
-
if (FailedMatch(nameMatch))
|
|
101
|
-
return true;
|
|
102
|
-
else
|
|
103
|
-
PassedMatch(nameMatch);
|
|
104
|
-
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/// <summary>
|
|
109
|
-
///
|
|
110
|
-
/// </summary>
|
|
111
|
-
/// <param name="nameMatch"></param>
|
|
112
|
-
/// <returns></returns>
|
|
113
|
-
protected virtual bool FailedMatch(string nameMatch)
|
|
114
|
-
{
|
|
115
|
-
if (nameMatch == "")
|
|
116
|
-
return true;
|
|
117
|
-
else
|
|
118
|
-
UnityEngine.Debug.Log("REPORT: Name Matched: " + nameMatch);
|
|
119
|
-
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/// <summary>
|
|
124
|
-
///
|
|
125
|
-
/// </summary>
|
|
126
|
-
/// <param name="nameMatch"></param>
|
|
127
|
-
protected virtual void PassedMatch(string nameMatch)
|
|
128
|
-
{
|
|
129
|
-
if (presentDatabase.GetPresentByID(idMatches[0]) is Present present)
|
|
130
|
-
ApplyReactions(present, nameMatch);
|
|
131
|
-
else
|
|
132
|
-
UnityEngine.Debug.LogWarning("ALERT: Couldn't Find Present With ID: " + idMatches[0]);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
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.IO;
|
|
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 ReactionByIDCharactersOption : ReactionImportOption
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Header("")]
|
|
22
|
+
[Divider]
|
|
23
|
+
[Header("")]
|
|
24
|
+
[ReadOnly]
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected string splitLineRegex = @"(?:^|[,\\s\\t]+)([A-Za-z]+(?:\\s+[A-Za-z]+)*)";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
protected List<int> idMatches;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/// <inheritdoc/>
|
|
36
|
+
public override void Invoke()
|
|
37
|
+
{
|
|
38
|
+
try
|
|
39
|
+
{
|
|
40
|
+
AssetDatabase.StartAssetEditing();
|
|
41
|
+
|
|
42
|
+
SetAllOfReactionType();
|
|
43
|
+
}
|
|
44
|
+
catch (Exception exception)
|
|
45
|
+
{
|
|
46
|
+
UnityEngine.Debug.LogError("ALERT: Failed to apply process so it was aborted. \nReason: " + exception.ToString());
|
|
47
|
+
}
|
|
48
|
+
finally
|
|
49
|
+
{
|
|
50
|
+
AssetDatabase.StopAssetEditing();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
protected virtual void SetAllOfReactionType()
|
|
58
|
+
{
|
|
59
|
+
using var stringReader = new StringReader(textArea);
|
|
60
|
+
|
|
61
|
+
string line;
|
|
62
|
+
|
|
63
|
+
while ((line = stringReader.ReadLine()) != null)
|
|
64
|
+
if (MatchedIDs(line))
|
|
65
|
+
ApplyMatchedNames(Regex.Split(line, splitLineRegex));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
///
|
|
70
|
+
/// </summary>
|
|
71
|
+
/// <param name="line"></param>
|
|
72
|
+
/// <returns></returns>
|
|
73
|
+
protected virtual bool MatchedIDs(string line)
|
|
74
|
+
{
|
|
75
|
+
idMatches = CollectIDs(Regex.Split(line, anyNumberRegex));
|
|
76
|
+
|
|
77
|
+
return idMatches != null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// <summary>
|
|
81
|
+
///
|
|
82
|
+
/// </summary>
|
|
83
|
+
/// <param name="nameMatches"></param>
|
|
84
|
+
protected virtual void ApplyMatchedNames(string[] nameMatches)
|
|
85
|
+
{
|
|
86
|
+
for (int i = 0; i < nameMatches.Length; i++)
|
|
87
|
+
if (i == 0 || TotalFailedMatch(nameMatches[i]))
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/// <summary>
|
|
92
|
+
///
|
|
93
|
+
/// </summary>
|
|
94
|
+
/// <param name="tryMatch"></param>
|
|
95
|
+
/// <returns></returns>
|
|
96
|
+
protected virtual bool TotalFailedMatch(string tryMatch)
|
|
97
|
+
{
|
|
98
|
+
var nameMatch = tryMatch.Replace(",", "");
|
|
99
|
+
|
|
100
|
+
if (FailedMatch(nameMatch))
|
|
101
|
+
return true;
|
|
102
|
+
else
|
|
103
|
+
PassedMatch(nameMatch);
|
|
104
|
+
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/// <summary>
|
|
109
|
+
///
|
|
110
|
+
/// </summary>
|
|
111
|
+
/// <param name="nameMatch"></param>
|
|
112
|
+
/// <returns></returns>
|
|
113
|
+
protected virtual bool FailedMatch(string nameMatch)
|
|
114
|
+
{
|
|
115
|
+
if (nameMatch == "")
|
|
116
|
+
return true;
|
|
117
|
+
else
|
|
118
|
+
UnityEngine.Debug.Log("REPORT: Name Matched: " + nameMatch);
|
|
119
|
+
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
///
|
|
125
|
+
/// </summary>
|
|
126
|
+
/// <param name="nameMatch"></param>
|
|
127
|
+
protected virtual void PassedMatch(string nameMatch)
|
|
128
|
+
{
|
|
129
|
+
if (presentDatabase.GetPresentByID(idMatches[0]) is Present present)
|
|
130
|
+
ApplyReactions(present, nameMatch);
|
|
131
|
+
else
|
|
132
|
+
UnityEngine.Debug.LogWarning("ALERT: Couldn't Find Present With ID: " + idMatches[0]);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
136
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: 8d3e0f2b31e27a6489110fb6f7ff2ce6
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using DREditor.Characters;
|
|
4
|
-
using System;
|
|
5
|
-
using System.Collections.Generic;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Presents.Editor
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[Serializable]
|
|
14
|
-
public class ReactionByIDOption : ReactionImportOption
|
|
15
|
-
{
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
[Header("")]
|
|
20
|
-
[Divider]
|
|
21
|
-
[Tooltip("")]
|
|
22
|
-
[SerializeField] protected Character character;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/// <inheritdoc/>
|
|
26
|
-
public override void Invoke() => SetReactionByID();
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
protected virtual void SetReactionByID()
|
|
32
|
-
{
|
|
33
|
-
List<int> ids = GetListOfIDs();
|
|
34
|
-
|
|
35
|
-
foreach (int id in ids)
|
|
36
|
-
SetReaction(id);
|
|
37
|
-
|
|
38
|
-
Close();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
/// <param name="id"></param>
|
|
45
|
-
protected virtual void SetReaction(int id)
|
|
46
|
-
{
|
|
47
|
-
if (presentDatabase.GetPresentByID(id) is Present present)
|
|
48
|
-
ApplyReactions(present, character.FirstName);
|
|
49
|
-
else
|
|
50
|
-
UnityEngine.Debug.LogWarning("ALERT: Couldn't Find Present With ID: " + id);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Characters;
|
|
4
|
+
using System;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Presents.Editor
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[Serializable]
|
|
14
|
+
public class ReactionByIDOption : ReactionImportOption
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Header("")]
|
|
20
|
+
[Divider]
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected Character character;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/// <inheritdoc/>
|
|
26
|
+
public override void Invoke() => SetReactionByID();
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
protected virtual void SetReactionByID()
|
|
32
|
+
{
|
|
33
|
+
List<int> ids = GetListOfIDs();
|
|
34
|
+
|
|
35
|
+
foreach (int id in ids)
|
|
36
|
+
SetReaction(id);
|
|
37
|
+
|
|
38
|
+
Close();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
/// <param name="id"></param>
|
|
45
|
+
protected virtual void SetReaction(int id)
|
|
46
|
+
{
|
|
47
|
+
if (presentDatabase.GetPresentByID(id) is Present present)
|
|
48
|
+
ApplyReactions(present, character.FirstName);
|
|
49
|
+
else
|
|
50
|
+
UnityEngine.Debug.LogWarning("ALERT: Couldn't Find Present With ID: " + id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: 231e0fed1384c604dadd3defeed4741b
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using DREditor.Items;
|
|
4
|
-
using DREditor.Editor.Utility;
|
|
5
|
-
using System;
|
|
6
|
-
using UnityEditor;
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
|
|
9
|
-
namespace DREditor.Presents.Editor
|
|
10
|
-
{
|
|
11
|
-
/// <summary>
|
|
12
|
-
///
|
|
13
|
-
/// </summary>
|
|
14
|
-
[Serializable]
|
|
15
|
-
public abstract class ReactionImportOption : PresentImportOptionBase
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected ReactionLevelDatabase reactionDatabase;
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected int reactionLevel;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/// <inheritdoc/>
|
|
31
|
-
protected override void InitializeDatabases()
|
|
32
|
-
{
|
|
33
|
-
base.InitializeDatabases();
|
|
34
|
-
|
|
35
|
-
reactionDatabase = DatabaseUtility.LoadDatabase<ReactionLevelDatabase>();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/// <inheritdoc/>
|
|
39
|
-
protected override bool InitializationFailed() => base.InitializationFailed() || ReactionIndexInvalid();
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
/// <returns></returns>
|
|
45
|
-
protected virtual bool ReactionIndexInvalid()
|
|
46
|
-
{
|
|
47
|
-
bool result = reactionDatabase != null && !reactionDatabase.ReactionIndexValid(reactionLevel);
|
|
48
|
-
|
|
49
|
-
if (result)
|
|
50
|
-
UnityEngine.Debug.LogWarning("ALERT: Database missing or the reaction index inputted was not " +
|
|
51
|
-
"a valid one within the reaction database." +
|
|
52
|
-
"\nPROPOSAL: Ensure the index of the reaction you're using is valid.");
|
|
53
|
-
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/// <summary>
|
|
59
|
-
///
|
|
60
|
-
/// </summary>
|
|
61
|
-
/// <param name="InventoryItem"></param>
|
|
62
|
-
/// <param name="matchingName"></param>
|
|
63
|
-
protected virtual void ApplyReactions(InventoryItem InventoryItem, string matchingName)
|
|
64
|
-
{
|
|
65
|
-
if (InventoryItem is Present present)
|
|
66
|
-
foreach (var data in present.attributes)
|
|
67
|
-
if (data is StudentReactionCollection collection)
|
|
68
|
-
collection.SetReaction(matchingName, reactionLevel);
|
|
69
|
-
|
|
70
|
-
EditorUtility.SetDirty(InventoryItem);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Items;
|
|
4
|
+
using DREditor.Editor.Utility;
|
|
5
|
+
using System;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.Presents.Editor
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
[Serializable]
|
|
15
|
+
public abstract class ReactionImportOption : PresentImportOptionBase
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected ReactionLevelDatabase reactionDatabase;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected int reactionLevel;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/// <inheritdoc/>
|
|
31
|
+
protected override void InitializeDatabases()
|
|
32
|
+
{
|
|
33
|
+
base.InitializeDatabases();
|
|
34
|
+
|
|
35
|
+
reactionDatabase = DatabaseUtility.LoadDatabase<ReactionLevelDatabase>();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// <inheritdoc/>
|
|
39
|
+
protected override bool InitializationFailed() => base.InitializationFailed() || ReactionIndexInvalid();
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
/// <returns></returns>
|
|
45
|
+
protected virtual bool ReactionIndexInvalid()
|
|
46
|
+
{
|
|
47
|
+
bool result = reactionDatabase != null && !reactionDatabase.ReactionIndexValid(reactionLevel);
|
|
48
|
+
|
|
49
|
+
if (result)
|
|
50
|
+
UnityEngine.Debug.LogWarning("ALERT: Database missing or the reaction index inputted was not " +
|
|
51
|
+
"a valid one within the reaction database." +
|
|
52
|
+
"\nPROPOSAL: Ensure the index of the reaction you're using is valid.");
|
|
53
|
+
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
///
|
|
60
|
+
/// </summary>
|
|
61
|
+
/// <param name="InventoryItem"></param>
|
|
62
|
+
/// <param name="matchingName"></param>
|
|
63
|
+
protected virtual void ApplyReactions(InventoryItem InventoryItem, string matchingName)
|
|
64
|
+
{
|
|
65
|
+
if (InventoryItem is Present present)
|
|
66
|
+
foreach (var data in present.attributes)
|
|
67
|
+
if (data is StudentReactionCollection collection)
|
|
68
|
+
collection.SetReaction(matchingName, reactionLevel);
|
|
69
|
+
|
|
70
|
+
EditorUtility.SetDirty(InventoryItem);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
74
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: 9499d1fdd09becd449a1a7974819f8b7
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using UnityEditor;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.Presents.Editor
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
public class ReactionImporter : ScriptableWizard
|
|
12
|
-
{
|
|
13
|
-
/// <summary>
|
|
14
|
-
///
|
|
15
|
-
/// </summary>
|
|
16
|
-
[SelectType]
|
|
17
|
-
[SerializeReference]
|
|
18
|
-
[Tooltip("")]
|
|
19
|
-
[SerializeField] protected PresentImportOptionBase importOption;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
protected bool exitEarly = false;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[MenuItem("DREditor/Import/FTE/Present Reactions")]
|
|
29
|
-
public static void SpawnWizard() => DisplayWizard<ReactionImporter>("Reaction Importer", "Apply");
|
|
30
|
-
|
|
31
|
-
protected virtual void OnWizardCreate()
|
|
32
|
-
{
|
|
33
|
-
importOption.Initialize(CloseWindowEarly);
|
|
34
|
-
|
|
35
|
-
if (exitEarly)
|
|
36
|
-
return;
|
|
37
|
-
|
|
38
|
-
importOption.Invoke();
|
|
39
|
-
|
|
40
|
-
if (exitEarly)
|
|
41
|
-
return;
|
|
42
|
-
|
|
43
|
-
UnityEngine.Debug.Log("REPORT: Option Invocation Process Completed.");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// <summary>
|
|
47
|
-
///
|
|
48
|
-
/// </summary>
|
|
49
|
-
protected virtual void CloseWindowEarly()
|
|
50
|
-
{
|
|
51
|
-
exitEarly = true;
|
|
52
|
-
|
|
53
|
-
UnityEngine.Debug.Log("REPORT: Aborted Active Wizard.");
|
|
54
|
-
|
|
55
|
-
Close();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using UnityEditor;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Presents.Editor
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class ReactionImporter : ScriptableWizard
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
[SelectType]
|
|
17
|
+
[SerializeReference]
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected PresentImportOptionBase importOption;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
protected bool exitEarly = false;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
[MenuItem("DREditor/Import/FTE/Present Reactions")]
|
|
29
|
+
public static void SpawnWizard() => DisplayWizard<ReactionImporter>("Reaction Importer", "Apply");
|
|
30
|
+
|
|
31
|
+
protected virtual void OnWizardCreate()
|
|
32
|
+
{
|
|
33
|
+
importOption.Initialize(CloseWindowEarly);
|
|
34
|
+
|
|
35
|
+
if (exitEarly)
|
|
36
|
+
return;
|
|
37
|
+
|
|
38
|
+
importOption.Invoke();
|
|
39
|
+
|
|
40
|
+
if (exitEarly)
|
|
41
|
+
return;
|
|
42
|
+
|
|
43
|
+
UnityEngine.Debug.Log("REPORT: Option Invocation Process Completed.");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
protected virtual void CloseWindowEarly()
|
|
50
|
+
{
|
|
51
|
+
exitEarly = true;
|
|
52
|
+
|
|
53
|
+
UnityEngine.Debug.Log("REPORT: Aborted Active Wizard.");
|
|
54
|
+
|
|
55
|
+
Close();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
59
|
#endif
|