Dialogues - saving
This commit is contained in:
parent
4373cdc48d
commit
1c26fc648b
177
Assets/Resources/Mission/New Mission Dialogue.asset
Normal file
177
Assets/Resources/Mission/New Mission Dialogue.asset
Normal file
@ -0,0 +1,177 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67587597537a4344cad65ddbcebee119, type: 3}
|
||||
m_Name: New Mission Dialogue
|
||||
m_EditorClassIdentifier:
|
||||
SpeakerName: Luberjack 2
|
||||
CurrentStep: 0
|
||||
DialogueSteps:
|
||||
- Header: Luberjack 2
|
||||
WasDisplayed: 0
|
||||
ListOfSentences:
|
||||
- Sentence: Could you help me?
|
||||
Buttons: []
|
||||
- Sentence: I lost my chestplate, please found one for me
|
||||
Buttons:
|
||||
- ButtonName: Reject miss
|
||||
Type: 1
|
||||
ButtonActions:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: MissionDialogue, Assembly-CSharp
|
||||
m_MethodName: RejectMission
|
||||
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
|
||||
- ButtonName: Accept miss
|
||||
Type: 1
|
||||
ButtonActions:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: MissionDialogue, Assembly-CSharp
|
||||
m_MethodName: AcceptMission
|
||||
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: Thank you very much, now go!
|
||||
Buttons: []
|
||||
EndOfDialogueStepAction:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: Dialogue, Assembly-CSharp
|
||||
m_MethodName: ShowNextPanel
|
||||
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
|
||||
- Header: Luberjack 2
|
||||
WasDisplayed: 0
|
||||
ListOfSentences:
|
||||
- Sentence: Fantastic!!
|
||||
Buttons: []
|
||||
- Sentence: Please take this reward
|
||||
Buttons:
|
||||
- ButtonName: Take
|
||||
Type: 1
|
||||
ButtonActions:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: MissionDialogue, Assembly-CSharp
|
||||
m_MethodName: GiveReward
|
||||
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: 11400000}
|
||||
m_TargetAssemblyTypeName: Dialogue, 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
|
||||
EndOfDialogueStepAction:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: MissionDialogue, Assembly-CSharp
|
||||
m_MethodName: FinishMission
|
||||
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
|
||||
- Header: Luberjack 2
|
||||
WasDisplayed: 0
|
||||
ListOfSentences:
|
||||
- Sentence: Fantastic!!
|
||||
Buttons: []
|
||||
- Sentence: Please take this reward
|
||||
Buttons:
|
||||
- ButtonName: Take
|
||||
Type: 1
|
||||
ButtonActions:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: MissionDialogue, Assembly-CSharp
|
||||
m_MethodName: GiveReward
|
||||
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: 11400000}
|
||||
m_TargetAssemblyTypeName: Dialogue, 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
|
||||
EndOfDialogueStepAction:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 11400000}
|
||||
m_TargetAssemblyTypeName: MissionDialogue, Assembly-CSharp
|
||||
m_MethodName: FinishMission
|
||||
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
|
8
Assets/Resources/Mission/New Mission Dialogue.asset.meta
Normal file
8
Assets/Resources/Mission/New Mission Dialogue.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe2810d79ff17f74eab5cf9a916167b4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -187,11 +187,26 @@ public class Dialogue : ScriptableObject, IDialogue
|
||||
DialogueSteps.ForEach(step => step.WasDisplayed = false);
|
||||
}
|
||||
|
||||
public void UpdateDialogueState(DialogueData dialogueData)
|
||||
{
|
||||
// 1 Rule - speaker name shouldnt change !!! its our 'key'
|
||||
|
||||
|
||||
CurrentStep = dialogueData.CurrentStep;
|
||||
|
||||
for(int i=0; i < dialogueData.DialogueStepModelDataList.Count; i++)
|
||||
{
|
||||
DialogueSteps[i].WasDisplayed = dialogueData.DialogueStepModelDataList[i].WasDisplayed;
|
||||
}
|
||||
}
|
||||
|
||||
public DialogueStepModel GetCurrentStep()
|
||||
{// TODO - argument out of colection :/
|
||||
return DialogueSteps[CurrentStep];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* public DialogueStepModel GetCurrentStep()
|
||||
{
|
||||
|
||||
|
@ -38,8 +38,8 @@ public class DialogueManager : MonoBehaviour
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
||||
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterDialogueStep(dial.Key, dial.Value.ResetDialogue)); // reset dial
|
||||
// create and config dailogue
|
||||
CreateInstanceBasedOnLanguage();
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +65,7 @@ public class DialogueManager : MonoBehaviour
|
||||
SpeakerName = collision.gameObject.name;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
// don't listen when component is disabled
|
||||
@ -82,6 +83,13 @@ public class DialogueManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void CreateInstanceBasedOnLanguage()
|
||||
{
|
||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
||||
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterDialogueStep(dial.Key, dial.Value.ResetDialogue)); // reset dial
|
||||
}
|
||||
|
||||
#region Open Panel API
|
||||
public void OpenDialoguePanel()
|
||||
{
|
||||
if(OpenPanelCondition())
|
||||
@ -111,6 +119,7 @@ public class DialogueManager : MonoBehaviour
|
||||
{
|
||||
return !gameObject.GetComponent<DialogueManager>().enabled;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Opened = 1
|
||||
|
@ -159,6 +159,7 @@ public class MultiDialogue : ScriptableObject, IDialogue
|
||||
|
||||
public (int, int) DialogueStepStatus()
|
||||
{
|
||||
Debug.Log(CurrentDialogue);
|
||||
var currentDialogueStepIndex = Dialogues
|
||||
.Where(el => el.Key == CurrentDialogue)
|
||||
.Select(el => el.Value)
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcfd2b5592f0f7448b3f5e7531eb477b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c78516732b397e4dab36038c6b9b48a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,103 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using UnityEngine;
|
||||
|
||||
class SaveDialogueManager : SaveModelSystem<DialogueData>
|
||||
{
|
||||
public override bool SaveModelItem(DialogueData model)
|
||||
{
|
||||
return base.SaveModelItem(model);
|
||||
}
|
||||
|
||||
public override bool SaveModelList(List<DialogueData> list)
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
Debug.Log("Saved Dialogue list at " + Path);
|
||||
|
||||
if (!Directory.Exists(Path)) Directory.CreateDirectory(Path);
|
||||
|
||||
/* Main logic of conversion data format */
|
||||
var data = list; // ConvertObjectsListToListOfDataModels(list);
|
||||
|
||||
FileStream stream = new FileStream(
|
||||
Path + GetFileName(ObjectListName),
|
||||
FileMode.Create
|
||||
);
|
||||
|
||||
formatter.Serialize(stream, data);
|
||||
stream.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override DialogueData LoadModelItem()
|
||||
{
|
||||
return base.LoadModelItem();
|
||||
}
|
||||
|
||||
public override List<DialogueData> LoadModelList()
|
||||
{
|
||||
string path = Path + GetFileName(ObjectListName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
FileStream stream = new FileStream(path, FileMode.Open);
|
||||
|
||||
List<DialogueData> dialogueList = formatter.Deserialize(stream) as List<DialogueData>;
|
||||
stream.Close();
|
||||
|
||||
return dialogueList; // ConvertListOfDataModelsToListOfObject(questsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Save file not found in " + path);
|
||||
}
|
||||
|
||||
return new List<DialogueData>();
|
||||
}
|
||||
|
||||
// ----------------- USELLES IN THIS CLASS -----------------
|
||||
#region unused
|
||||
// Support function
|
||||
|
||||
// 1. From model to data format
|
||||
public static DialogueData ConvertObjectToDataModel(Dialogue model)
|
||||
{
|
||||
return new DialogueData(model);
|
||||
}
|
||||
|
||||
public static List<DialogueData> ConvertObjectsListToListOfDataModels(List<Dialogue> modelsList)
|
||||
{
|
||||
List<DialogueData> convertedList = new List<DialogueData>();
|
||||
|
||||
foreach (Dialogue model in modelsList)
|
||||
{
|
||||
convertedList.Add(ConvertObjectToDataModel(model));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
// 2. From data to model format
|
||||
public static Dialogue ConvertDataModelToObject(DialogueData dataModel)
|
||||
{
|
||||
return (Dialogue)dataModel.MapDataToObject();
|
||||
}
|
||||
|
||||
public static List<Dialogue> ConvertListOfDataModelsToListOfObject(List<DialogueData> dataModelsList)
|
||||
{
|
||||
List<Dialogue> convertedList = new List<Dialogue>();
|
||||
|
||||
foreach (DialogueData dataModel in dataModelsList)
|
||||
{
|
||||
convertedList.Add(ConvertDataModelToObject(dataModel));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5848318111a931049bb98f6b4ca78da2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
class SceneDialogueDataLoader : SceneBaseDataLoader<DialogueData>
|
||||
{
|
||||
public SceneDialogueDataLoader(string _objectListName, string _objectFolderName)
|
||||
{
|
||||
SaveModelSystem = new SaveDialogueManager();
|
||||
SaveModelSystem.ObjectFolderName = _objectFolderName;
|
||||
SaveModelSystem.ObjectListName = _objectListName;
|
||||
}
|
||||
|
||||
protected override List<DialogueData> LoadDynamicData()
|
||||
{
|
||||
SaveModelSystem.Path = PathBuilder.BuildSavePath().WithMap(CurrentMap).WithDataType(SceneElementTypeEnum.Dynamic).GetString();
|
||||
|
||||
return SaveModelSystem.LoadModelList();
|
||||
}
|
||||
|
||||
protected override bool SaveDynamicData(List<DialogueData> _elements)
|
||||
{
|
||||
SaveModelSystem.Path = PathBuilder.BuildSavePath().WithMap(CurrentMap).WithDataType(SceneElementTypeEnum.Dynamic).GetString();
|
||||
|
||||
return base.SaveDynamicData(_elements);
|
||||
}
|
||||
|
||||
protected override List<DialogueData> LoadGenericData()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override bool SaveGenericData(List<DialogueData> _elements)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97f93c62abf28c4478dd2498cbdc6bb2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9901c90ea94816419fb6bae13203bc0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,99 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using UnityEngine;
|
||||
|
||||
class SaveMissionDialogueManager : SaveModelSystem<MissionDialogue>
|
||||
{
|
||||
public override bool SaveModelItem(MissionDialogue model)
|
||||
{
|
||||
return base.SaveModelItem(model);
|
||||
}
|
||||
|
||||
public override bool SaveModelList(List<MissionDialogue> list)
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
Debug.Log("Saved MissionDialogue list at " + Path);
|
||||
|
||||
if (!Directory.Exists(Path)) Directory.CreateDirectory(Path);
|
||||
|
||||
/* Main logic of conversion data format */
|
||||
var data = ConvertObjectsListToListOfDataModels(list);
|
||||
|
||||
FileStream stream = new FileStream(
|
||||
Path + GetFileName(ObjectListName),
|
||||
FileMode.Create
|
||||
);
|
||||
|
||||
formatter.Serialize(stream, data);
|
||||
stream.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override MissionDialogue LoadModelItem()
|
||||
{
|
||||
return base.LoadModelItem();
|
||||
}
|
||||
|
||||
public override List<MissionDialogue> LoadModelList()
|
||||
{
|
||||
string path = Path + GetFileName(ObjectListName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
FileStream stream = new FileStream(path, FileMode.Open);
|
||||
|
||||
List<MissionDialogueData> questsList = formatter.Deserialize(stream) as List<MissionDialogueData>;
|
||||
stream.Close();
|
||||
|
||||
return ConvertListOfDataModelsToListOfObject(questsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Save file not found in " + path);
|
||||
}
|
||||
|
||||
return new List<MissionDialogue>();
|
||||
}
|
||||
|
||||
// Support function
|
||||
|
||||
// 1. From model to data format
|
||||
public static MissionDialogueData ConvertObjectToDataModel(MissionDialogue model)
|
||||
{
|
||||
return new MissionDialogueData(); //model
|
||||
}
|
||||
|
||||
public static List<MissionDialogueData> ConvertObjectsListToListOfDataModels(List<MissionDialogue> modelsList)
|
||||
{
|
||||
List<MissionDialogueData> convertedList = new List<MissionDialogueData>();
|
||||
|
||||
foreach (MissionDialogue model in modelsList)
|
||||
{
|
||||
convertedList.Add(ConvertObjectToDataModel(model));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
// 2. From data to model format
|
||||
public static MissionDialogue ConvertDataModelToObject(MissionDialogueData dataModel)
|
||||
{
|
||||
return (MissionDialogue)dataModel.MapDataToObject();
|
||||
}
|
||||
|
||||
public static List<MissionDialogue> ConvertListOfDataModelsToListOfObject(List<MissionDialogueData> dataModelsList)
|
||||
{
|
||||
List<MissionDialogue> convertedList = new List<MissionDialogue>();
|
||||
|
||||
foreach (MissionDialogueData dataModel in dataModelsList)
|
||||
{
|
||||
convertedList.Add(ConvertDataModelToObject(dataModel));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c2c75847d80f84419115a7391404cb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62b16bbb03d6dce4cbb52d00e48d1279
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class MultiDialogueDataListManager : DataListManager<MultiDialogueData>
|
||||
{
|
||||
// WE DONT NEED HERE UI MANAGER - because dialoges ane;t associated with ui panels in way like inventory / chest or shop
|
||||
|
||||
public override void AddElementToList(MultiDialogueData newElement)
|
||||
{
|
||||
Elements.Add(newElement);
|
||||
}
|
||||
|
||||
public override void RemoveElementFromList(MultiDialogueData element)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45bf2866ffc8d3e4fb559f39001e686f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
class MultiDialogueDataLoader : SceneBaseDataLoader<MultiDialogueData>
|
||||
{
|
||||
public MultiDialogueDataLoader(string _objectListName, string _objectFolderName)
|
||||
{
|
||||
SaveModelSystem = new SaveMultiDialogueManager();
|
||||
SaveModelSystem.ObjectFolderName = _objectFolderName;
|
||||
SaveModelSystem.ObjectListName = _objectListName;
|
||||
}
|
||||
|
||||
protected override List<MultiDialogueData> LoadDynamicData()
|
||||
{
|
||||
SaveModelSystem.Path = PathBuilder.BuildSavePath().WithMap(CurrentMap).WithDataType(SceneElementTypeEnum.Dynamic).GetString();
|
||||
|
||||
return SaveModelSystem.LoadModelList();
|
||||
}
|
||||
|
||||
protected override bool SaveDynamicData(List<MultiDialogueData> _elements)
|
||||
{
|
||||
SaveModelSystem.Path = PathBuilder.BuildSavePath().WithMap(CurrentMap).WithDataType(SceneElementTypeEnum.Dynamic).GetString();
|
||||
|
||||
return base.SaveDynamicData(_elements);
|
||||
}
|
||||
|
||||
protected override List<MultiDialogueData> LoadGenericData()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override bool SaveGenericData(List<MultiDialogueData> _elements)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28e9da3ea5847074892b3af3d9cd1027
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
class MultiDialogueDataManager : SceneBaseDataManager<MultiDialogueData>
|
||||
{
|
||||
protected override string OBJECT_FOLDER_NAME { get { return "MultiDialogue"; } }
|
||||
protected override string OBJECT_LIST_NAME { get { return "MultiDialogueList"; } }
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
// ZMIANA KONCEPCJI
|
||||
// ZMIAST TRZYMAC SUROWE OBIEKTY TYM RAZEM ZAPISUJMY modele Datai updatujmy obiket w NPC Managerze
|
||||
public override void Start()
|
||||
{
|
||||
Debug.Log("Start MultiDialogueData manager");
|
||||
|
||||
|
||||
DynamicDataList = new MultiDialogueDataListManager();
|
||||
|
||||
DataLoader = new MultiDialogueDataLoader(OBJECT_LIST_NAME, OBJECT_FOLDER_NAME);
|
||||
|
||||
|
||||
base.Start();
|
||||
}
|
||||
|
||||
// TODO - save ChestPrefabAsset (we need to save coords...) but in manager handle Chest data..
|
||||
//
|
||||
protected override void AfterStart()
|
||||
{
|
||||
if (OnMapAppearanceMethod.GameStatus == GameStatus.NewGame)
|
||||
{
|
||||
if (OnMapAppearanceMethod.Gateway != OnMapAppearanceMethodEnum.NewGame)
|
||||
UseDynamicSettings(); // if there is nothing saved we will use UseDefaultSettings
|
||||
else
|
||||
UseDefaultSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
UseDynamicSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected SceneBaseDataManager<MultiDialogueData> GetObjectType()
|
||||
{
|
||||
return GameObject.FindObjectOfType<MultiDialogueDataManager>();
|
||||
}
|
||||
|
||||
protected SceneBaseDataManager<MultiDialogueData> CreateInstance(ref GameObject managerGameObject)
|
||||
{
|
||||
return managerGameObject.AddComponent<MultiDialogueDataManager>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void UseDefaultSettings()
|
||||
{
|
||||
DynamicDataList.SetList(new List<MultiDialogueData>());
|
||||
UiManager.SetList(new List<MultiDialogueData>());
|
||||
// we dont need to convert anything
|
||||
// Instead of build elements on scene we collect shops distracted on scene from npc's
|
||||
}
|
||||
|
||||
protected override void UseDynamicSettings()
|
||||
{
|
||||
// when chest detect player in near arrea and player press "c"
|
||||
// open panel -> chest controller handle Open panel in Scene Chest Manager passing info about what Chest Palyer want to open
|
||||
// Manager Build panel and pass info about chest content
|
||||
|
||||
LoadDynamicData();
|
||||
|
||||
// VERy VERY provisional SOLUTION
|
||||
if (DynamicDataList.GetList().Count == 0)
|
||||
{
|
||||
UseDefaultSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
UiManager.SetList(DynamicDataList.GetList());
|
||||
}
|
||||
|
||||
|
||||
public void RegisterDialogue(MultiDialogue newDialogue)
|
||||
{
|
||||
if (DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).Any())
|
||||
Debug.LogError("In MultiDialgoue Manager there is register this dialogue already");
|
||||
else
|
||||
{
|
||||
var multiDialogueData = SaveMultiDialogueManager.ConvertObjectToDataModel(newDialogue);
|
||||
|
||||
DynamicDataList.AddElementToList(multiDialogueData);
|
||||
|
||||
UiManager.SetList(DynamicDataList.GetList());
|
||||
}
|
||||
}
|
||||
|
||||
// update proggress in dialogue - BUT FUNCTION BELOW SYNCH THIS ALREADY righhr???
|
||||
public void UpdateDialogue(MultiDialogue newDialogue)
|
||||
{
|
||||
Debug.Log("Update multi-dialogue ion manager list");
|
||||
if (DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).Any())
|
||||
Debug.LogError("In MultiDialgoue Manager there is register this dialogue already");
|
||||
else
|
||||
{
|
||||
var multiDialogueData = SaveMultiDialogueManager.ConvertObjectToDataModel(newDialogue);
|
||||
|
||||
DynamicDataList.AddElementToList(multiDialogueData);
|
||||
|
||||
UiManager.SetList(DynamicDataList.GetList());
|
||||
}
|
||||
}
|
||||
|
||||
public MultiDialogueData GetDialogue(MultiDialogue newDialogue)
|
||||
{
|
||||
return DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).First();
|
||||
}
|
||||
|
||||
public override bool SaveDynamicData()
|
||||
{
|
||||
// TODO
|
||||
// how to get list
|
||||
// 1. List in UI manager should be synchronized with list in this manager
|
||||
foreach (MultiDialogueData multiDialogue in UiManager.GetList())
|
||||
{
|
||||
DynamicDataList.GetList().Where(el => el.SpeakerName == multiDialogue.SpeakerName).ToList().ForEach(el => el = multiDialogue);
|
||||
}
|
||||
|
||||
//DynamicDataList.SetList(tmp);
|
||||
|
||||
// approach:
|
||||
// 1. get from outside, update local list && us it
|
||||
// 2. Handle list synchronized all the time & pass local list
|
||||
return SaveData(DynamicDataList?.GetList(), SceneElementTypeEnum.Dynamic);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ebc89f7b8b469d448c3787923ceb966
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,102 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using UnityEngine;
|
||||
|
||||
class SaveMultiDialogueManager : SaveModelSystem<MultiDialogueData>
|
||||
{
|
||||
public override bool SaveModelItem(MultiDialogueData model)
|
||||
{
|
||||
return base.SaveModelItem(model);
|
||||
}
|
||||
|
||||
public override bool SaveModelList(List<MultiDialogueData> list)
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
Debug.Log("Saved MultiDialogue list at " + Path);
|
||||
|
||||
if (!Directory.Exists(Path)) Directory.CreateDirectory(Path);
|
||||
|
||||
/* Main logic of conversion data format */
|
||||
var data = list; // ConvertObjectsListToListOfDataModels(list);
|
||||
|
||||
FileStream stream = new FileStream(
|
||||
Path + GetFileName(ObjectListName),
|
||||
FileMode.Create
|
||||
);
|
||||
|
||||
formatter.Serialize(stream, data);
|
||||
stream.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override MultiDialogueData LoadModelItem()
|
||||
{
|
||||
return base.LoadModelItem();
|
||||
}
|
||||
|
||||
public override List<MultiDialogueData> LoadModelList()
|
||||
{
|
||||
string path = Path + GetFileName(ObjectListName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
FileStream stream = new FileStream(path, FileMode.Open);
|
||||
|
||||
List<MultiDialogueData> dialogueList = formatter.Deserialize(stream) as List<MultiDialogueData>;
|
||||
stream.Close();
|
||||
|
||||
return dialogueList; // ConvertListOfDataModelsToListOfObject(questsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Save file not found in " + path);
|
||||
}
|
||||
|
||||
return new List<MultiDialogueData>();
|
||||
}
|
||||
|
||||
// ----------------- USELLES IN THIS CLASS -----------------
|
||||
#region unused
|
||||
// Support function
|
||||
|
||||
// 1. From model to data format
|
||||
public static MultiDialogueData ConvertObjectToDataModel(MultiDialogue model)
|
||||
{
|
||||
return new MultiDialogueData(model);
|
||||
}
|
||||
|
||||
public static List<MultiDialogueData> ConvertObjectsListToListOfDataModels(List<MultiDialogue> modelsList)
|
||||
{
|
||||
List<MultiDialogueData> convertedList = new List<MultiDialogueData>();
|
||||
|
||||
foreach (MultiDialogue model in modelsList)
|
||||
{
|
||||
convertedList.Add(ConvertObjectToDataModel(model));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
// 2. From data to model format
|
||||
public static MultiDialogue ConvertDataModelToObject(MultiDialogueData dataModel)
|
||||
{
|
||||
return (MultiDialogue)dataModel.MapDataToObject();
|
||||
}
|
||||
|
||||
public static List<MultiDialogue> ConvertListOfDataModelsToListOfObject(List<MultiDialogueData> dataModelsList)
|
||||
{
|
||||
List<MultiDialogue> convertedList = new List<MultiDialogue>();
|
||||
|
||||
foreach (MultiDialogueData dataModel in dataModelsList)
|
||||
{
|
||||
convertedList.Add(ConvertDataModelToObject(dataModel));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
#endregion
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 472171b0cb138d546baea600f3576cc6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dac101751423ca41b7ef883b0c6288c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -20,7 +20,7 @@ public class NpcMissionManager : DialogueManager // ScriptableObject
|
||||
public DialogueStepModel FreeDialogue;
|
||||
|
||||
// List<Key<mission No, mission step No>, Value : UnityEvent>
|
||||
public List<IndexValuePair<IndexValuePair<int, int>, MissionProcess>> EndactionEventList;
|
||||
//public List<IndexValuePair<IndexValuePair<int, int>, MissionCondition>> EndactionEventList;
|
||||
|
||||
|
||||
public void Start()
|
||||
|
8
Assets/Scripts/REFACTORING/Application/Mission/Save.meta
Normal file
8
Assets/Scripts/REFACTORING/Application/Mission/Save.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 447e7b25e59ae614982fb6e6c7d1d314
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,100 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
class SaveMissionManager : SaveModelSystem<Mission>
|
||||
{
|
||||
public override bool SaveModelItem(Mission model)
|
||||
{
|
||||
return base.SaveModelItem(model);
|
||||
}
|
||||
|
||||
public override bool SaveModelList(List<Mission> list)
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
Debug.Log("Saved Mision list at " + Path);
|
||||
|
||||
if (!Directory.Exists(Path)) Directory.CreateDirectory(Path);
|
||||
|
||||
/* Main logic of conversion data format */
|
||||
var data = ConvertObjectsListToListOfDataModels(list);
|
||||
|
||||
FileStream stream = new FileStream(
|
||||
Path + GetFileName(ObjectListName),
|
||||
FileMode.Create
|
||||
);
|
||||
|
||||
formatter.Serialize(stream, data);
|
||||
stream.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Mission LoadModelItem()
|
||||
{
|
||||
return base.LoadModelItem();
|
||||
}
|
||||
|
||||
public override List<Mission> LoadModelList()
|
||||
{
|
||||
string path = Path + GetFileName(ObjectListName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
FileStream stream = new FileStream(path, FileMode.Open);
|
||||
|
||||
List<MissionData> questsList = formatter.Deserialize(stream) as List<MissionData>;
|
||||
stream.Close();
|
||||
|
||||
return ConvertListOfDataModelsToListOfObject(questsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Save file not found in " + path);
|
||||
}
|
||||
|
||||
return new List<Mission>();
|
||||
}
|
||||
|
||||
// Support function
|
||||
|
||||
// 1. From model to data format
|
||||
public static MissionData ConvertObjectToDataModel(Mission model)
|
||||
{
|
||||
return new MissionData(); //model
|
||||
}
|
||||
|
||||
public static List<MissionData> ConvertObjectsListToListOfDataModels(List<Mission> modelsList)
|
||||
{
|
||||
List<MissionData> convertedList = new List<MissionData>();
|
||||
|
||||
foreach (Mission model in modelsList)
|
||||
{
|
||||
convertedList.Add(ConvertObjectToDataModel(model));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
// 2. From data to model format
|
||||
public static Mission ConvertDataModelToObject(MissionData dataModel)
|
||||
{
|
||||
return (Mission)dataModel.MapDataToObject();
|
||||
}
|
||||
|
||||
public static List<Mission> ConvertListOfDataModelsToListOfObject(List<MissionData> dataModelsList)
|
||||
{
|
||||
List<Mission> convertedList = new List<Mission>();
|
||||
|
||||
foreach (MissionData dataModel in dataModelsList)
|
||||
{
|
||||
convertedList.Add(ConvertDataModelToObject(dataModel));
|
||||
}
|
||||
|
||||
return convertedList;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09be5e44216394646872bb93d0de295e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -14,7 +14,18 @@ public class NpcDialogueManager : DialogueManager
|
||||
|
||||
CanBeOpened = false;
|
||||
OpenInDefaultWay = false;
|
||||
|
||||
// UPDATE DIALOGUE
|
||||
// search in scene manager list
|
||||
var machedDialogueData = ((MultiDialogueDataManager)MultiDialogueDataManager.Instance).GetDialogue(Dialogue);
|
||||
if(Dialogue != null && machedDialogueData != null)
|
||||
{
|
||||
Debug.Log("Multi Dialogue - updated");
|
||||
UpdateDialogueState(machedDialogueData);
|
||||
}
|
||||
}
|
||||
|
||||
#region Open Panel API
|
||||
public override bool OpenPanelCondition()
|
||||
{
|
||||
/*
|
||||
@ -30,7 +41,25 @@ public class NpcDialogueManager : DialogueManager
|
||||
{
|
||||
return !gameObject.GetComponent<NpcDialogueManager>().enabled;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void UpdateDialogueState(MultiDialogueData dialogueData)
|
||||
{
|
||||
// 1 Rule - speaker name shouldnt change !!! its our 'key'
|
||||
|
||||
Dialogue.CurrentDialogue = dialogueData.CurrentDialogue;
|
||||
|
||||
foreach(var singleDialogue in dialogueData.DialogueStepModelDataList)
|
||||
{
|
||||
Dialogue.Dialogues
|
||||
.Where(dial => dial.Key == singleDialogue.Key)
|
||||
.Select(dial => dial.Value)
|
||||
.ToList()
|
||||
.ForEach(dial => dial.UpdateDialogueState(singleDialogue.Value) );
|
||||
}
|
||||
}
|
||||
|
||||
#region Dialogue actions API
|
||||
/// <summary>
|
||||
/// Function to invoke actions declared in manager on object from scene not onto asset
|
||||
///
|
||||
@ -74,4 +103,5 @@ public class NpcDialogueManager : DialogueManager
|
||||
|
||||
EndactionEventList.Where(el => el.Key.Key == dialogueProgress.Item1 & el.Key.Value == dialogueProgress.Item2).ToList().ForEach(el => el.Value.Invoke());
|
||||
}
|
||||
#endregion
|
||||
}
|
8
Assets/Scripts/REFACTORING/Models/Dialogue.meta
Normal file
8
Assets/Scripts/REFACTORING/Models/Dialogue.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c493b82cec044e45be26deb952b98b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
66
Assets/Scripts/REFACTORING/Models/Dialogue/DialogueData.cs
Normal file
66
Assets/Scripts/REFACTORING/Models/Dialogue/DialogueData.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public abstract class DialogueData<T> : ModelData<T, T>
|
||||
{
|
||||
protected override string SPRITE_LOCALIZATION => "";
|
||||
protected override string MODEL_LOCALIZATION => "Dialogue/";
|
||||
|
||||
[SerializeField]
|
||||
public int CurrentStep;
|
||||
|
||||
[SerializeField]
|
||||
public List<DialogueStepData> DialogueStepModelDataList = new List<DialogueStepData>();
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
#region NotImplemented
|
||||
/*
|
||||
* we dont want to map it here, we will mark fields in NpcDialogfeManager after each loading and fetching dialogue
|
||||
*/
|
||||
public override Dialogue MapDataToObject(string prefarbAssetName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/*
|
||||
* we dont want to map it here, we will mark fields in NpcDialogfeManager after each loading and fetching dialogue
|
||||
*/
|
||||
public override Dialogue MapDataToObject()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Dialogue TryFindResource(string modelName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 062452edb267909499c0d6c30f831583
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class DialogueStepData : IModelMapper<DialogueStepModel>
|
||||
{
|
||||
[SerializeField]
|
||||
public bool WasDisplayed;
|
||||
|
||||
// we dont need nothig more from mapped class model
|
||||
//public List<DialogueModelData> ListOfSentences = new List<DialogueModelData>();
|
||||
|
||||
public DialogueStepData(bool wasDisplayed = false)
|
||||
{
|
||||
WasDisplayed = wasDisplayed;
|
||||
}
|
||||
|
||||
public DialogueStepModel MapDataToObject(string prefarbAssetName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public DialogueStepModel MapDataToObject()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1058be8a3d7c1474c923356995db1a96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public abstract class MultiDialogueData<T> : ModelData<T, T>
|
||||
{
|
||||
protected override string SPRITE_LOCALIZATION => "";
|
||||
protected override string MODEL_LOCALIZATION => "Dialogue/";
|
||||
|
||||
[SerializeField]
|
||||
public string SpeakerName;
|
||||
|
||||
[SerializeField]
|
||||
public int CurrentDialogue;
|
||||
|
||||
[SerializeField]
|
||||
public List<IndexValuePair<int, DialogueData>> DialogueStepModelDataList = new List<IndexValuePair<int, DialogueData>>();
|
||||
}
|
||||
|
||||
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)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#region NotImplemented
|
||||
public override MultiDialogue MapDataToObject(string prefarbAssetName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MultiDialogue MapDataToObject()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override MultiDialogue TryFindResource(string modelName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60a249cd2c2f413428cdf925f2a9afe1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/REFACTORING/Models/Mission/Dialogue.meta
Normal file
8
Assets/Scripts/REFACTORING/Models/Mission/Dialogue.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55458af5ff6b5d74d8aeb510212280cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class MissionDialogueData : DialogueData<MissionDialogue>
|
||||
{
|
||||
protected override string SPRITE_LOCALIZATION => "";
|
||||
protected override string MODEL_LOCALIZATION => "Mission/Dialogue/";
|
||||
|
||||
|
||||
|
||||
|
||||
public override MissionDialogue MapDataToObject(string prefarbAssetName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MissionDialogue MapDataToObject()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override MissionDialogue TryFindResource(string modelName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13df471a010fd0144a583d1b723e97cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class MissionDialogueStepData
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65cb4fb8a7aa29641b4979c6ea2ad31f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
34
Assets/Scripts/REFACTORING/Models/Mission/MissionData.cs
Normal file
34
Assets/Scripts/REFACTORING/Models/Mission/MissionData.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
class MissionData : ModelData<Mission>
|
||||
{
|
||||
[SerializeField]
|
||||
public MissionStatusEnum Status = MissionStatusEnum.None;
|
||||
|
||||
[SerializeField]
|
||||
public int CurrentStep = 0;
|
||||
|
||||
[SerializeField]
|
||||
public List<MissionStepData> MissionStepsDataList = new List<MissionStepData>();
|
||||
|
||||
public override Mission MapDataToObject(string prefarbAssetName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Mission MapDataToObject()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Mission TryFindResource(string modelName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a81a0be5f1e38674889a76e2e3766565
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/REFACTORING/Models/Mission/Step.meta
Normal file
8
Assets/Scripts/REFACTORING/Models/Mission/Step.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a64ddd7881e399144bc46d4de971b2f7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
class MissionStepData : IModelMapper<MissionStepModel>
|
||||
{
|
||||
MissionStepStatusEnum Status;
|
||||
|
||||
MissionDialogueData MissionDialogueData;
|
||||
|
||||
public MissionStepModel MapDataToObject(string prefarbAssetName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public MissionStepModel MapDataToObject()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5c259e2178013d4b86ee505e90a4716
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -38,3 +38,8 @@ public abstract class ModelData<T, V> : IModelMapper<T>
|
||||
|
||||
public abstract T MapDataToObject();
|
||||
}
|
||||
|
||||
public abstract class ModelData<T> : ModelData<T, T>
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user