From 4fef38cead2512ed268fc173f28ecff93a1dbd34 Mon Sep 17 00:00:00 2001 From: Ash Blue Date: Tue, 29 Dec 2020 11:37:06 -0700 Subject: [PATCH] feat(variables): added global database actions and conditions You can now create actions and conditions that persist across dialogue conversations. The database where these are stored can be saved and loaded from a string if needed. --- .../ExampleConversation.asset | 19 +- .../Actions/Libraries/Databases/Globals.meta | 3 + .../Libraries/Databases/Globals/Actions.meta | 3 + .../Globals/Actions/SetGlobalBool.cs | 16 + .../Globals/Actions/SetGlobalBool.cs.meta | 3 + .../Globals/Actions/SetGlobalFloat.cs | 16 + .../Globals/Actions/SetGlobalFloat.cs.meta | 3 + .../Databases/Globals/Actions/SetGlobalInt.cs | 16 + .../Globals/Actions/SetGlobalInt.cs.meta | 3 + .../Globals/Actions/SetGlobalString.cs | 16 + .../Globals/Actions/SetGlobalString.cs.meta | 3 + .../Databases/Globals/Conditions.meta | 3 + .../Globals/Conditions/IsGlobalBool.cs | 11 + .../Globals/Conditions/IsGlobalBool.cs.meta | 3 + .../Globals/Conditions/IsGlobalFloat.cs | 11 + .../Globals/Conditions/IsGlobalFloat.cs.meta | 3 + .../Globals/Conditions/IsGlobalInt.cs | 11 + .../Globals/Conditions/IsGlobalInt.cs.meta | 3 + .../Globals/Conditions/IsGlobalString.cs | 11 + .../Globals/Conditions/IsGlobalString.cs.meta | 3 + .../Locals/Conditions/IsLocalBool.meta | 3 + .../IsBoolBase.cs} | 13 +- .../Conditions/IsLocalBool/IsBoolBase.cs.meta | 3 + .../Conditions/IsLocalBool/IsLocalBool.cs | 10 + .../{ => IsLocalBool}/IsLocalBool.cs.meta | 0 .../Locals/Conditions/IsLocalFloat.meta | 3 + .../IsFloatBase.cs} | 12 +- .../IsLocalFloat/IsFloatBase.cs.meta | 3 + .../Conditions/IsLocalFloat/IsLocalFloat.cs | 10 + .../{ => IsLocalFloat}/IsLocalFloat.cs.meta | 0 .../Locals/Conditions/IsLocalInt.meta | 3 + .../IsIntBase.cs} | 13 +- .../Conditions/IsLocalInt/IsIntBase.cs.meta | 3 + .../Conditions/IsLocalInt/IsLocalInt.cs | 10 + .../{ => IsLocalInt}/IsLocalInt.cs.meta | 0 .../Locals/Conditions/IsLocalString.meta | 3 + .../Conditions/IsLocalString/IsLocalString.cs | 10 + .../{ => IsLocalString}/IsLocalString.cs.meta | 0 .../IsStringBase.cs} | 13 +- .../IsLocalString/IsStringBase.cs.meta | 3 + .../Runtime/com.fluid.dialogue.asmdef | 3 +- .../Databases/ConditionLocalBoolTest.cs | 4 +- .../Databases/ConditionLocalFloatTest.cs | 4 +- .../Databases/ConditionLocalIntTest.cs | 4 +- .../Databases/ConditionLocalStringTest.cs | 4 +- Packages/manifest.json | 17 +- Packages/packages-lock.json | 415 ++++++++++++++++++ ProjectSettings/PackageManagerSettings.asset | 54 +++ ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/VersionControlSettings.asset | 8 + README.md | 6 + UserSettings/EditorUserSettings.asset | Bin 0 -> 4156 bytes 52 files changed, 755 insertions(+), 43 deletions(-) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.meta rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{IsLocalBool.cs => IsLocalBool/IsBoolBase.cs} (80%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsLocalBool.cs rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{ => IsLocalBool}/IsLocalBool.cs.meta (100%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.meta rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{IsLocalFloat.cs => IsLocalFloat/IsFloatBase.cs} (82%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsLocalFloat.cs rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{ => IsLocalFloat}/IsLocalFloat.cs.meta (100%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.meta rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{IsLocalInt.cs => IsLocalInt/IsIntBase.cs} (81%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsLocalInt.cs rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{ => IsLocalInt}/IsLocalInt.cs.meta (100%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.meta create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsLocalString.cs rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{ => IsLocalString}/IsLocalString.cs.meta (100%) rename Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/{IsLocalString.cs => IsLocalString/IsStringBase.cs} (79%) create mode 100644 Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs.meta create mode 100644 Packages/packages-lock.json create mode 100644 ProjectSettings/PackageManagerSettings.asset create mode 100644 ProjectSettings/VersionControlSettings.asset create mode 100644 UserSettings/EditorUserSettings.asset diff --git a/Assets/Examples/BasicConversation/ExampleConversation.asset b/Assets/Examples/BasicConversation/ExampleConversation.asset index 1c9b45d..196fc9e 100644 --- a/Assets/Examples/BasicConversation/ExampleConversation.asset +++ b/Assets/Examples/BasicConversation/ExampleConversation.asset @@ -144,6 +144,22 @@ MonoBehaviour: choices: [] actor: {fileID: 11400000, guid: aebb863e25cae0a4495c09b6a617ecf6, type: 2} dialogue: They're doing fine. You've got bigger things to worry about. +--- !u!114 &-7021118909226780551 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc39c8b552b94c01a6ae86d4b8cce494, type: 3} + m_Name: SetGlobalBool + m_EditorClassIdentifier: + _title: SetGlobalBool humans asked + _uniqueId: 067fa933-713f-4ff1-860b-4051d4c9b040 + _value: 1 + _variable: {fileID: 11400000, guid: 1906dabbacd5b15429089da6c10fd23d, type: 2} --- !u!114 &-6868820908879997394 MonoBehaviour: m_ObjectHideFlags: 1 @@ -306,6 +322,7 @@ MonoBehaviour: conditions: [] enterActions: - {fileID: -4687762883489335130} + - {fileID: -7021118909226780551} exitActions: [] choices: [] actor: {fileID: 11400000, guid: d6a8e0fd1eb801d4ca00320f6b2e9e8b, type: 2} @@ -470,7 +487,7 @@ MonoBehaviour: - {fileID: -1221359623688907011} - {fileID: 3721123120546049034} root: {fileID: 426936237664981933} - scrollPosition: {x: 50450.676, y: 49996} + scrollPosition: {x: 50404.676, y: 50073} --- !u!114 &373158185418196577 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals.meta new file mode 100644 index 0000000..45513f2 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fb2b3174251248ad8844bb3b822d222b +timeCreated: 1609262703 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions.meta new file mode 100644 index 0000000..dbaa4f3 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 35d0c1ff12134c9e9480caa16d3b893e +timeCreated: 1609262790 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs new file mode 100644 index 0000000..6f90384 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs @@ -0,0 +1,16 @@ +using CleverCrow.Fluid.Databases; +using UnityEngine; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Globals/Set Bool")] + public class SetGlobalBool : SetLocalVariableBase { + [SerializeField] + public KeyValueDefinitionBool _variable; + + protected override KeyValueDefinitionBase Variable => _variable; + + protected override IKeyValueData GetDatabase (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Bools; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs.meta new file mode 100644 index 0000000..140eacf --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalBool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dc39c8b552b94c01a6ae86d4b8cce494 +timeCreated: 1609262759 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs new file mode 100644 index 0000000..8eaab54 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs @@ -0,0 +1,16 @@ +using CleverCrow.Fluid.Databases; +using UnityEngine; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Globals/Set Float")] + public class SetGlobalFloat : SetLocalVariableBase { + [SerializeField] + public KeyValueDefinitionFloat _variable; + + protected override KeyValueDefinitionBase Variable => _variable; + + protected override IKeyValueData GetDatabase (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Floats; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs.meta new file mode 100644 index 0000000..45ed662 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalFloat.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a69455b17de54650a8635283e7eaf328 +timeCreated: 1609262759 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs new file mode 100644 index 0000000..387f622 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs @@ -0,0 +1,16 @@ +using CleverCrow.Fluid.Databases; +using UnityEngine; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Globals/Set Int")] + public class SetGlobalInt : SetLocalVariableBase { + [SerializeField] + public KeyValueDefinitionInt _variable; + + protected override KeyValueDefinitionBase Variable => _variable; + + protected override IKeyValueData GetDatabase (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Ints; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs.meta new file mode 100644 index 0000000..2cf41e7 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalInt.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ddc85cb2034d4fbb87ac9531677c4ce4 +timeCreated: 1609262759 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs new file mode 100644 index 0000000..bcf42f9 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs @@ -0,0 +1,16 @@ +using CleverCrow.Fluid.Databases; +using UnityEngine; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Globals/Set String")] + public class SetGlobalString : SetLocalVariableBase { + [SerializeField] + public KeyValueDefinitionString _variable; + + protected override KeyValueDefinitionBase Variable => _variable; + + protected override IKeyValueData GetDatabase (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Strings; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs.meta new file mode 100644 index 0000000..6ef5157 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Actions/SetGlobalString.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 41def35ef7ec4ad7ab95a8df4a3ca85a +timeCreated: 1609262759 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions.meta new file mode 100644 index 0000000..df18017 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b7b6e150066c4d4b808c7b40a1ca125d +timeCreated: 1609263063 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs new file mode 100644 index 0000000..6c25754 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs @@ -0,0 +1,11 @@ +using CleverCrow.Fluid.Databases; +using CleverCrow.Fluid.Dialogues.Actions.Databases; + +namespace CleverCrow.Fluid.Dialogues.Conditions.Databases { + [CreateMenu("Database/Globals/Is Bool")] + public class IsGlobalBool : IsBoolBase { + protected override IKeyValueData GetBoolInstance (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Bools; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs.meta new file mode 100644 index 0000000..95f02a8 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalBool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a21642593dc640d08d902334f670b149 +timeCreated: 1609263100 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs new file mode 100644 index 0000000..cd0785f --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs @@ -0,0 +1,11 @@ +using CleverCrow.Fluid.Databases; +using CleverCrow.Fluid.Dialogues.Actions.Databases; + +namespace CleverCrow.Fluid.Dialogues.Conditions.Databases { + [CreateMenu("Database/Globals/Is Float")] + public class IsGlobalFloat : IsFloatBase { + protected override IKeyValueData GetFloatInstance (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Floats; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs.meta new file mode 100644 index 0000000..2c32f0f --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalFloat.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1a61e32b19da4eafab4cd1bf3f00b1d0 +timeCreated: 1609265273 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs new file mode 100644 index 0000000..ad32b4f --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs @@ -0,0 +1,11 @@ +using CleverCrow.Fluid.Databases; +using CleverCrow.Fluid.Dialogues.Actions.Databases; + +namespace CleverCrow.Fluid.Dialogues.Conditions.Databases { + [CreateMenu("Database/Globals/Is Int")] + public class IsGlobalInt : IsIntBase { + protected override IKeyValueData GetIntInstance (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Ints; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs.meta new file mode 100644 index 0000000..5aef5c3 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalInt.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c3b8de77378d4aab95e9a13438e66689 +timeCreated: 1609265223 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs new file mode 100644 index 0000000..bb80365 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs @@ -0,0 +1,11 @@ +using CleverCrow.Fluid.Databases; +using CleverCrow.Fluid.Dialogues.Actions.Databases; + +namespace CleverCrow.Fluid.Dialogues.Conditions.Databases { + [CreateMenu("Database/Globals/Is String")] + public class IsGlobalString : IsStringBase { + protected override IKeyValueData GetStringInstance (IDialogueController dialogue) { + return GlobalDatabaseManager.Instance.Database.Strings; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs.meta new file mode 100644 index 0000000..5d8b6e8 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Globals/Conditions/IsGlobalString.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 59c15c982b88481780c0df4b164b2119 +timeCreated: 1609265394 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.meta new file mode 100644 index 0000000..ababa65 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9ad7324121844d6191fe34899e5dc332 +timeCreated: 1609263218 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs similarity index 80% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.cs rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs index 4fbc9e2..8565f3e 100644 --- a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.cs +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs @@ -5,9 +5,8 @@ using UnityEngine; namespace CleverCrow.Fluid.Dialogues.Actions.Databases { - [CreateMenu("Database/Locals/Is Bool")] - public class IsLocalBool : ConditionDataBase { - private ConditionLocalBoolInternal _condition; + public abstract class IsBoolBase : ConditionDataBase { + private ConditionBoolInternal _condition; [SerializeField] private KeyValueDefinitionBool _variable = null; @@ -23,8 +22,10 @@ private enum Comparison { NotEqual } + protected abstract IKeyValueData GetBoolInstance (IDialogueController dialogue); + public override void OnInit (IDialogueController dialogue) { - _condition = new ConditionLocalBoolInternal(dialogue.LocalDatabase.Bools); + _condition = new ConditionBoolInternal(GetBoolInstance(dialogue)); } public override bool OnGetIsValid (INode parent) { @@ -39,10 +40,10 @@ public override bool OnGetIsValid (INode parent) { } } - public class ConditionLocalBoolInternal { + public class ConditionBoolInternal { private readonly IKeyValueData _database; - public ConditionLocalBoolInternal (IKeyValueData database) { + public ConditionBoolInternal (IKeyValueData database) { _database = database; } diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs.meta new file mode 100644 index 0000000..ab11b3b --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsBoolBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 61a8ec699cc043048888b83ea1fa8a76 +timeCreated: 1609263240 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsLocalBool.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsLocalBool.cs new file mode 100644 index 0000000..20ec97e --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsLocalBool.cs @@ -0,0 +1,10 @@ +using CleverCrow.Fluid.Databases; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Locals/Is Bool")] + public class IsLocalBool : IsBoolBase { + protected override IKeyValueData GetBoolInstance (IDialogueController dialogue) { + return dialogue.LocalDatabase.Bools; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsLocalBool.cs.meta similarity index 100% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool.cs.meta rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalBool/IsLocalBool.cs.meta diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.meta new file mode 100644 index 0000000..3442e0a --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c6458136a4df46e2b5f13866dfb98d96 +timeCreated: 1609264213 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs similarity index 82% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.cs rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs index 63a6374..8cd279f 100644 --- a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.cs +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs @@ -6,8 +6,8 @@ namespace CleverCrow.Fluid.Dialogues.Actions.Databases { [CreateMenu("Database/Locals/Is Float")] - public class ConditionLocalFloat : ConditionDataBase { - private ConditionLocalFloatInternal _condition; + public abstract class IsFloatBase : ConditionDataBase { + private ConditionFloatInternal _condition; [SerializeField] private KeyValueDefinitionFloat _variable = null; @@ -18,8 +18,10 @@ public class ConditionLocalFloat : ConditionDataBase { [SerializeField] private float _value = 0; + protected abstract IKeyValueData GetFloatInstance (IDialogueController dialogue); + public override void OnInit (IDialogueController dialogue) { - _condition = new ConditionLocalFloatInternal(dialogue.LocalDatabase.Floats); + _condition = new ConditionFloatInternal(GetFloatInstance(dialogue)); } public override bool OnGetIsValid (INode parent) { @@ -27,10 +29,10 @@ public override bool OnGetIsValid (INode parent) { } } - public class ConditionLocalFloatInternal { + public class ConditionFloatInternal { private readonly IKeyValueData _database; - public ConditionLocalFloatInternal (IKeyValueData database) { + public ConditionFloatInternal (IKeyValueData database) { _database = database; } diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs.meta new file mode 100644 index 0000000..d9a0517 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsFloatBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5bb41044534a4922a63918dbdd85c24e +timeCreated: 1609264264 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsLocalFloat.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsLocalFloat.cs new file mode 100644 index 0000000..b2cbd35 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsLocalFloat.cs @@ -0,0 +1,10 @@ +using CleverCrow.Fluid.Databases; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Locals/Is Float")] + public class ConditionLocalFloat : IsFloatBase { + protected override IKeyValueData GetFloatInstance (IDialogueController dialogue) { + return dialogue.LocalDatabase.Floats; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsLocalFloat.cs.meta similarity index 100% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat.cs.meta rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalFloat/IsLocalFloat.cs.meta diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.meta new file mode 100644 index 0000000..0d81343 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3c4306dea8d74be3ba28a126666bf9ba +timeCreated: 1609264598 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs similarity index 81% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.cs rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs index 4814eb4..bb3c36b 100644 --- a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.cs +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs @@ -5,9 +5,8 @@ using UnityEngine; namespace CleverCrow.Fluid.Dialogues.Actions.Databases { - [CreateMenu("Database/Locals/Is Int")] - public class IsLocalInt : ConditionDataBase { - private ConditionLocalIntInternal _condition; + public abstract class IsIntBase : ConditionDataBase { + private ConditionIntInternal _condition; [SerializeField] private KeyValueDefinitionInt _variable = null; @@ -18,8 +17,10 @@ public class IsLocalInt : ConditionDataBase { [SerializeField] private int _value = 0; + protected abstract IKeyValueData GetIntInstance (IDialogueController dialogue); + public override void OnInit (IDialogueController dialogue) { - _condition = new ConditionLocalIntInternal(dialogue.LocalDatabase.Ints); + _condition = new ConditionIntInternal(GetIntInstance(dialogue)); } public override bool OnGetIsValid (INode parent) { @@ -27,10 +28,10 @@ public override bool OnGetIsValid (INode parent) { } } - public class ConditionLocalIntInternal { + public class ConditionIntInternal { private readonly IKeyValueData _database; - public ConditionLocalIntInternal (IKeyValueData database) { + public ConditionIntInternal (IKeyValueData database) { _database = database; } diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs.meta new file mode 100644 index 0000000..ac1aca3 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsIntBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e889ebfec1f64a338f57cd21f1858583 +timeCreated: 1609264645 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsLocalInt.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsLocalInt.cs new file mode 100644 index 0000000..14efffd --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsLocalInt.cs @@ -0,0 +1,10 @@ +using CleverCrow.Fluid.Databases; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Locals/Is Int")] + public class IsLocalInt : IsIntBase { + protected override IKeyValueData GetIntInstance (IDialogueController dialogue) { + return dialogue.LocalDatabase.Ints; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsLocalInt.cs.meta similarity index 100% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt.cs.meta rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalInt/IsLocalInt.cs.meta diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.meta new file mode 100644 index 0000000..6a8af1b --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 140d7cdb799e46509046cc08c65ae702 +timeCreated: 1609264944 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsLocalString.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsLocalString.cs new file mode 100644 index 0000000..b6a5348 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsLocalString.cs @@ -0,0 +1,10 @@ +using CleverCrow.Fluid.Databases; + +namespace CleverCrow.Fluid.Dialogues.Actions.Databases { + [CreateMenu("Database/Locals/Is String")] + public class IsLocalString : IsStringBase { + protected override IKeyValueData GetStringInstance (IDialogueController dialogue) { + return dialogue.LocalDatabase.Strings; + } + } +} diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsLocalString.cs.meta similarity index 100% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.cs.meta rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsLocalString.cs.meta diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.cs b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs similarity index 79% rename from Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.cs rename to Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs index 9a58ae8..c97bef1 100644 --- a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString.cs +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs @@ -5,9 +5,8 @@ using UnityEngine; namespace CleverCrow.Fluid.Dialogues.Actions.Databases { - [CreateMenu("Database/Locals/Is String")] - public class IsLocalString : ConditionDataBase { - private ConditionLocalStringInternal _condition; + public abstract class IsStringBase : ConditionDataBase { + private ConditionStringInternal _condition; [SerializeField] private KeyValueDefinitionString _variable = null; @@ -23,8 +22,10 @@ private enum Comparison { NotEqual } + protected abstract IKeyValueData GetStringInstance (IDialogueController dialogue); + public override void OnInit (IDialogueController dialogue) { - _condition = new ConditionLocalStringInternal(dialogue.LocalDatabase.Strings); + _condition = new ConditionStringInternal(GetStringInstance(dialogue)); } public override bool OnGetIsValid (INode parent) { @@ -39,10 +40,10 @@ public override bool OnGetIsValid (INode parent) { } } - public class ConditionLocalStringInternal { + public class ConditionStringInternal { private readonly IKeyValueData _database; - public ConditionLocalStringInternal (IKeyValueData database) { + public ConditionStringInternal (IKeyValueData database) { _database = database; } diff --git a/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs.meta b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs.meta new file mode 100644 index 0000000..7e84ba8 --- /dev/null +++ b/Assets/com.fluid.dialogue/Runtime/Actions/Libraries/Databases/Locals/Conditions/IsLocalString/IsStringBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 05b9854c79cb4a709cc82573f2fc46be +timeCreated: 1609264965 \ No newline at end of file diff --git a/Assets/com.fluid.dialogue/Runtime/com.fluid.dialogue.asmdef b/Assets/com.fluid.dialogue/Runtime/com.fluid.dialogue.asmdef index ca93dd4..92d317f 100644 --- a/Assets/com.fluid.dialogue/Runtime/com.fluid.dialogue.asmdef +++ b/Assets/com.fluid.dialogue/Runtime/com.fluid.dialogue.asmdef @@ -2,7 +2,8 @@ "name": "com.fluid.dialogue", "references": [ "com.fluid.database", - "com.fluid.unity-event-plus" + "com.fluid.unity-event-plus", + "com.fluid.simple-singleton" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalBoolTest.cs b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalBoolTest.cs index 0112eb2..047b173 100644 --- a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalBoolTest.cs +++ b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalBoolTest.cs @@ -4,7 +4,7 @@ namespace CleverCrow.Fluid.Dialogues.Actions.Databases { public class ConditionLocalBoolTest { - private ConditionLocalBoolInternal _boolCondition; + private ConditionBoolInternal _boolCondition; private IKeyValueDefinition _definition; private IKeyValueData _database; @@ -12,7 +12,7 @@ public class ConditionLocalBoolTest { public void BeforeEach () { _definition = Substitute.For>(); _database = Substitute.For>(); - _boolCondition = new ConditionLocalBoolInternal(_database); + _boolCondition = new ConditionBoolInternal(_database); _database.Get(null).ReturnsForAnyArgs(true); } diff --git a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalFloatTest.cs b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalFloatTest.cs index c49c8af..444c00e 100644 --- a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalFloatTest.cs +++ b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalFloatTest.cs @@ -4,7 +4,7 @@ namespace CleverCrow.Fluid.Dialogues.Actions.Databases { public class ConditionLocalFloatTest { - private ConditionLocalFloatInternal _condition; + private ConditionFloatInternal _condition; private IKeyValueDefinition _definition; private IKeyValueData _database; @@ -12,7 +12,7 @@ public class ConditionLocalFloatTest { public void BeforeEach () { _definition = Substitute.For>(); _database = Substitute.For>(); - _condition = new ConditionLocalFloatInternal(_database); + _condition = new ConditionFloatInternal(_database); _database.Get(null).ReturnsForAnyArgs(0); } diff --git a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalIntTest.cs b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalIntTest.cs index 80f4d15..4b6cbef 100644 --- a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalIntTest.cs +++ b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalIntTest.cs @@ -4,7 +4,7 @@ namespace CleverCrow.Fluid.Dialogues.Actions.Databases { public class ConditionLocalIntTest { - private ConditionLocalIntInternal _condition; + private ConditionIntInternal _condition; private IKeyValueDefinition _definition; private IKeyValueData _database; @@ -12,7 +12,7 @@ public class ConditionLocalIntTest { public void BeforeEach () { _definition = Substitute.For>(); _database = Substitute.For>(); - _condition = new ConditionLocalIntInternal(_database); + _condition = new ConditionIntInternal(_database); _database.Get(null).ReturnsForAnyArgs(0); } diff --git a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalStringTest.cs b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalStringTest.cs index 462a329..a1126d8 100644 --- a/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalStringTest.cs +++ b/Assets/com.fluid.dialogue/Tests/Editor/Actions/Databases/ConditionLocalStringTest.cs @@ -6,7 +6,7 @@ namespace CleverCrow.Fluid.Dialogues.Actions.Databases { public class ConditionLocalStringTest { private const string VALUE = "a"; - private ConditionLocalStringInternal _condition; + private ConditionStringInternal _condition; private IKeyValueDefinition _definition; private IKeyValueData _database; @@ -14,7 +14,7 @@ public class ConditionLocalStringTest { public void BeforeEach () { _definition = Substitute.For>(); _database = Substitute.For>(); - _condition = new ConditionLocalStringInternal(_database); + _condition = new ConditionStringInternal(_database); _database.Get(null).ReturnsForAnyArgs(VALUE); } diff --git a/Packages/manifest.json b/Packages/manifest.json index 4b76d5a..edad3b5 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -17,15 +17,16 @@ "com.fluid.unity-event-plus": "1.1.0", "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", - "com.unity.ads": "3.4.4", - "com.unity.analytics": "3.3.5", - "com.unity.collab-proxy": "1.2.16", - "com.unity.ext.nunit": "1.0.0", + "com.unity.ads": "3.5.2", + "com.unity.analytics": "3.5.3", + "com.unity.collab-proxy": "1.3.9", + "com.unity.ext.nunit": "1.0.5", "com.unity.ide.rider": "1.2.1", - "com.unity.ide.vscode": "1.2.0", - "com.unity.purchasing": "2.0.6", - "com.unity.test-framework": "1.1.13", - "com.unity.textmeshpro": "2.0.1", + "com.unity.ide.visualstudio": "2.0.5", + "com.unity.ide.vscode": "1.2.3", + "com.unity.purchasing": "2.2.1", + "com.unity.test-framework": "1.1.19", + "com.unity.textmeshpro": "3.0.1", "com.unity.timeline": "1.2.10", "com.unity.ugui": "1.0.0", "com.unity.modules.ai": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json new file mode 100644 index 0000000..ce8d332 --- /dev/null +++ b/Packages/packages-lock.json @@ -0,0 +1,415 @@ +{ + "dependencies": { + "clever-crow.nsubstitute": { + "version": "2.0.3", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://registry.npmjs.org" + }, + "com.fluid.database": { + "version": "2.0.0", + "depth": 0, + "source": "registry", + "dependencies": { + "com.fluid.simple-singleton": "1.0.0", + "com.fluid.unity-event-plus": "1.0.0" + }, + "url": "https://registry.npmjs.org" + }, + "com.fluid.find-and-replace": { + "version": "1.0.1", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://registry.npmjs.org" + }, + "com.fluid.simple-singleton": { + "version": "1.0.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://registry.npmjs.org" + }, + "com.fluid.simple-spellcheck": { + "version": "1.1.0", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://registry.npmjs.org" + }, + "com.fluid.unity-event-plus": { + "version": "1.1.0", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://registry.npmjs.org" + }, + "com.unity.2d.sprite": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.2d.tilemap": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.ads": { + "version": "3.5.2", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.analytics": { + "version": "3.5.3", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.collab-proxy": { + "version": "1.3.9", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ext.nunit": { + "version": "1.0.5", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ide.rider": { + "version": "1.2.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.1" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ide.visualstudio": { + "version": "2.0.5", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ide.vscode": { + "version": "1.2.3", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.purchasing": { + "version": "2.2.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.test-framework": { + "version": "1.1.19", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.5", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.textmeshpro": { + "version": "3.0.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.timeline": { + "version": "1.2.10", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ugui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0" + } + }, + "com.unity.modules.ai": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.animation": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.assetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.audio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.cloth": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.director": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.animation": "1.0.0" + } + }, + "com.unity.modules.imageconversion": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imgui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.jsonserialize": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.particlesystem": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.subsystems": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.terrain": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.terrainphysics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.terrain": "1.0.0" + } + }, + "com.unity.modules.tilemap": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics2d": "1.0.0" + } + }, + "com.unity.modules.ui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.uielements": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.uielementsnative": "1.0.0" + } + }, + "com.unity.modules.uielementsnative": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.umbra": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unityanalytics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequestassetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestaudio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.audio": "1.0.0" + } + }, + "com.unity.modules.unitywebrequesttexture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestwww": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.vehicles": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.video": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.vr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } + }, + "com.unity.modules.wind": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.xr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.subsystems": "1.0.0" + } + } + } +} diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset new file mode 100644 index 0000000..1dd8945 --- /dev/null +++ b/ProjectSettings/PackageManagerSettings.asset @@ -0,0 +1,54 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_EnablePreviewPackages: 0 + m_EnablePackageDependencies: 0 + m_AdvancedSettingsExpanded: 1 + m_ScopedRegistriesSettingsExpanded: 1 + oneTimeWarningShown: 0 + m_Registries: + - m_Id: main + m_Name: + m_Url: https://packages.unity.com + m_Scopes: [] + m_IsDefault: 1 + m_Capabilities: 7 + - m_Id: scoped:NPM + m_Name: NPM + m_Url: https://registry.npmjs.org + m_Scopes: + - clever-crow + - com.fluid + m_IsDefault: 0 + m_Capabilities: 0 + m_UserSelectedRegistryName: + m_UserAddingNewScopedRegistry: 0 + m_RegistryInfoDraft: + m_ErrorMessage: + m_Original: + m_Id: scoped:NPM + m_Name: NPM + m_Url: https://registry.npmjs.org + m_Scopes: + - clever-crow + - com.fluid + m_IsDefault: 0 + m_Capabilities: 0 + m_Modified: 0 + m_Name: NPM + m_Url: https://registry.npmjs.org + m_Scopes: + - clever-crow + - com.fluid + m_SelectedScopeIndex: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index beea0cc..1a985d9 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.3.13f1 -m_EditorVersionWithRevision: 2019.3.13f1 (d4ddf0d95db9) +m_EditorVersion: 2020.1.17f1 +m_EditorVersionWithRevision: 2020.1.17f1 (9957aee8edc2) diff --git a/ProjectSettings/VersionControlSettings.asset b/ProjectSettings/VersionControlSettings.asset new file mode 100644 index 0000000..dca2881 --- /dev/null +++ b/ProjectSettings/VersionControlSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!890905787 &1 +VersionControlSettings: + m_ObjectHideFlags: 0 + m_Mode: Visible Meta Files + m_CollabEditorSettings: + inProgressEnabled: 1 diff --git a/README.md b/README.md index 36df0c6..497d4ee 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,12 @@ To create a local variable and use it do the following. To use the variable simply select a node on the graph. Then click the plus sign on a condition (variable checks) or action (change variable value) in the inspector. Please note you must assign the variable you just created to use it. +### Global Variables + +Globals are mostly the same as local variables. The difference is these will be saved to a global database that persists after the conversation is over and can be referenced across multiple conversations. + +The GlobalDatabaseManager will be marked DoNotDestroyOnLoad to persist between scene loads. If you want to save it and write the contents to a file run `Save()` to return a string. You can then restore the database simply by calling `Load(returned save string)`. + ### Examples To see the entire Fluid Dialogue workflow, it's highly recommended that you download this repo and run projects in the `Assets/Examples` folder. diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset new file mode 100644 index 0000000000000000000000000000000000000000..ef7aa4fc61e07386e183f0e254f0cb8d7fcd26bd GIT binary patch literal 4156 zcmeH~J&)5s5Qb-yIDzBq_%0}Ds87y`J3vC{A_Jnx>4c)Y3JIBb;~4w_iIa$KY3Zq` zpx_5kAn{XZ5E3Oqf{FqOGw<3awxat5>_|Ji`#v+fquHb|QS&>|`b{D_%QH_zn|Alc zMt5U-)TKXJmI=YyTYxP4_4UigPp`y_-`{>%>x*acMOHuXXaTcbBT}4_>5bA}J3)fp zHA%e}q!5cEF-imf$+=tu-;!kw00ozupoZwOf&t!yta1h~s7aq$xx{zie2l7rUv7|k z%rVHf0M#-=aK=5(eO>VO3b$(acbJQvYJR(R{}J#d=5?Fy^Vzr``q35MqARSeaSf<% z4Y>*~H$j%JZ@X-1z)jeaBg@*Vn1lcLKb~#U!XxtMB9rxAgm6XT8Pa6pyOm z{rX(dEf#TZ{zF(!SOq(8uIb}a~4tGxhmv!dHzeiCOUrz ze^c-a;5%@+-SL7nne0#HWFXTti2W%=51k|)1^z#wwxzin&LoXOSBD-ry;+(>ZW;`G zp2xWd&TaW<<~vDL*+dnxH%pleWaP%2v@0jR+)X^GqX*+;an}t(={aLLe3Ix;z9I~h zMQ{2%9_~N&+*In9;QFf%jX%0E(*e@~(*e@~(*e@~(*e@~(*e_g|F;9>2itr&7`qec e^%K7@=Q6}cr0s3VtF}F|x3_F`2(kD$$NU#YcdOh0 literal 0 HcmV?d00001