net.dreditor.localdialogues 0.0.0-stage → 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.
Binary file
package/BoolTrigger.cs ADDED
@@ -0,0 +1,25 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using System;
3
+ using UnityEngine;
4
+
5
+ namespace DREditor.LocalDialogues
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ [Serializable]
11
+ public class BoolTrigger
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [Tooltip("")]
17
+ public string actorName = "";
18
+
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ [Tooltip("")]
23
+ public int convoNum = 0;
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4f8bd7ca850ea5341ba65a81be12a392
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,17 @@
1
+ {
2
+ "name": "DREditor.LocalDialogues",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "DREditor",
6
+ "DREditor.Progressing.Handling"
7
+ ],
8
+ "includePlatforms": [],
9
+ "excludePlatforms": [],
10
+ "allowUnsafeCode": false,
11
+ "overrideReferences": false,
12
+ "precompiledReferences": [],
13
+ "autoReferenced": true,
14
+ "defineConstraints": [],
15
+ "versionDefines": [],
16
+ "noEngineReferences": false
17
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 507a1ab917f79934483230a3b50b1baa
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,23 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+
3
+ namespace DREditor.LocalDialogues
4
+ {
5
+ /// <summary>
6
+ ///
7
+ /// </summary>
8
+ /// <remarks></remarks>
9
+ public interface IDialogueProgression
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ /// <returns></returns>
15
+ bool AllDialogueTriggered();
16
+
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ /// <returns></returns>
21
+ bool HasUnTriggeredRequiredFlags();
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 504ec50b24f30f441b15cbafc1137689
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,16 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+
3
+ namespace DREditor.LocalDialogues
4
+ {
5
+ /// <summary>
6
+ ///
7
+ /// </summary>
8
+ public interface ISkipConversation
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ /// <param name="conversationIndex"></param>
14
+ void SkipConversation(int conversationIndex);
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ac43d2d51066bdf4b91f4f7bcb27bccb
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,81 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using System;
4
+ using System.Collections.Generic;
5
+ using UnityEngine;
6
+ using UnityEngine.Serialization;
7
+
8
+ namespace DREditor.LocalDialogues
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [Serializable]
14
+ public class LocalDialogue
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ [Tooltip("")]
20
+ public Dialogue dialogue = null;
21
+
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ [Tooltip("")]
26
+ public bool triggered = false;
27
+
28
+ /// <summary>
29
+ ///
30
+ /// </summary>
31
+ [Tooltip("")]
32
+ public string requiredProgressionFlag = "";
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ [Tooltip("")]
38
+ public Dialogue dialogueIfFlagNotMet = null;
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ [Tooltip("")]
44
+ [FormerlySerializedAs("dialogueBoolTrigger")]
45
+ public List<BoolTrigger> dialogueBoolTriggers = new();
46
+
47
+
48
+ public LocalDialogue() { }
49
+
50
+ public LocalDialogue(Dialogue dialogue, bool triggered, Dialogue dialogueIfFlagNotMet)
51
+ {
52
+ this.dialogue = dialogue;
53
+
54
+ this.triggered = triggered;
55
+
56
+ this.dialogueIfFlagNotMet = dialogueIfFlagNotMet;
57
+ }
58
+
59
+ /// <summary>
60
+ ///
61
+ /// </summary>
62
+ /// <returns></returns>
63
+ public object Clone()
64
+ {
65
+ LocalDialogue localDialogue = new(dialogue, triggered, dialogueIfFlagNotMet)
66
+ {
67
+ requiredProgressionFlag = requiredProgressionFlag,
68
+
69
+ dialogueBoolTriggers = dialogueBoolTriggers
70
+ };
71
+
72
+ return localDialogue;
73
+ }
74
+
75
+ /// <summary>
76
+ ///
77
+ /// </summary>
78
+ /// <param name="flagState"></param>
79
+ public virtual void SetTriggered(bool flagState = true) => triggered = flagState;
80
+ }
81
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d1e409c3c1460b844bc92102e4a7a96c
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,93 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using System.Collections.Generic;
3
+ using DREditor.Dialogues;
4
+ using DREditor.Dialogues.Loading;
5
+ using DREditor.Progressing.Handling;
6
+ using DREditor.Services;
7
+
8
+ namespace DREditor.LocalDialogues
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ public static class LocalDialogueExtensions
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ /// <param name="conversations"></param>
19
+ /// <returns></returns>
20
+ public static bool AllDialogueTriggered(this List<LocalDialogue> conversations)
21
+ {
22
+ foreach (var dialogue in conversations)
23
+ if (!dialogue.triggered)
24
+ return false;
25
+
26
+ return true;
27
+ }
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ /// <param name="conversations"></param>
33
+ /// <returns></returns>
34
+ public static bool ContainsTriggeredDialogue(this List<LocalDialogue> conversations)
35
+ {
36
+ foreach (var dialogue in conversations)
37
+ if (dialogue.triggered)
38
+ return true;
39
+
40
+ return false;
41
+ }
42
+
43
+ /// <summary>
44
+ ///
45
+ /// </summary>
46
+ /// <param name="conversations"></param>
47
+ /// <returns></returns>
48
+ public static bool HasUnTriggeredRequiredFlags(this List<LocalDialogue> conversations)
49
+ {
50
+ foreach (LocalDialogue localDialogue in conversations)
51
+ if (localDialogue.HasUnTriggeredRequiredFlags())
52
+ return true;
53
+
54
+ return false;
55
+ }
56
+
57
+ /// <summary>
58
+ ///
59
+ /// </summary>
60
+ /// <param name="localDialogue"></param>
61
+ /// <returns></returns>
62
+ public static bool HasUnTriggeredRequiredFlags(this LocalDialogue localDialogue)
63
+ {
64
+ if (localDialogue.dialogueIfFlagNotMet.HasUnTriggeredRequiredFlags())
65
+ return true;
66
+
67
+ if (!localDialogue.triggered && localDialogue.dialogue.HasUnTriggeredRequiredFlags())
68
+ return true;
69
+
70
+ return false;
71
+ }
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ /// <param name="localDialogues"></param>
77
+ /// <returns></returns>
78
+ public static bool CheckIfSaveDialogue(this List<LocalDialogue> localDialogues)
79
+ {
80
+ foreach (LocalDialogue localDialogue in localDialogues)
81
+ if (ServiceLocator.GetService<IDialogueManager>()
82
+ .GetManagerComponent<DialogueLoadIdentifier>()
83
+ .CheckDialogue<Line>(localDialogue.dialogue)
84
+ ||
85
+ ServiceLocator.GetService<IDialogueManager>()
86
+ .GetManagerComponent<DialogueLoadIdentifier>()
87
+ .CheckDialogue<Line>(localDialogue.dialogueIfFlagNotMet))
88
+ return true;
89
+
90
+ return false;
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 80212fa36992869419093e416e350ab7
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,104 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Progressing.Handling;
4
+ using DREditor.Services;
5
+ using System.Collections.Generic;
6
+
7
+ namespace DREditor.LocalDialogues
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ [ClassHeader(nameof(ServiceHolder<LocalDialogueHandlerBase>) + " for type: " + nameof(LocalDialogueHandlerBase) +
13
+ "\n\n")]
14
+ public class LocalDialogueHandler : LocalDialogueHandlerBase
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ protected LocalDialogue localDialogue = null;
20
+
21
+
22
+ /// <inheritdoc/>
23
+ public override void CheckBoolTrigger(List<BoolTrigger> boolTriggers)
24
+ {
25
+ foreach (BoolTrigger trigger in boolTriggers)
26
+ if (BookOfTriggers.ContainsKey(trigger.actorName))
27
+ BookOfTriggers[trigger.actorName].SkipConversation(trigger.convoNum);
28
+ }
29
+
30
+ /// <inheritdoc/>
31
+ public override Dialogue EvaluateDialogue(List<LocalDialogue> RoomConvo)
32
+ {
33
+ if (RoomConvo.Count == 0)
34
+ return null;
35
+
36
+ foreach (LocalDialogue localDialogue in RoomConvo)
37
+ if (EvaluatedConversation(localDialogue) is Dialogue evaluated && evaluated != null)
38
+ {
39
+ if (localDialogue.dialogueBoolTriggers.Count > 0)
40
+ CheckBoolTrigger(localDialogue.dialogueBoolTriggers);
41
+
42
+ return evaluated;
43
+ }
44
+
45
+ return RoomConvo[^1].dialogue; // Returns last Dialogue (After Chat)
46
+ }
47
+
48
+ /// <summary>
49
+ ///
50
+ /// </summary>
51
+ /// <param name="currentDialogue"></param>
52
+ /// <returns></returns>
53
+ protected virtual Dialogue EvaluatedConversation(LocalDialogue currentDialogue)
54
+ {
55
+ localDialogue = currentDialogue;
56
+
57
+ if (localDialogue != null && !localDialogue.triggered)
58
+ {
59
+ if (PassedRequiredFlag() is Dialogue flagResult && flagResult != null)
60
+ return flagResult;
61
+ else
62
+ return TriggerResultingDialogue();
63
+ }
64
+ else
65
+ return null;
66
+ }
67
+
68
+ /// <summary>
69
+ ///
70
+ /// </summary>
71
+ /// <returns></returns>
72
+ protected virtual Dialogue PassedRequiredFlag()
73
+ {
74
+ if (localDialogue.requiredProgressionFlag != "")
75
+ return EvaluateFlagResult();
76
+ else
77
+ return null;
78
+ }
79
+
80
+ /// <summary>
81
+ ///
82
+ /// </summary>
83
+ /// <returns></returns>
84
+ protected virtual Dialogue EvaluateFlagResult()
85
+ {
86
+ if (ServiceLocator.GetService<FlagTriggerHandlerBase>().IsFlagTriggered(localDialogue.requiredProgressionFlag))
87
+ return TriggerResultingDialogue();
88
+ else
89
+ return localDialogue.dialogueIfFlagNotMet;
90
+ }
91
+
92
+ /// <summary>
93
+ ///
94
+ /// </summary>
95
+ /// <returns></returns>
96
+ protected virtual Dialogue TriggerResultingDialogue()
97
+ {
98
+ if (localDialogue.dialogue != null)
99
+ localDialogue.SetTriggered();
100
+
101
+ return localDialogue.dialogue;
102
+ }
103
+ }
104
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e86cb3236c9d4b645884699a4e35b904
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,32 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Services;
4
+ using System.Collections.Generic;
5
+
6
+ namespace DREditor.LocalDialogues
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public abstract class LocalDialogueHandlerBase : ServiceHolder<LocalDialogueHandlerBase>
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ public readonly static Dictionary<string, ISkipConversation> BookOfTriggers = new();
17
+
18
+
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ /// <param name="boolTriggers"></param>
23
+ public abstract void CheckBoolTrigger(List<BoolTrigger> boolTriggers);
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ /// <param name="roomConversations"></param>
29
+ /// <returns></returns>
30
+ public abstract Dialogue EvaluateDialogue(List<LocalDialogue> roomConversations);
31
+ }
32
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 99a42da350fc104499423b51006061dc
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,48 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!1 &672484676823760318
4
+ GameObject:
5
+ m_ObjectHideFlags: 0
6
+ m_CorrespondingSourceObject: {fileID: 0}
7
+ m_PrefabInstance: {fileID: 0}
8
+ m_PrefabAsset: {fileID: 0}
9
+ serializedVersion: 6
10
+ m_Component:
11
+ - component: {fileID: 672484676823760319}
12
+ - component: {fileID: 7352949015031429283}
13
+ m_Layer: 0
14
+ m_Name: Local_Dialogue_Handler
15
+ m_TagString: Untagged
16
+ m_Icon: {fileID: 0}
17
+ m_NavMeshLayer: 0
18
+ m_StaticEditorFlags: 0
19
+ m_IsActive: 1
20
+ --- !u!4 &672484676823760319
21
+ Transform:
22
+ m_ObjectHideFlags: 0
23
+ m_CorrespondingSourceObject: {fileID: 0}
24
+ m_PrefabInstance: {fileID: 0}
25
+ m_PrefabAsset: {fileID: 0}
26
+ m_GameObject: {fileID: 672484676823760318}
27
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
28
+ m_LocalPosition: {x: 0, y: 0, z: 0}
29
+ m_LocalScale: {x: 1, y: 1, z: 1}
30
+ m_ConstrainProportionsScale: 0
31
+ m_Children: []
32
+ m_Father: {fileID: 0}
33
+ m_RootOrder: 0
34
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35
+ --- !u!114 &7352949015031429283
36
+ MonoBehaviour:
37
+ m_ObjectHideFlags: 0
38
+ m_CorrespondingSourceObject: {fileID: 0}
39
+ m_PrefabInstance: {fileID: 0}
40
+ m_PrefabAsset: {fileID: 0}
41
+ m_GameObject: {fileID: 672484676823760318}
42
+ m_Enabled: 1
43
+ m_EditorHideFlags: 0
44
+ m_Script: {fileID: 11500000, guid: e86cb3236c9d4b645884699a4e35b904, type: 3}
45
+ m_Name:
46
+ m_EditorClassIdentifier:
47
+ registerService: 1
48
+ dontDestroyOnLoad: 0
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 8b7e079c7eb38154bb11841d42c4a5a2
3
+ PrefabImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "net.dreditor.localdialogues",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.7",
4
+ "displayName": "DREditor Local Dialogues",
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
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "author": {
15
+ "name": "Benjamin \"Sweden\" Jillson",
16
+ "email": "dreditortool@gmail.com",
17
+ "url": "https://dreditor.net"
18
+ },
19
+ "keywords": [
20
+ "editor",
21
+ "tool",
22
+ "dreditor"
23
+ ],
24
+ "samples": [
25
+ {
26
+ "displayName": "Samples",
27
+ "description": "",
28
+ "path": "Samples~"
29
+ }
30
+ ],
31
+ "documentationUrl": "https://dreditor.net",
32
+ "license": "Apache-2.0",
33
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
34
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html",
35
+ "repository": {
36
+ "url": "https://github.com/CertifiedSharp/DREditor",
37
+ "type": "git",
38
+ "revision": "14ca252fbb33eb6f53557ecaed1c10902877698f"
39
+ }
40
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: efcf64e52ec19ce449957f747be6d3ad
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.