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,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 949b024cb5ae1ae4f92737a184cbf29a
|
|
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: 949b024cb5ae1ae4f92737a184cbf29a
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,96 +1,96 @@
|
|
|
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 UnityEditor;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Presents.Editor
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[Serializable]
|
|
14
|
-
public class RenamePresentsByIDOption : PresentGoogleSheetsImportOption
|
|
15
|
-
{
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
[Header("")]
|
|
20
|
-
[Divider]
|
|
21
|
-
[Header("")]
|
|
22
|
-
[ReadOnly]
|
|
23
|
-
[Tooltip("")]
|
|
24
|
-
[SerializeField] protected string googleSheetsRegex = "(\\t\\D\\d\\D+|\\D+)|(\\t\\D+|\\D+)";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
protected Dictionary<int, string> entries;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/// <inheritdoc/>
|
|
34
|
-
public override void Invoke() => RenamePresentsByID();
|
|
35
|
-
|
|
36
|
-
/// <summary>
|
|
37
|
-
///
|
|
38
|
-
/// </summary>
|
|
39
|
-
protected virtual void RenamePresentsByID()
|
|
40
|
-
{
|
|
41
|
-
List<int> ids = GetListOfIDs();
|
|
42
|
-
|
|
43
|
-
List<string> words = GetListOfNamesGoogleSheetFormat(googleSheetsRegex);
|
|
44
|
-
|
|
45
|
-
if (ids.Count == words.Count)
|
|
46
|
-
RenamePresents(ids, words);
|
|
47
|
-
else
|
|
48
|
-
OnFailedRename();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/// <summary>
|
|
52
|
-
///
|
|
53
|
-
/// </summary>
|
|
54
|
-
protected virtual void OnFailedRename()
|
|
55
|
-
{
|
|
56
|
-
EditorUtility.DisplayDialog("Sheet Format Incorrect: Inconsistent ID's and Name count",
|
|
57
|
-
"Please Copy each column on your google sheets with the ID and Name to use this functionality!", "OK");
|
|
58
|
-
|
|
59
|
-
Close();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/// <summary>
|
|
63
|
-
///
|
|
64
|
-
/// </summary>
|
|
65
|
-
/// <param name="ids"></param>
|
|
66
|
-
/// <param name="words"></param>
|
|
67
|
-
protected virtual void RenamePresents(List<int> ids, List<string> words)
|
|
68
|
-
{
|
|
69
|
-
CreatePairing(ids, words, out entries);
|
|
70
|
-
|
|
71
|
-
AssetDatabase.StartAssetEditing();
|
|
72
|
-
|
|
73
|
-
foreach (Present present in presentDatabase.presents)
|
|
74
|
-
if (entries.ContainsKey(present.ID))
|
|
75
|
-
RenamePresent(present);
|
|
76
|
-
else
|
|
77
|
-
UnityEngine.Debug.LogWarning("ALERT: Couldn't Find Present in dictionary With ID: " + present.ID);
|
|
78
|
-
|
|
79
|
-
AssetDatabase.StopAssetEditing();
|
|
80
|
-
|
|
81
|
-
Close();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/// <summary>
|
|
85
|
-
///
|
|
86
|
-
/// </summary>
|
|
87
|
-
/// <param name="present"></param>
|
|
88
|
-
protected virtual void RenamePresent(Present present)
|
|
89
|
-
{
|
|
90
|
-
present.DisplayName = entries[present.ID].Trim().Replace("\r", "");
|
|
91
|
-
|
|
92
|
-
EditorUtility.SetDirty(present);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
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 UnityEditor;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Presents.Editor
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[Serializable]
|
|
14
|
+
public class RenamePresentsByIDOption : PresentGoogleSheetsImportOption
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Header("")]
|
|
20
|
+
[Divider]
|
|
21
|
+
[Header("")]
|
|
22
|
+
[ReadOnly]
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected string googleSheetsRegex = "(\\t\\D\\d\\D+|\\D+)|(\\t\\D+|\\D+)";
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
protected Dictionary<int, string> entries;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/// <inheritdoc/>
|
|
34
|
+
public override void Invoke() => RenamePresentsByID();
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
protected virtual void RenamePresentsByID()
|
|
40
|
+
{
|
|
41
|
+
List<int> ids = GetListOfIDs();
|
|
42
|
+
|
|
43
|
+
List<string> words = GetListOfNamesGoogleSheetFormat(googleSheetsRegex);
|
|
44
|
+
|
|
45
|
+
if (ids.Count == words.Count)
|
|
46
|
+
RenamePresents(ids, words);
|
|
47
|
+
else
|
|
48
|
+
OnFailedRename();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
///
|
|
53
|
+
/// </summary>
|
|
54
|
+
protected virtual void OnFailedRename()
|
|
55
|
+
{
|
|
56
|
+
EditorUtility.DisplayDialog("Sheet Format Incorrect: Inconsistent ID's and Name count",
|
|
57
|
+
"Please Copy each column on your google sheets with the ID and Name to use this functionality!", "OK");
|
|
58
|
+
|
|
59
|
+
Close();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
/// <param name="ids"></param>
|
|
66
|
+
/// <param name="words"></param>
|
|
67
|
+
protected virtual void RenamePresents(List<int> ids, List<string> words)
|
|
68
|
+
{
|
|
69
|
+
CreatePairing(ids, words, out entries);
|
|
70
|
+
|
|
71
|
+
AssetDatabase.StartAssetEditing();
|
|
72
|
+
|
|
73
|
+
foreach (Present present in presentDatabase.presents)
|
|
74
|
+
if (entries.ContainsKey(present.ID))
|
|
75
|
+
RenamePresent(present);
|
|
76
|
+
else
|
|
77
|
+
UnityEngine.Debug.LogWarning("ALERT: Couldn't Find Present in dictionary With ID: " + present.ID);
|
|
78
|
+
|
|
79
|
+
AssetDatabase.StopAssetEditing();
|
|
80
|
+
|
|
81
|
+
Close();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// <summary>
|
|
85
|
+
///
|
|
86
|
+
/// </summary>
|
|
87
|
+
/// <param name="present"></param>
|
|
88
|
+
protected virtual void RenamePresent(Present present)
|
|
89
|
+
{
|
|
90
|
+
present.DisplayName = entries[present.ID].Trim().Replace("\r", "");
|
|
91
|
+
|
|
92
|
+
EditorUtility.SetDirty(present);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
96
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: 53226808e6400dc4ea134e8c38caf1dd
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
// Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using DREditor.Editor.Utility;
|
|
4
|
-
using UnityEditor;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.Presents.Editor
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
[CustomClassEditor(typeof(StudentReactionCollection))]
|
|
12
|
-
public class StudentReactionCollectionEditor : ClassEditorBase
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
private const string ReactionsFieldName = "studentReactions";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/// <inheritdoc/>
|
|
21
|
-
protected override void OnInspectorGUI()
|
|
22
|
-
{
|
|
23
|
-
var parentEditor = GetFirstParameter<UnityEditor.Editor>();
|
|
24
|
-
|
|
25
|
-
var serializedProperty = GetFirstParameter<SerializedProperty>();
|
|
26
|
-
|
|
27
|
-
var eventIndex = GetFirstParameter<InterfaceEditorBase>().currentlyDisplayedEventIndex;
|
|
28
|
-
|
|
29
|
-
var reactionsProp = serializedProperty.GetArrayElementAtIndex(eventIndex)
|
|
30
|
-
.FindPropertyRelative(ReactionsFieldName);
|
|
31
|
-
|
|
32
|
-
var cache = parentEditor as INestedEditorCacheable;
|
|
33
|
-
|
|
34
|
-
if (!ValidateContext(parentEditor, serializedProperty, cache))
|
|
35
|
-
return;
|
|
36
|
-
|
|
37
|
-
var editor = CreateReactionEditor(parentEditor, cache);
|
|
38
|
-
|
|
39
|
-
DisplayClearEntriesButton(editor);
|
|
40
|
-
|
|
41
|
-
editor.DisplayInterfaceInstances(reactionsProp, cache);
|
|
42
|
-
|
|
43
|
-
UpdateCache(cache, editor);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// <summary>
|
|
47
|
-
///
|
|
48
|
-
/// </summary>
|
|
49
|
-
/// <param name="parent"></param>
|
|
50
|
-
/// <param name="prop"></param>
|
|
51
|
-
/// <param name="cache"></param>
|
|
52
|
-
/// <returns></returns>
|
|
53
|
-
protected virtual bool ValidateContext(UnityEditor.Editor parent, SerializedProperty prop, INestedEditorCacheable cache)
|
|
54
|
-
{
|
|
55
|
-
if (cache != null)
|
|
56
|
-
return true;
|
|
57
|
-
|
|
58
|
-
HandyFields.Label($"ALERT: Parent editor must inherit {nameof(INestedEditorCacheable)}", EditorStyles.helpBox);
|
|
59
|
-
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/// <summary>
|
|
64
|
-
///
|
|
65
|
-
/// </summary>
|
|
66
|
-
/// <param name="parent"></param>
|
|
67
|
-
/// <param name="cache"></param>
|
|
68
|
-
/// <returns></returns>
|
|
69
|
-
protected virtual InterfaceEditor<IReactionEntry> CreateReactionEditor(UnityEditor.Editor parent, INestedEditorCacheable cache)
|
|
70
|
-
{
|
|
71
|
-
if (!cache.VisibilityCaches.TryGetValue(baseTarget, out bool isVisible))
|
|
72
|
-
isVisible = true;
|
|
73
|
-
|
|
74
|
-
cache.IndexCaches.TryGetValue(baseTarget, out int index);
|
|
75
|
-
|
|
76
|
-
return new InterfaceEditor<IReactionEntry>(parent, ((StudentReactionCollection)baseTarget).studentReactions, isVisible, index);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/// <summary>
|
|
80
|
-
///
|
|
81
|
-
/// </summary>
|
|
82
|
-
/// <param name="editor"></param>
|
|
83
|
-
protected virtual void DisplayClearEntriesButton(InterfaceEditor<IReactionEntry> editor)
|
|
84
|
-
{
|
|
85
|
-
if (HandyFields.Button("Clear") && EditorUtility.DisplayDialog("Clear Entries", "Are you sure you want to clear all entries?",
|
|
86
|
-
"Yes", "No"))
|
|
87
|
-
editor.instances.Clear();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/// <summary>
|
|
91
|
-
///
|
|
92
|
-
/// </summary>
|
|
93
|
-
/// <param name="cache"></param>
|
|
94
|
-
/// <param name="editor"></param>
|
|
95
|
-
protected virtual void UpdateCache(INestedEditorCacheable cache, InterfaceEditor<IReactionEntry> editor)
|
|
96
|
-
{
|
|
97
|
-
cache.VisibilityCaches[baseTarget] = editor.showDiaEvents;
|
|
98
|
-
|
|
99
|
-
cache.IndexCaches[baseTarget] = editor.currentlyPickedIndex;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
1
|
+
// Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Editor.Utility;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Presents.Editor
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[CustomClassEditor(typeof(StudentReactionCollection))]
|
|
12
|
+
public class StudentReactionCollectionEditor : ClassEditorBase
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
private const string ReactionsFieldName = "studentReactions";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/// <inheritdoc/>
|
|
21
|
+
protected override void OnInspectorGUI()
|
|
22
|
+
{
|
|
23
|
+
var parentEditor = GetFirstParameter<UnityEditor.Editor>();
|
|
24
|
+
|
|
25
|
+
var serializedProperty = GetFirstParameter<SerializedProperty>();
|
|
26
|
+
|
|
27
|
+
var eventIndex = GetFirstParameter<InterfaceEditorBase>().currentlyDisplayedEventIndex;
|
|
28
|
+
|
|
29
|
+
var reactionsProp = serializedProperty.GetArrayElementAtIndex(eventIndex)
|
|
30
|
+
.FindPropertyRelative(ReactionsFieldName);
|
|
31
|
+
|
|
32
|
+
var cache = parentEditor as INestedEditorCacheable;
|
|
33
|
+
|
|
34
|
+
if (!ValidateContext(parentEditor, serializedProperty, cache))
|
|
35
|
+
return;
|
|
36
|
+
|
|
37
|
+
var editor = CreateReactionEditor(parentEditor, cache);
|
|
38
|
+
|
|
39
|
+
DisplayClearEntriesButton(editor);
|
|
40
|
+
|
|
41
|
+
editor.DisplayInterfaceInstances(reactionsProp, cache);
|
|
42
|
+
|
|
43
|
+
UpdateCache(cache, editor);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
/// <param name="parent"></param>
|
|
50
|
+
/// <param name="prop"></param>
|
|
51
|
+
/// <param name="cache"></param>
|
|
52
|
+
/// <returns></returns>
|
|
53
|
+
protected virtual bool ValidateContext(UnityEditor.Editor parent, SerializedProperty prop, INestedEditorCacheable cache)
|
|
54
|
+
{
|
|
55
|
+
if (cache != null)
|
|
56
|
+
return true;
|
|
57
|
+
|
|
58
|
+
HandyFields.Label($"ALERT: Parent editor must inherit {nameof(INestedEditorCacheable)}", EditorStyles.helpBox);
|
|
59
|
+
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/// <summary>
|
|
64
|
+
///
|
|
65
|
+
/// </summary>
|
|
66
|
+
/// <param name="parent"></param>
|
|
67
|
+
/// <param name="cache"></param>
|
|
68
|
+
/// <returns></returns>
|
|
69
|
+
protected virtual InterfaceEditor<IReactionEntry> CreateReactionEditor(UnityEditor.Editor parent, INestedEditorCacheable cache)
|
|
70
|
+
{
|
|
71
|
+
if (!cache.VisibilityCaches.TryGetValue(baseTarget, out bool isVisible))
|
|
72
|
+
isVisible = true;
|
|
73
|
+
|
|
74
|
+
cache.IndexCaches.TryGetValue(baseTarget, out int index);
|
|
75
|
+
|
|
76
|
+
return new InterfaceEditor<IReactionEntry>(parent, ((StudentReactionCollection)baseTarget).studentReactions, isVisible, index);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
///
|
|
81
|
+
/// </summary>
|
|
82
|
+
/// <param name="editor"></param>
|
|
83
|
+
protected virtual void DisplayClearEntriesButton(InterfaceEditor<IReactionEntry> editor)
|
|
84
|
+
{
|
|
85
|
+
if (HandyFields.Button("Clear") && EditorUtility.DisplayDialog("Clear Entries", "Are you sure you want to clear all entries?",
|
|
86
|
+
"Yes", "No"))
|
|
87
|
+
editor.instances.Clear();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/// <summary>
|
|
91
|
+
///
|
|
92
|
+
/// </summary>
|
|
93
|
+
/// <param name="cache"></param>
|
|
94
|
+
/// <param name="editor"></param>
|
|
95
|
+
protected virtual void UpdateCache(INestedEditorCacheable cache, InterfaceEditor<IReactionEntry> editor)
|
|
96
|
+
{
|
|
97
|
+
cache.VisibilityCaches[baseTarget] = editor.showDiaEvents;
|
|
98
|
+
|
|
99
|
+
cache.IndexCaches[baseTarget] = editor.currentlyPickedIndex;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
104
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: ebb5eff9c9392944f98b161ff01c7588
|
|
@@ -1,83 +1,83 @@
|
|
|
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 UnityEditor;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Presents.Editor
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[CustomClassEditor(typeof(StudentReaction))]
|
|
14
|
-
public class StudentReactionEditor : ClassEditorBase
|
|
15
|
-
{
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
protected ReactionLevelDatabase reactionDatabase;
|
|
20
|
-
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
protected readonly string VerticalBoxLayoutStyle = "Box";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/// <inheritdoc/>
|
|
28
|
-
protected override void OnInspectorGUI()
|
|
29
|
-
{
|
|
30
|
-
INestedEditorCacheable cache = GetFirstParameter<INestedEditorCacheable>();
|
|
31
|
-
|
|
32
|
-
if ((bool)!cache?.TryGetData(out reactionDatabase))
|
|
33
|
-
cache.AddData(DatabaseUtility.LoadDatabase<ReactionLevelDatabase>());
|
|
34
|
-
|
|
35
|
-
if (reactionDatabase == null || cache == null)
|
|
36
|
-
return;
|
|
37
|
-
|
|
38
|
-
using (new EditorGUILayout.HorizontalScope(VerticalBoxLayoutStyle))
|
|
39
|
-
DisplayReaction(baseTarget as StudentReaction);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
/// <param name="reaction"></param>
|
|
46
|
-
protected virtual void DisplayReaction(StudentReaction reaction)
|
|
47
|
-
{
|
|
48
|
-
DisplayStudent(reaction);
|
|
49
|
-
|
|
50
|
-
DisplayReactionDropdown(reaction);
|
|
51
|
-
|
|
52
|
-
EditorGUILayout.Space();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/// <summary>
|
|
56
|
-
///
|
|
57
|
-
/// </summary>
|
|
58
|
-
/// <param name="reaction"></param>
|
|
59
|
-
protected virtual void DisplayStudent(StudentReaction reaction)
|
|
60
|
-
{
|
|
61
|
-
using (new EditorGUILayout.VerticalScope())
|
|
62
|
-
reaction.Character = HandyFields.UnityField(reaction.Character);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/// <summary>
|
|
66
|
-
///
|
|
67
|
-
/// </summary>
|
|
68
|
-
/// <param name="reaction"></param>
|
|
69
|
-
protected virtual void DisplayReactionDropdown(StudentReaction reaction)
|
|
70
|
-
{
|
|
71
|
-
using (new EditorGUILayout.VerticalScope())
|
|
72
|
-
{
|
|
73
|
-
GUILayout.FlexibleSpace();
|
|
74
|
-
|
|
75
|
-
reaction.ReactionIndex = EditorGUILayout.Popup(reaction.ReactionIndex, reactionDatabase.GetReactionNames());
|
|
76
|
-
|
|
77
|
-
GUILayout.FlexibleSpace();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
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 UnityEditor;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Presents.Editor
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[CustomClassEditor(typeof(StudentReaction))]
|
|
14
|
+
public class StudentReactionEditor : ClassEditorBase
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
protected ReactionLevelDatabase reactionDatabase;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
protected readonly string VerticalBoxLayoutStyle = "Box";
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <inheritdoc/>
|
|
28
|
+
protected override void OnInspectorGUI()
|
|
29
|
+
{
|
|
30
|
+
INestedEditorCacheable cache = GetFirstParameter<INestedEditorCacheable>();
|
|
31
|
+
|
|
32
|
+
if ((bool)!cache?.TryGetData(out reactionDatabase))
|
|
33
|
+
cache.AddData(DatabaseUtility.LoadDatabase<ReactionLevelDatabase>());
|
|
34
|
+
|
|
35
|
+
if (reactionDatabase == null || cache == null)
|
|
36
|
+
return;
|
|
37
|
+
|
|
38
|
+
using (new EditorGUILayout.HorizontalScope(VerticalBoxLayoutStyle))
|
|
39
|
+
DisplayReaction(baseTarget as StudentReaction);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
/// <param name="reaction"></param>
|
|
46
|
+
protected virtual void DisplayReaction(StudentReaction reaction)
|
|
47
|
+
{
|
|
48
|
+
DisplayStudent(reaction);
|
|
49
|
+
|
|
50
|
+
DisplayReactionDropdown(reaction);
|
|
51
|
+
|
|
52
|
+
EditorGUILayout.Space();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// <summary>
|
|
56
|
+
///
|
|
57
|
+
/// </summary>
|
|
58
|
+
/// <param name="reaction"></param>
|
|
59
|
+
protected virtual void DisplayStudent(StudentReaction reaction)
|
|
60
|
+
{
|
|
61
|
+
using (new EditorGUILayout.VerticalScope())
|
|
62
|
+
reaction.Character = HandyFields.UnityField(reaction.Character);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
///
|
|
67
|
+
/// </summary>
|
|
68
|
+
/// <param name="reaction"></param>
|
|
69
|
+
protected virtual void DisplayReactionDropdown(StudentReaction reaction)
|
|
70
|
+
{
|
|
71
|
+
using (new EditorGUILayout.VerticalScope())
|
|
72
|
+
{
|
|
73
|
+
GUILayout.FlexibleSpace();
|
|
74
|
+
|
|
75
|
+
reaction.ReactionIndex = EditorGUILayout.Popup(reaction.ReactionIndex, reactionDatabase.GetReactionNames());
|
|
76
|
+
|
|
77
|
+
GUILayout.FlexibleSpace();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
83
|
#endif
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: 5e8757e6f41d69a4ea0b090ed3993202
|
package/Editor.meta
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: d2a5f914dfa554b45adc054337b79ebe
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d2a5f914dfa554b45adc054337b79ebe
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|