diff --git a/Assets/Resources/SampleScene/Enemies/BossThug.prefab b/Assets/Resources/SampleScene/Enemies/BossThug.prefab
index 20c79f3b..41763f30 100644
--- a/Assets/Resources/SampleScene/Enemies/BossThug.prefab
+++ b/Assets/Resources/SampleScene/Enemies/BossThug.prefab
@@ -188,6 +188,141 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
+ CurrentDialogue: 0
+ MultiWayDialogue:
+ - Key: 0
+ Value:
+ - WasDisplayed: 0
+ ListOfSentences:
+ - Sentence: test
+ Buttons: []
+ - Sentence: test 1.1
+ Buttons:
+ - ButtonName: Ok
+ Type: 1
+ ButtonActions:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 5064228440392526989}
+ m_TargetAssemblyTypeName: NpcDialogueManager, Assembly-CSharp
+ m_MethodName: GoToNextSentence
+ m_Mode: 1
+ 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
+ Rewards: []
+ EndOfDialogueStepAction:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 5064228440392526989}
+ m_TargetAssemblyTypeName: NpcDialogueManager, Assembly-CSharp
+ m_MethodName: TestEndAction
+ 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
+ - WasDisplayed: 0
+ ListOfSentences:
+ - Sentence: test 1.2
+ Buttons: []
+ - Sentence: test 1.2.3
+ Buttons:
+ - ButtonName: way 1.2
+ Type: 1
+ ButtonActions:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 5064228440392526989}
+ m_TargetAssemblyTypeName: NpcDialogueManager, Assembly-CSharp
+ m_MethodName: SetNextDialogue
+ 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
+ Rewards: []
+ EndOfDialogueStepAction:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 482428332992622001}
+ m_TargetAssemblyTypeName: BossThug, Assembly-CSharp
+ m_MethodName: BreakConversation
+ 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
+ - Key: 1
+ Value:
+ - WasDisplayed: 0
+ ListOfSentences:
+ - Sentence: test 2
+ Buttons:
+ - ButtonName: test 2.1 ans
+ Type: 1
+ ButtonActions:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 5064228440392526989}
+ m_TargetAssemblyTypeName: NpcDialogueManager, 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
+ - Sentence: test 2.1
+ Buttons: []
+ Rewards: []
+ EndOfDialogueStepAction:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 482428332992622001}
+ m_TargetAssemblyTypeName: BossThug, Assembly-CSharp
+ m_MethodName: ChanegStatusToAttack
+ 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
+ - m_Target: {fileID: 482428332992622001}
+ m_TargetAssemblyTypeName: BossThug, Assembly-CSharp
+ m_MethodName: SetEndConversation
+ 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
--- !u!114 &482428332992622006
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -245,7 +380,8 @@ MonoBehaviour:
animator: {fileID: 0}
newController: {fileID: 0}
isAfterConversation: 0
- state: 0
+ isDuringConversation: 0
+ state: 1
--- !u!95 &-4365747932373452915
Animator:
serializedVersion: 3
diff --git a/Assets/Scripts/Domain/Dialogue/DialogueController.cs b/Assets/Scripts/Domain/Dialogue/DialogueController.cs
index 20ee95e9..0a2c9e06 100644
--- a/Assets/Scripts/Domain/Dialogue/DialogueController.cs
+++ b/Assets/Scripts/Domain/Dialogue/DialogueController.cs
@@ -50,18 +50,27 @@ public class DialogueController
{
Panel panelDis = panelModel.Panel("Kabix", panelModel);
panelDis.PanelInstance = panelDis.BuildPanel();
- panelDis.SetContinueButtonAction(ShowNextPanel, this);
+
+ if(!(panelDis is QuestionPanel))
+ panelDis.SetContinueButtonAction(ShowNextPanel, this);
CurrentPanel = panelDis.PanelInstance;
}
-
- private void ShowNextPanel(DialogueController parentDialController)
+ ///
+ /// Return false if there was no more 'sentences' in current 'step'
+ ///
+ ///
+ ///
+ public bool ShowNextPanel(DialogueController parentDialController)
{
+ Debug.Log(listOfDialogue.Count);
if (listOfDialogue.Count == 0)
{
- MonoBehaviour.Destroy(parentDialController.CurrentPanel);
+ CloseCurrentPanel(parentDialController);
FinishDialogue();
+
+ return false;
}
else
{
@@ -71,6 +80,18 @@ public class DialogueController
Show(nextPanel);
}
+
+ return true;
+ }
+
+ public void CloseCurrentPanel(DialogueController parentDialController)
+ {
+ MonoBehaviour.Destroy(parentDialController.CurrentPanel);
+ }
+
+ public void CloseCurrentPanel()
+ {
+ MonoBehaviour.Destroy(CurrentPanel);
}
// if palyer click last dialogue panel's "continue" button then ShowNextPanel
diff --git a/Assets/Scripts/Domain/DialoguePanel/Factory/PanelComponentFactory.cs b/Assets/Scripts/Domain/DialoguePanel/Factory/PanelComponentFactory.cs
index 3f25c35b..b5d436d0 100644
--- a/Assets/Scripts/Domain/DialoguePanel/Factory/PanelComponentFactory.cs
+++ b/Assets/Scripts/Domain/DialoguePanel/Factory/PanelComponentFactory.cs
@@ -10,7 +10,7 @@ public static class PanelComponentFactory
///
///
///
- public static GameObject BuildCustomPanel(Vector3 position, Vector2 size, Vector3 scale)
+ public static GameObject BuildCustomPanel(Vector3 position, Vector2 size, Vector3 scale, bool withContinue = true)
{
var panel = DialoguePanelsPrefabsList.GetPanel();
@@ -24,12 +24,20 @@ public static class PanelComponentFactory
prefab.transform.SetParent(GameObject.FindGameObjectWithTag("GUI").transform, false);
- GameObject continueButton = BuildContinueButton(new Vector3(-100, 150, 0), new Vector2(115, 90), new Vector3(1.2f, 1.2f, 1));
- continueButton.transform.SetParent(prefab.transform, false);
-
return prefab;
}
+ public static GameObject BuildCustomPanelWithContinue(Vector3 position, Vector2 size, Vector3 scale)
+ {
+ var panel = BuildCustomPanel(position, size, scale);
+
+ GameObject continueButton = BuildContinueButton(new Vector3(-100, 150, 0), new Vector2(115, 90), new Vector3(1.2f, 1.2f, 1));
+ continueButton.transform.SetParent(panel.transform, false);
+
+ return panel;
+ }
+
+
public static GameObject BuildCustomButton(ButtonPanelModel answerModel)
{
var panel = DialoguePanelsPrefabsList.GetBaseButton();
diff --git a/Assets/Scripts/Domain/DialoguePanel/Panel.cs b/Assets/Scripts/Domain/DialoguePanel/Panel.cs
index 940e2fda..f610c516 100644
--- a/Assets/Scripts/Domain/DialoguePanel/Panel.cs
+++ b/Assets/Scripts/Domain/DialoguePanel/Panel.cs
@@ -17,6 +17,16 @@ public class Panel : AbstractPanel
public Panel(Vector3 _position, Vector2 _size, Vector3 _scale) : base (_position, _size, _scale){ }
public override GameObject BuildPanel()
+ {
+ GameObject panelPrefab = PanelComponentFactory.BuildCustomPanelWithContinue(Position, Size, Scale);
+
+ panelPrefab.transform.Find("Header").gameObject.GetComponent().text = Header;
+ panelPrefab.transform.Find("Content").gameObject.GetComponent().text = Content;
+
+ return panelPrefab;
+ }
+
+ public GameObject BuildPanelWithoutContinue()
{
GameObject panelPrefab = PanelComponentFactory.BuildCustomPanel(Position, Size, Scale);
@@ -26,7 +36,7 @@ public class Panel : AbstractPanel
return panelPrefab;
}
- public void SetContinueButtonAction(Action onClickFunction, DialogueController dialogControllerModel)
+ public void SetContinueButtonAction(Func onClickFunction, DialogueController dialogControllerModel)
{
PanelInstance.transform.Find("ContinueButton").GetComponent