2022-12-27 15:16:59 +01:00
|
|
|
|
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
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Api for mission allowing to bind action to button
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void AcceptMission()
|
|
|
|
|
{
|
|
|
|
|
Parent.GetOriginMission().Accept();
|
|
|
|
|
|
2023-01-12 15:22:49 +01:00
|
|
|
|
Parent.RegisterCondition();
|
2022-12-27 15:16:59 +01:00
|
|
|
|
// show next panel if exists
|
2023-01-03 22:44:24 +01:00
|
|
|
|
//ShowNextPanel();
|
|
|
|
|
// no we allow to decide programers which one use GoToNextSentence or ShowNextPanel
|
2022-12-27 15:16:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Api for mission allowing to bind action to button
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void RejectMission()
|
|
|
|
|
{
|
|
|
|
|
Parent.GetOriginMission().Reject();
|
|
|
|
|
|
|
|
|
|
Parent.Status = MissionStepStatusEnum.Finished;
|
|
|
|
|
|
|
|
|
|
GetCurrentStep().DialogueController.CloseCurrentPanel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Function to bind checking condition method from associated Mission (parent)
|
|
|
|
|
/// to specifi button in dialogue step structure
|
|
|
|
|
/// </summary>
|
|
|
|
|
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();
|
|
|
|
|
}
|
2023-01-07 17:49:15 +01:00
|
|
|
|
|
|
|
|
|
public void FinishMissionStep()
|
|
|
|
|
{
|
|
|
|
|
Parent.GetOriginMission().FinishMissionStep();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FinishMissionStepAndGoToNext()
|
|
|
|
|
{
|
|
|
|
|
Parent.GetOriginMission().FinishMissionStepAndGoToNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayerQuestContentManage(string newMissionIssue)
|
|
|
|
|
{
|
|
|
|
|
Parent.PlayerQuestContentManage(newMissionIssue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayerQuestContentManage()
|
|
|
|
|
{
|
|
|
|
|
Parent.PlayerQuestContentManage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CreateQuestOnList()
|
|
|
|
|
{
|
|
|
|
|
Parent.GetOriginMission().CreateQuestOnList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveQuestFromList()
|
|
|
|
|
{
|
|
|
|
|
Parent.GetOriginMission().RemoveQuestFromList();
|
|
|
|
|
}
|
2022-12-27 15:16:59 +01:00
|
|
|
|
#endregion
|
2023-01-03 22:44:24 +01:00
|
|
|
|
|
|
|
|
|
#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
|
2022-12-27 15:16:59 +01:00
|
|
|
|
}
|
|
|
|
|
|