Merge branch 'master' into melania-dev

This commit is contained in:
KrolMel 2022-12-28 16:25:20 +01:00
commit 7db7398c75
17 changed files with 315 additions and 7 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 77538b394f3653943bc955ddb93e2ed8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1bc3b672ed5019c48bc9a34a87ed6cbd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb5fdb3dab03f214f8d42a768386080f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ba3b3d96e374b774fa88c776b9afb722
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cfe1904bdcdf3b8458d42a60de6f651b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9696f03c8b09aaa47b9a8fe810886ea3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 559510452293fc14fbb62bc81c1215d0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e7e61c7699f031459445f137e26c6d1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 15bb2a71d85a9b842ae95ec90021f13f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -32,6 +32,7 @@ public class Dialogue : ScriptableObject, IDialogue
} }
public void SetActionAfterDialogueStep(int dialogueStepNo, Action _finishDialogueAction) public void SetActionAfterDialogueStep(int dialogueStepNo, Action _finishDialogueAction)
{ {
Debug.Log(dialogueStepNo);
if (DialogueSteps.Count >= dialogueStepNo) if (DialogueSteps.Count >= dialogueStepNo)
DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_finishDialogueAction); DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_finishDialogueAction);
} }
@ -130,6 +131,11 @@ public class Dialogue : ScriptableObject, IDialogue
} }
} }
public void BuildDialogue()
{
BuildDialogue(DialogueSteps);
}
/// <summary> /// <summary>
/// Function to reset rememebered dialogue status /// Function to reset rememebered dialogue status
/// ///

View File

@ -38,7 +38,63 @@ public class DialogueManager : MonoBehaviour
public virtual void Start() public virtual void Start()
{ {
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage()); 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.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) public virtual void OnTriggerExit2D(Collider2D collision)
{ {
// don't listen when component is disabled // don't listen when component is disabled
if (ComponentEnabledCondition()) if (ComponentEnabledCondition() || !OpenInDefaultWay)
return; return;
if (collision.gameObject.tag == "Player") if (collision.gameObject.tag == "Player")
@ -121,12 +177,14 @@ public class DialogueManager : MonoBehaviour
Debug.Log(Dialogue); Debug.Log(Dialogue);
var multiDialStatius = Dialogue.DialogueStepStatus(); var multiDialStatius = Dialogue.DialogueStepStatus();
Debug.Log(multiDialStatius); Debug.Log(multiDialStatius);
Debug.Log(Dialogue Debug.Log(Dialogue
.Dialogues .Dialogues
.Where(dialogue => dialogue.Key == multiDialStatius.Item1) .Where(dialogue => dialogue.Key == multiDialStatius.Item1)
.First() .First()
.Value .Value
.DialogueSteps); .DialogueSteps);
return Dialogue return Dialogue
.Dialogues .Dialogues
.Where(dialogue => dialogue.Key == multiDialStatius.Item1) .Where(dialogue => dialogue.Key == multiDialStatius.Item1)
@ -136,5 +194,22 @@ public class DialogueManager : MonoBehaviour
.ElementAtOrDefault(multiDialStatius.Item2) .ElementAtOrDefault(multiDialStatius.Item2)
?.DialogueController.CurrentPanel != null; ?.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)
;
}
}
} }

View File

@ -108,14 +108,16 @@ public class MultiDialogue : ScriptableObject, IDialogue
/// <param name="dialogueNumber"></param> /// <param name="dialogueNumber"></param>
public void SetNextDialogue(int dialogueNumber) public void SetNextDialogue(int dialogueNumber)
{ {
Debug.Log("----------------- SetNextDialogue");
Debug.Log(dialogueNumber);
if (Dialogues.Where(el => el.Key == dialogueNumber).ToArray().Count() == 0) if (Dialogues.Where(el => el.Key == dialogueNumber).ToArray().Count() == 0)
return; return;
// 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped
GoToNextSentence();
// 2. Chane index // 2. Chane index
CurrentDialogue = dialogueNumber; CurrentDialogue = dialogueNumber;
// 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped
GoToNextSentence();
} }
/// <summary> /// <summary>
@ -134,9 +136,8 @@ public class MultiDialogue : ScriptableObject, IDialogue
StartDialogue(); StartDialogue();
} }
/// <summary> // MUST BE IMPLEMENTED - INTERFACE RULES
/// Build each step of dialogue // USELESS IN THIS FILE
/// </summary>
public void BuildDialogue(List<DialogueStepModel> Dialogue) public void BuildDialogue(List<DialogueStepModel> Dialogue)
{ {
foreach (var dialogueStep in Dialogue) foreach (var dialogueStep in Dialogue)
@ -147,6 +148,21 @@ public class MultiDialogue : ScriptableObject, IDialogue
} }
} }
/// <summary>
/// Build each step of dialogue
/// </summary>
public void BuildDialogue(Dialogue Dialogue)
{
Dialogue.SetSpeakerName(SpeakerName);
Dialogue.BuildDialogue();
}
public void BuildCurrentDialogue()
{
BuildDialogue(Dialogues.Where(dial => dial.Key == CurrentDialogue).ToArray().First().Value);
}
/// <summary> /// <summary>
/// Function to reset rememebered dialogue status /// Function to reset rememebered dialogue status
/// ///