net.dreditor.talkables 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/Talkable.cs CHANGED
@@ -1,153 +1,153 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- using DREditor.Dialogues;
3
- using DREditor.Dialogues.Loading;
4
- using DREditor.EventObjects;
5
- using DREditor.LocalDialogues;
6
- using DREditor.Services;
7
- using System;
8
- using System.Collections;
9
- using System.Collections.Generic;
10
- using UnityEngine;
11
- using UnityEngine.Serialization;
12
-
13
- namespace DREditor.Talkables
14
- {
15
- /// <summary>
16
- ///
17
- /// </summary>
18
- public abstract class Talkable : SelectableObject, IDialogueProgression, IDialogueHolder, ISkipConversation
19
- {
20
- /// <summary>
21
- ///
22
- /// </summary>
23
- [Tooltip("")]
24
- public bool identified = true;
25
-
26
- /// <summary>
27
- ///
28
- /// </summary>
29
- [Tooltip("")]
30
- [SerializeField] protected string unidentifiedDisplayName = "???";
31
-
32
- /// <summary>
33
- ///
34
- /// </summary>
35
- [Tooltip("")]
36
- [FormerlySerializedAs("RoomConvo")]
37
- public List<LocalDialogue> conversations = new();
38
-
39
-
40
- /// <summary>
41
- ///
42
- /// </summary>
43
- public event Action<Talkable, Dialogue[]> StartConversation;
44
-
45
-
46
- /// <summary>
47
- ///
48
- /// </summary>
49
- /// <param name="action"></param>
50
- public virtual void SubscribeToStartConversation(Action<Talkable, Dialogue[]> action) => StartConversation += action;
51
-
52
- /// <summary>
53
- ///
54
- /// </summary>
55
- /// <param name="action"></param>
56
- public virtual void UnsubscribeToStartConversation(Action<Talkable, Dialogue[]> action) => StartConversation -= action;
57
-
58
- /// <summary>
59
- ///
60
- /// </summary>
61
- /// <param name="conversation"></param>
62
- protected virtual void InvokeConversation(Dialogue[] conversation) => StartConversation?.Invoke(this, conversation);
63
-
64
-
65
- /// <summary>
66
- ///
67
- /// </summary>
68
- protected virtual void Start() => Register(this);
69
-
70
- /// <summary>
71
- ///
72
- /// </summary>
73
- /// <typeparam name="T"></typeparam>
74
- /// <param name="pooledObject"></param>
75
- protected virtual void Register<T>(T pooledObject) where T : SelectableObject
76
- {
77
- ServiceLocator.GetService<IObjectPooler<SelectableObject>>()?.RegisterObject(pooledObject);
78
-
79
- if (ServiceLocator.HasService<IObjectPooler<T>>())
80
- ServiceLocator.GetService<IObjectPooler<T>>()?.RegisterObject(pooledObject);
81
- else
82
- StartCoroutine(WaitForObjectPooler(pooledObject));
83
- }
84
-
85
- /// <summary>
86
- ///
87
- /// </summary>
88
- /// <typeparam name="T"></typeparam>
89
- /// <param name="pooledObject"></param>
90
- /// <returns></returns>
91
- protected virtual IEnumerator WaitForObjectPooler<T>(T pooledObject)
92
- {
93
- UnityEngine.Debug.LogWarning($"ALERT: Pooler for type: {typeof(T)} does not exist!");
94
-
95
- UnityEngine.Debug.Log($" {typeof(T)} Started Waiting for: " + transform.parent.name);
96
-
97
- yield return new WaitUntil(() => ServiceLocator.HasService<IObjectPooler<T>>());
98
-
99
- ServiceLocator.GetService<IObjectPooler<T>>()?.RegisterObject(pooledObject);
100
-
101
- UnityEngine.Debug.Log("Successfully waited for: " + transform.parent.name);
102
- }
103
-
104
-
105
- /// <summary>
106
- ///
107
- /// </summary>
108
- protected virtual void OnDestroy() => Unregister(this);
109
-
110
- /// <summary>
111
- ///
112
- /// </summary>
113
- /// <typeparam name="T"></typeparam>
114
- /// <param name="pooledObject"></param>
115
- protected virtual void Unregister<T>(T pooledObject) where T : SelectableObject
116
- {
117
- if (ServiceLocator.HasService<IObjectPooler<SelectableObject>>(out var service))
118
- service.UnregisterObject(pooledObject);
119
-
120
- ServiceLocator.GetService<IObjectPooler<T>>()?.UnregisterObject(pooledObject);
121
- }
122
-
123
-
124
- /// <inheritdoc/>
125
- public override string DisplayName => identified ? base.DisplayName : unidentifiedDisplayName;
126
-
127
-
128
- /// <inheritdoc/>
129
- public virtual bool CheckIfSaveDialogue()
130
- {
131
- foreach (LocalDialogue localDialogue in conversations)
132
- if (ServiceLocator.GetService<IDialogueManager>()
133
- .GetManagerComponent<DialogueLoadIdentifier>()
134
- .CheckDialogue<Line>(localDialogue.dialogue)
135
- ||
136
- ServiceLocator.GetService<IDialogueManager>()
137
- .GetManagerComponent<DialogueLoadIdentifier>()
138
- .CheckDialogue<Line>(localDialogue.dialogueIfFlagNotMet))
139
- return true;
140
-
141
- return false;
142
- }
143
-
144
- /// <inheritdoc/>
145
- public virtual void SkipConversation(int conversationIndex) => conversations[conversationIndex].SetTriggered();
146
-
147
- /// <inheritdoc/>
148
- public virtual bool AllDialogueTriggered() => conversations.AllDialogueTriggered();
149
-
150
- /// <inheritdoc/>
151
- public virtual bool HasUnTriggeredRequiredFlags() => conversations.HasUnTriggeredRequiredFlags();
152
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Dialogues.Loading;
4
+ using DREditor.EventObjects;
5
+ using DREditor.LocalDialogues;
6
+ using DREditor.Services;
7
+ using System;
8
+ using System.Collections;
9
+ using System.Collections.Generic;
10
+ using UnityEngine;
11
+ using UnityEngine.Serialization;
12
+
13
+ namespace DREditor.Talkables
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ public abstract class Talkable : SelectableObject, IDialogueProgression, IDialogueHolder, ISkipConversation
19
+ {
20
+ /// <summary>
21
+ ///
22
+ /// </summary>
23
+ [Tooltip("")]
24
+ public bool identified = true;
25
+
26
+ /// <summary>
27
+ ///
28
+ /// </summary>
29
+ [Tooltip("")]
30
+ [SerializeField] protected string unidentifiedDisplayName = "???";
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ [Tooltip("")]
36
+ [FormerlySerializedAs("RoomConvo")]
37
+ public List<LocalDialogue> conversations = new();
38
+
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ public event Action<Talkable, Dialogue[]> StartConversation;
44
+
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ /// <param name="action"></param>
50
+ public virtual void SubscribeToStartConversation(Action<Talkable, Dialogue[]> action) => StartConversation += action;
51
+
52
+ /// <summary>
53
+ ///
54
+ /// </summary>
55
+ /// <param name="action"></param>
56
+ public virtual void UnsubscribeToStartConversation(Action<Talkable, Dialogue[]> action) => StartConversation -= action;
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ /// <param name="conversation"></param>
62
+ protected virtual void InvokeConversation(Dialogue[] conversation) => StartConversation?.Invoke(this, conversation);
63
+
64
+
65
+ /// <summary>
66
+ ///
67
+ /// </summary>
68
+ protected virtual void Start() => Register(this);
69
+
70
+ /// <summary>
71
+ ///
72
+ /// </summary>
73
+ /// <typeparam name="T"></typeparam>
74
+ /// <param name="pooledObject"></param>
75
+ protected virtual void Register<T>(T pooledObject) where T : SelectableObject
76
+ {
77
+ ServiceLocator.GetService<IObjectPooler<SelectableObject>>()?.RegisterObject(pooledObject);
78
+
79
+ if (ServiceLocator.HasService<IObjectPooler<T>>())
80
+ ServiceLocator.GetService<IObjectPooler<T>>()?.RegisterObject(pooledObject);
81
+ else
82
+ StartCoroutine(WaitForObjectPooler(pooledObject));
83
+ }
84
+
85
+ /// <summary>
86
+ ///
87
+ /// </summary>
88
+ /// <typeparam name="T"></typeparam>
89
+ /// <param name="pooledObject"></param>
90
+ /// <returns></returns>
91
+ protected virtual IEnumerator WaitForObjectPooler<T>(T pooledObject)
92
+ {
93
+ UnityEngine.Debug.LogWarning($"ALERT: Pooler for type: {typeof(T)} does not exist!");
94
+
95
+ UnityEngine.Debug.Log($" {typeof(T)} Started Waiting for: " + transform.parent.name);
96
+
97
+ yield return new WaitUntil(() => ServiceLocator.HasService<IObjectPooler<T>>());
98
+
99
+ ServiceLocator.GetService<IObjectPooler<T>>()?.RegisterObject(pooledObject);
100
+
101
+ UnityEngine.Debug.Log("Successfully waited for: " + transform.parent.name);
102
+ }
103
+
104
+
105
+ /// <summary>
106
+ ///
107
+ /// </summary>
108
+ protected virtual void OnDestroy() => Unregister(this);
109
+
110
+ /// <summary>
111
+ ///
112
+ /// </summary>
113
+ /// <typeparam name="T"></typeparam>
114
+ /// <param name="pooledObject"></param>
115
+ protected virtual void Unregister<T>(T pooledObject) where T : SelectableObject
116
+ {
117
+ if (ServiceLocator.HasService<IObjectPooler<SelectableObject>>(out var service))
118
+ service.UnregisterObject(pooledObject);
119
+
120
+ ServiceLocator.GetService<IObjectPooler<T>>()?.UnregisterObject(pooledObject);
121
+ }
122
+
123
+
124
+ /// <inheritdoc/>
125
+ public override string DisplayName => identified ? base.DisplayName : unidentifiedDisplayName;
126
+
127
+
128
+ /// <inheritdoc/>
129
+ public virtual bool CheckIfSaveDialogue()
130
+ {
131
+ foreach (LocalDialogue localDialogue in conversations)
132
+ if (ServiceLocator.GetService<IDialogueManager>()
133
+ .GetManagerComponent<DialogueLoadIdentifier>()
134
+ .CheckDialogue<Line>(localDialogue.dialogue)
135
+ ||
136
+ ServiceLocator.GetService<IDialogueManager>()
137
+ .GetManagerComponent<DialogueLoadIdentifier>()
138
+ .CheckDialogue<Line>(localDialogue.dialogueIfFlagNotMet))
139
+ return true;
140
+
141
+ return false;
142
+ }
143
+
144
+ /// <inheritdoc/>
145
+ public virtual void SkipConversation(int conversationIndex) => conversations[conversationIndex].SetTriggered();
146
+
147
+ /// <inheritdoc/>
148
+ public virtual bool AllDialogueTriggered() => conversations.AllDialogueTriggered();
149
+
150
+ /// <inheritdoc/>
151
+ public virtual bool HasUnTriggeredRequiredFlags() => conversations.HasUnTriggeredRequiredFlags();
152
+ }
153
153
  }
package/Talkable.cs.meta CHANGED
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: d50aac0c1f19a56479f84f35ebb8602f
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: d50aac0c1f19a56479f84f35ebb8602f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,37 +1,42 @@
1
- {
2
- "name": "net.dreditor.talkables",
3
- "version": "0.1.6",
4
- "displayName": "DREditor Talkables",
5
- "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
- "unity": "6000.4",
7
- "dependencies": {
8
- "net.dreditor.core": "0.1.6",
9
- "net.dreditor.progressing.handling": "0.1.6",
10
- "net.dreditor.localdialogues": "0.1.6",
11
- "net.dreditor.dialogueeventhandling": "0.1.6"
12
- },
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "author": {
17
- "name": "Benjamin \"Sweden\" Jillson",
18
- "email": "dreditortool@gmail.com",
19
- "url": "https://dreditor.net"
20
- },
21
- "keywords": [
22
- "editor",
23
- "tool",
24
- "dreditor"
25
- ],
26
- "samples": [
27
- {
28
- "displayName": "Samples",
29
- "description": "",
30
- "path": "Samples~"
31
- }
32
- ],
33
- "documentationUrl": "https://dreditor.net",
34
- "license": "Apache-2.0",
35
- "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
36
- "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html"
37
- }
1
+ {
2
+ "name": "net.dreditor.talkables",
3
+ "version": "0.1.7",
4
+ "displayName": "DREditor Talkables",
5
+ "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
+ "unity": "6000.4",
7
+ "dependencies": {
8
+ "net.dreditor.core": "0.1.7",
9
+ "net.dreditor.progressing.handling": "0.1.7",
10
+ "net.dreditor.localdialogues": "0.1.7",
11
+ "net.dreditor.dialogueeventhandling": "0.1.7"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "author": {
17
+ "name": "Benjamin \"Sweden\" Jillson",
18
+ "email": "dreditortool@gmail.com",
19
+ "url": "https://dreditor.net"
20
+ },
21
+ "keywords": [
22
+ "editor",
23
+ "tool",
24
+ "dreditor"
25
+ ],
26
+ "samples": [
27
+ {
28
+ "displayName": "Samples",
29
+ "description": "",
30
+ "path": "Samples~"
31
+ }
32
+ ],
33
+ "documentationUrl": "https://dreditor.net",
34
+ "license": "Apache-2.0",
35
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
36
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html",
37
+ "repository": {
38
+ "url": "https://github.com/CertifiedSharp/DREditor",
39
+ "type": "git",
40
+ "revision": "14ca252fbb33eb6f53557ecaed1c10902877698f"
41
+ }
42
+ }
package/package.json.meta CHANGED
@@ -1,7 +1,7 @@
1
- fileFormatVersion: 2
2
- guid: 24aaec8f10ff2194492b1f167500bdc2
3
- TextScriptImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 24aaec8f10ff2194492b1f167500bdc2
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Samples.meta DELETED
@@ -1,8 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 884975c6bbf0ae447b23271e4eb2c28a
3
- folderAsset: yes
4
- DefaultImporter:
5
- externalObjects: {}
6
- userData:
7
- assetBundleName:
8
- assetBundleVariant: