fr.jeanf.questsystem 0.0.5 → 0.0.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.
@@ -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
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 668cc10d882879646a452dba32878ec7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 515697269417b41468b334ac95eca30a
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -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
  }
@@ -200,6 +200,7 @@ namespace jeanf.questsystem
200
200
  }
201
201
 
202
202
  idToQuestMap.Add(questInfo.id, LoadQuest(questInfo));
203
+ if(isDebug) Debug.Log($"Adding {questInfo.name} to the questmap, its id is: {questInfo.id}");
203
204
  }
204
205
 
205
206
  return idToQuestMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"fr.jeanf.questsystem",
3
- "version":"0.0.5",
3
+ "version":"0.0.7",
4
4
  "displayName":"Quest system",
5
5
  "description":"This package uses Scriptable Objects to define quests.",
6
6
  "unity": "2021.3",