Scriptum/Assets/Scripts/REFACTORING/Models/Dialogue/DialogueData.cs

58 lines
1.4 KiB
C#
Raw Normal View History

2023-01-01 17:03:35 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
[Serializable]
2023-01-02 00:05:47 +01:00
public abstract class DialogueData<T> : IModelMapper<T>
2023-01-01 17:03:35 +01:00
{
[SerializeField]
public int CurrentStep;
[SerializeField]
public List<DialogueStepData> DialogueStepModelDataList = new List<DialogueStepData>();
2023-01-02 00:05:47 +01:00
#region NotImplemented
/*
* we dont want to map it here, we will mark fields in NpcDialogfeManager after each loading and fetching dialogue
*/
public T MapDataToObject(string prefarbAssetName)
{
throw new NotImplementedException();
}
public T MapDataToObject()
{
throw new NotImplementedException();
}
#endregion
2023-01-01 17:03:35 +01:00
}
2023-01-02 00:05:47 +01:00
[Serializable]
2023-01-01 17:03:35 +01:00
public class DialogueData : DialogueData<Dialogue>
{
/// <summary>
/// build Data model based on Object
/// </summary>
/// <param name="dialogue"></param>
public DialogueData(Dialogue dialogue)
{
CurrentStep = dialogue.CurrentStep;
DialogueStepModelDataList.Clear();
foreach(DialogueStepModel dialogueStepModelData in dialogue.DialogueSteps)
{
/*
* pass WasDisplayed value from model to data representative class
*/
DialogueStepModelDataList.Add(new DialogueStepData(dialogueStepModelData.WasDisplayed));
}
}
}