using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
[Serializable]
[CreateAssetMenu(fileName = "New Mission Dialogue", menuName = "Dialogue/New Mission Dialogue")]
public class MissionDialogue : Dialogue
{
[NonSerialized]
private MissionStepModel Parent;
public void BindParent(MissionStepModel parent)
{
Parent = parent;
}
#region Mission API for button actions
///
/// Api for mission allowing to bind action to button
///
public void AcceptMission()
{
Parent.GetOriginMission().Accept();
// show next panel if exists
//ShowNextPanel();
// no we allow to decide programers which one use GoToNextSentence or ShowNextPanel
}
///
/// Api for mission allowing to bind action to button
///
public void RejectMission()
{
Parent.GetOriginMission().Reject();
Parent.Status = MissionStepStatusEnum.Finished;
GetCurrentStep().DialogueController.CloseCurrentPanel();
}
///
/// Function to bind checking condition method from associated Mission (parent)
/// to specifi button in dialogue step structure
///
public void HandleCondition()
{
Debug.Log("Handle Conditoion");
var result = Parent.HanldeMissionStepCondition();
if (result) GoToNextSentence();
else BreakDialogueStep();
}
public void GiveReward()
{
Debug.Log("Give reward");
Parent.GetOriginMission().GiveReward();
}
public void FinishMission()
{
Parent.GetOriginMission().FinishMission();
}
#endregion
#region Dialogue Status API
public void UpdateDialogueState(MissionDialogueData dialogueData)
{
CurrentStep = dialogueData.CurrentStep;
for (int i = 0; i < dialogueData.DialogueStepModelDataList.Count; i++)
{
DialogueSteps[i].WasDisplayed = dialogueData.DialogueStepModelDataList[i].WasDisplayed;
}
}
#endregion
}