fr.jeanf.questsystem 0.0.5 → 0.0.6
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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using jeanf.questsystem;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
public class QuestInfoSO_Editor : Editor
|
|
8
|
+
{
|
|
9
|
+
[CustomEditor(typeof(QuestInfoSO))]
|
|
10
|
+
public class BoolEventOnClickEditor : Editor {
|
|
11
|
+
override public void OnInspectorGUI () {
|
|
12
|
+
GUILayout.Space(10);
|
|
13
|
+
var eventToSend = (QuestInfoSO)target;
|
|
14
|
+
if(GUILayout.Button("Regenerate quest id", GUILayout.Height(20))) {
|
|
15
|
+
eventToSend.GenerateId(); // how do i call this?
|
|
16
|
+
}
|
|
17
|
+
GUILayout.Space(10);
|
|
18
|
+
|
|
19
|
+
DrawDefaultInspector();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
#endif
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
using System;
|
|
1
2
|
using jeanf.EventSystem;
|
|
2
3
|
using UnityEngine;
|
|
3
4
|
using jeanf.propertyDrawer;
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
[ScriptableObjectDrawer]
|
|
9
10
|
public class QuestInfoSO : ScriptableObject
|
|
10
11
|
{
|
|
11
|
-
public string id { get; private set; }
|
|
12
|
+
[field: Space(10)][field: ReadOnly] [field: SerializeField] public string id { get; private set; }
|
|
12
13
|
|
|
13
14
|
[Header("General")] public string displayName;
|
|
14
15
|
|
|
@@ -25,5 +26,18 @@
|
|
|
25
26
|
[Header("Steps")] public GameObject[] questStepPrefabs;
|
|
26
27
|
|
|
27
28
|
[Header("Rewards")] public string unlockedScenario;
|
|
29
|
+
|
|
30
|
+
#if UNITY_EDITOR
|
|
31
|
+
private void OnValidate()
|
|
32
|
+
{
|
|
33
|
+
if (id == string.Empty || id == null) GenerateId();
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
public void GenerateId()
|
|
38
|
+
{
|
|
39
|
+
id = $"{System.Guid.NewGuid()}";
|
|
40
|
+
UnityEditor.EditorUtility.SetDirty(this);
|
|
41
|
+
}
|
|
28
42
|
}
|
|
29
43
|
}
|