Scriptum/Assets/Scripts/REFACTORING/Models/Dialogue/MultiDialogueData.cs
2023-01-02 00:22:39 +01:00

67 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
[Serializable]
public abstract class MultiDialogueData<T> : IModelMapper<T>
{
[NonSerialized]
public string name;
[NonSerialized]
public string modelName;
[SerializeField]
public string SpeakerName;
[SerializeField]
public int CurrentDialogue;
[SerializeField]
public List<IndexValuePair<int, DialogueData>> DialogueStepModelDataList = new List<IndexValuePair<int, DialogueData>>();
#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
}
[Serializable]
public class MultiDialogueData : MultiDialogueData<MultiDialogue>
{
public MultiDialogueData(MultiDialogue dialogue)
{
SpeakerName = dialogue.SpeakerName;
CurrentDialogue = dialogue.CurrentDialogue;
DialogueStepModelDataList.Clear();
foreach(IndexValuePair<int, Dialogue> DialogueStepModelData in dialogue.Dialogues)
{
DialogueStepModelDataList.Add(
new IndexValuePair<int, DialogueData>(
DialogueStepModelData.Key,
new DialogueData(DialogueStepModelData.Value)
)
);
}
}
}