diff --git a/Assets/Resources/Dialogue/NPCs.meta b/Assets/Resources/Dialogue/NPCs.meta new file mode 100644 index 00000000..15fe57a7 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77538b394f3653943bc955ddb93e2ed8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed.meta b/Assets/Resources/Dialogue/NPCs/NonNamed.meta new file mode 100644 index 00000000..1ba7d75e --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1bc3b672ed5019c48bc9a34a87ed6cbd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG.meta new file mode 100644 index 00000000..bd8a1def --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb5fdb3dab03f214f8d42a768386080f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG 1.asset b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG 1.asset new file mode 100644 index 00000000..808a152e --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG 1.asset @@ -0,0 +1,25 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + 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: 06201cadd951bcc4db5fccaa01783060, type: 3} + m_Name: BarryDialENG 1 + m_EditorClassIdentifier: + SpeakerName: + CurrentStep: 0 + DialogueSteps: + - Header: Barry + WasDisplayed: 0 + ListOfSentences: + - Sentence: Nice + Buttons: [] + EndOfDialogueStepAction: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG 1.asset.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG 1.asset.meta new file mode 100644 index 00000000..7571d8c1 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG 1.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ba3b3d96e374b774fa88c776b9afb722 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG.asset b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG.asset new file mode 100644 index 00000000..e2802fb8 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG.asset @@ -0,0 +1,59 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + 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: 06201cadd951bcc4db5fccaa01783060, type: 3} + m_Name: BarryDialENG + m_EditorClassIdentifier: + SpeakerName: ThePlayer(Clone) + CurrentStep: 0 + DialogueSteps: + - Header: ThePlayer(Clone) + WasDisplayed: 0 + ListOfSentences: + - Sentence: Hiya, do you have any spare change? Friend? + Buttons: + - ButtonName: Can't do, you drunk. + Type: 1 + ButtonActions: + m_PersistentCalls: + m_Calls: [] + - ButtonName: Sure thing friend. + Type: 1 + ButtonActions: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11400000} + m_TargetAssemblyTypeName: Dialogue, Assembly-CSharp + m_MethodName: GoToNextSentence + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + EndOfDialogueStepAction: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11400000, guid: 9696f03c8b09aaa47b9a8fe810886ea3, type: 2} + m_TargetAssemblyTypeName: MultiDialogue, Assembly-CSharp + m_MethodName: GoToNextDialogue + m_Mode: 3 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 1 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG.asset.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG.asset.meta new file mode 100644 index 00000000..1861d1eb --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryDialENG.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cfe1904bdcdf3b8458d42a60de6f651b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryMultiDialENG.asset b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryMultiDialENG.asset new file mode 100644 index 00000000..de137c1b --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryMultiDialENG.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + 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: 45b41589283138641ba006c2243b0637, type: 3} + m_Name: BarryMultiDialENG + m_EditorClassIdentifier: + SpeakerName: + CurrentDialogue: 0 + Dialogues: + - Key: 0 + Value: {fileID: 11400000, guid: cfe1904bdcdf3b8458d42a60de6f651b, type: 2} + - Key: 1 + Value: {fileID: 11400000, guid: ba3b3d96e374b774fa88c776b9afb722, type: 2} diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryMultiDialENG.asset.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryMultiDialENG.asset.meta new file mode 100644 index 00000000..a966b322 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/ENG/BarryMultiDialENG.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9696f03c8b09aaa47b9a8fe810886ea3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/PL.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/PL.meta new file mode 100644 index 00000000..04fb0043 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/PL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 559510452293fc14fbb62bc81c1215d0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryDialPL.asset b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryDialPL.asset new file mode 100644 index 00000000..0888de82 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryDialPL.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + 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: 06201cadd951bcc4db5fccaa01783060, type: 3} + m_Name: BarryDialPL + m_EditorClassIdentifier: + SpeakerName: + CurrentStep: 0 + DialogueSteps: [] diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryDialPL.asset.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryDialPL.asset.meta new file mode 100644 index 00000000..7f49222a --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryDialPL.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e7e61c7699f031459445f137e26c6d1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryMultiDialPL.asset b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryMultiDialPL.asset new file mode 100644 index 00000000..266a8b8a --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryMultiDialPL.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + 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: 45b41589283138641ba006c2243b0637, type: 3} + m_Name: BarryMultiDialPL + m_EditorClassIdentifier: + SpeakerName: + CurrentDialogue: 0 + Dialogues: [] diff --git a/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryMultiDialPL.asset.meta b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryMultiDialPL.asset.meta new file mode 100644 index 00000000..f4ee79e7 --- /dev/null +++ b/Assets/Resources/Dialogue/NPCs/NonNamed/PL/BarryMultiDialPL.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 15bb2a71d85a9b842ae95ec90021f13f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/REFACTORING/Application/Dialogue/Dialogue.cs b/Assets/Scripts/REFACTORING/Application/Dialogue/Dialogue.cs index 6407785f..f3a148c4 100644 --- a/Assets/Scripts/REFACTORING/Application/Dialogue/Dialogue.cs +++ b/Assets/Scripts/REFACTORING/Application/Dialogue/Dialogue.cs @@ -32,6 +32,7 @@ public class Dialogue : ScriptableObject, IDialogue } public void SetActionAfterDialogueStep(int dialogueStepNo, Action _finishDialogueAction) { + Debug.Log(dialogueStepNo); if (DialogueSteps.Count >= dialogueStepNo) DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_finishDialogueAction); } @@ -130,6 +131,11 @@ public class Dialogue : ScriptableObject, IDialogue } } + public void BuildDialogue() + { + BuildDialogue(DialogueSteps); + } + /// /// Function to reset rememebered dialogue status /// diff --git a/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs b/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs index 81a59a8b..d178060c 100644 --- a/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs +++ b/Assets/Scripts/REFACTORING/Application/Dialogue/Manager/DialogueManager.cs @@ -38,7 +38,63 @@ public class DialogueManager : MonoBehaviour public virtual void Start() { Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage()); + // Bind setted actions + BindEndActionsToDialogues(); + + // Add one more action Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterDialogueStep(dial.Key, dial.Value.ResetDialogue)); // reset dial + + Dialogue.BuildCurrentDialogue(); + + /*Debug.Log(Dialogue.DialogueStepStatus()); + Debug.Log(Dialogue + .Dialogues + .Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1) + .First() + .Value); + + Debug.Log( + Dialogue + .Dialogues + .Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1) + .First() + .Value + .DialogueSteps.Count()); + + Debug.Log( + Dialogue + .Dialogues + .Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1) + .First() + .Value + .DialogueSteps + .ElementAtOrDefault(Dialogue.DialogueStepStatus().Item2) + ); + + Debug.Log( + Dialogue + .Dialogues + .Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1) + .First() + .Value + .DialogueSteps + .ElementAtOrDefault(Dialogue.DialogueStepStatus().Item2) + .DialogueController + ); + + Debug.Log( + Dialogue + .Dialogues + .Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1) + .First() + .Value + .DialogueSteps + .ElementAtOrDefault(Dialogue.DialogueStepStatus().Item2) + .DialogueController + .listOfDialogue.Count() +); + + Debug.Log(GetCurrentDialoguePanelStatus());*/ } @@ -67,7 +123,7 @@ public class DialogueManager : MonoBehaviour public virtual void OnTriggerExit2D(Collider2D collision) { // don't listen when component is disabled - if (ComponentEnabledCondition()) + if (ComponentEnabledCondition() || !OpenInDefaultWay) return; if (collision.gameObject.tag == "Player") @@ -118,8 +174,9 @@ public class DialogueManager : MonoBehaviour /// public bool GetCurrentDialoguePanelStatus() { + Debug.Log(Dialogue); var multiDialStatius = Dialogue.DialogueStepStatus(); - + Debug.Log(multiDialStatius); return Dialogue .Dialogues .Where(dialogue => dialogue.Key == multiDialStatius.Item1) @@ -129,5 +186,22 @@ public class DialogueManager : MonoBehaviour .ElementAtOrDefault(multiDialStatius.Item2) ?.DialogueController.CurrentPanel != null; } + + public void BindEndActionsToDialogues() + { + foreach(var finalAction in EndactionEventList) + { + // finalAction.Key.Key | .Value/ + Dialogue + .Dialogues + .Where(dial => dial.Key == finalAction.Key.Key) + .FirstOrDefault() + .Value + .DialogueSteps + .ElementAtOrDefault(finalAction.Key.Value) + .SetActionAfterDialogueStep(finalAction.Value) + ; + } + } } diff --git a/Assets/Scripts/REFACTORING/Application/Dialogue/MultiDialogue.cs b/Assets/Scripts/REFACTORING/Application/Dialogue/MultiDialogue.cs index 46468523..680f77aa 100644 --- a/Assets/Scripts/REFACTORING/Application/Dialogue/MultiDialogue.cs +++ b/Assets/Scripts/REFACTORING/Application/Dialogue/MultiDialogue.cs @@ -108,14 +108,16 @@ public class MultiDialogue : ScriptableObject, IDialogue /// public void SetNextDialogue(int dialogueNumber) { + Debug.Log("----------------- SetNextDialogue"); + Debug.Log(dialogueNumber); if (Dialogues.Where(el => el.Key == dialogueNumber).ToArray().Count() == 0) return; - // 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped - GoToNextSentence(); - // 2. Chane index CurrentDialogue = dialogueNumber; + + // 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped + GoToNextSentence(); } /// @@ -134,9 +136,8 @@ public class MultiDialogue : ScriptableObject, IDialogue StartDialogue(); } - /// - /// Build each step of dialogue - /// + // MUST BE IMPLEMENTED - INTERFACE RULES + // USELESS IN THIS FILE public void BuildDialogue(List Dialogue) { foreach (var dialogueStep in Dialogue) @@ -147,6 +148,21 @@ public class MultiDialogue : ScriptableObject, IDialogue } } + + /// + /// Build each step of dialogue + /// + public void BuildDialogue(Dialogue Dialogue) + { + Dialogue.SetSpeakerName(SpeakerName); + Dialogue.BuildDialogue(); + } + + public void BuildCurrentDialogue() + { + BuildDialogue(Dialogues.Where(dial => dial.Key == CurrentDialogue).ToArray().First().Value); + } + /// /// Function to reset rememebered dialogue status ///