Dialoges - saving II
This commit is contained in:
parent
82f3cf19fe
commit
b72537003b
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 06201cadd951bcc4db5fccaa01783060, type: 3}
|
m_Script: {fileID: 11500000, guid: 06201cadd951bcc4db5fccaa01783060, type: 3}
|
||||||
m_Name: BarryDialENG 1
|
m_Name: BarryDialENG 1
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
SpeakerName:
|
SpeakerName: Barry
|
||||||
CurrentStep: 0
|
CurrentStep: 0
|
||||||
DialogueSteps:
|
DialogueSteps:
|
||||||
- Header: Barry
|
- Header: Barry
|
||||||
|
@ -12,19 +12,14 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 06201cadd951bcc4db5fccaa01783060, type: 3}
|
m_Script: {fileID: 11500000, guid: 06201cadd951bcc4db5fccaa01783060, type: 3}
|
||||||
m_Name: BarryDialENG
|
m_Name: BarryDialENG
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
SpeakerName: ThePlayer(Clone)
|
SpeakerName: Barry
|
||||||
CurrentStep: 0
|
CurrentStep: 0
|
||||||
DialogueSteps:
|
DialogueSteps:
|
||||||
- Header: ThePlayer(Clone)
|
- Header: Barry
|
||||||
WasDisplayed: 0
|
WasDisplayed: 0
|
||||||
ListOfSentences:
|
ListOfSentences:
|
||||||
- Sentence: Hiya, do you have any spare change? Friend?
|
- Sentence: Hiya, do you have any spare change? Friend?
|
||||||
Buttons:
|
Buttons:
|
||||||
- ButtonName: Can't do, you drunk.
|
|
||||||
Type: 1
|
|
||||||
ButtonActions:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
- ButtonName: Sure thing friend.
|
- ButtonName: Sure thing friend.
|
||||||
Type: 1
|
Type: 1
|
||||||
ButtonActions:
|
ButtonActions:
|
||||||
@ -32,7 +27,7 @@ MonoBehaviour:
|
|||||||
m_Calls:
|
m_Calls:
|
||||||
- m_Target: {fileID: 11400000}
|
- m_Target: {fileID: 11400000}
|
||||||
m_TargetAssemblyTypeName: Dialogue, Assembly-CSharp
|
m_TargetAssemblyTypeName: Dialogue, Assembly-CSharp
|
||||||
m_MethodName: GoToNextSentence
|
m_MethodName: FinishDialogue
|
||||||
m_Mode: 1
|
m_Mode: 1
|
||||||
m_Arguments:
|
m_Arguments:
|
||||||
m_ObjectArgument: {fileID: 0}
|
m_ObjectArgument: {fileID: 0}
|
||||||
@ -42,12 +37,17 @@ MonoBehaviour:
|
|||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
|
- ButtonName: Can't do, you drunk.
|
||||||
|
Type: 1
|
||||||
|
ButtonActions:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
EndOfDialogueStepAction:
|
EndOfDialogueStepAction:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls:
|
m_Calls:
|
||||||
- m_Target: {fileID: 11400000, guid: 9696f03c8b09aaa47b9a8fe810886ea3, type: 2}
|
- m_Target: {fileID: 11400000, guid: 9696f03c8b09aaa47b9a8fe810886ea3, type: 2}
|
||||||
m_TargetAssemblyTypeName: MultiDialogue, Assembly-CSharp
|
m_TargetAssemblyTypeName: MultiDialogue, Assembly-CSharp
|
||||||
m_MethodName: GoToNextDialogue
|
m_MethodName: GoToNextDialogueWithoutFinalAction
|
||||||
m_Mode: 3
|
m_Mode: 3
|
||||||
m_Arguments:
|
m_Arguments:
|
||||||
m_ObjectArgument: {fileID: 0}
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 45b41589283138641ba006c2243b0637, type: 3}
|
m_Script: {fileID: 11500000, guid: 45b41589283138641ba006c2243b0637, type: 3}
|
||||||
m_Name: BarryMultiDialENG
|
m_Name: BarryMultiDialENG
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
SpeakerName:
|
SpeakerName: Barry
|
||||||
CurrentDialogue: 0
|
CurrentDialogue: 0
|
||||||
Dialogues:
|
Dialogues:
|
||||||
- Key: 0
|
- Key: 0
|
||||||
|
@ -12,83 +12,28 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 0a3bcdd1e2dba0c4791bcb151c0df6c1, type: 3}
|
m_Script: {fileID: 11500000, guid: 0a3bcdd1e2dba0c4791bcb151c0df6c1, type: 3}
|
||||||
m_Name: TestMission
|
m_Name: TestMission
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
MissionName: Test mission I
|
||||||
PlayerTask:
|
PlayerTask:
|
||||||
id: 0
|
id: 0
|
||||||
title:
|
title:
|
||||||
description:
|
description:
|
||||||
difficulty: 0
|
difficulty: 0
|
||||||
Type: 0
|
SpeakerName:
|
||||||
Status: 0
|
Status: 0
|
||||||
CurrentStep: 0
|
CurrentStep: 0
|
||||||
MissionStepsList:
|
MissionStepsList:
|
||||||
- SpeakerName:
|
- SpeakerName:
|
||||||
Status: 0
|
Status: 0
|
||||||
DialogueStep: {fileID: 0}
|
DialogueStepTemplate: {fileID: 11400000, guid: fe2810d79ff17f74eab5cf9a916167b4, type: 2}
|
||||||
missionProcess:
|
DialogueStep: {fileID: 11400000, guid: fe2810d79ff17f74eab5cf9a916167b4, type: 2}
|
||||||
Amount: 0
|
MissionConditions:
|
||||||
PrefabAsset: {fileID: 0}
|
Key: 0
|
||||||
_currentAmount: 0
|
Value:
|
||||||
NextStepCondition:
|
- Type: 0
|
||||||
m_PersistentCalls:
|
RequiredElements:
|
||||||
m_Calls:
|
- RequiredAmount: 1
|
||||||
- m_Target: {fileID: 11400000}
|
RequiredObject: {fileID: 8687962458953192462, guid: ae7e7f7d0d926174a8edae16f7f4d305, type: 3}
|
||||||
m_TargetAssemblyTypeName: Mission, Assembly-CSharp
|
|
||||||
m_MethodName: AssignMissionProcessToStep
|
|
||||||
m_Mode: 3
|
|
||||||
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
|
|
||||||
- SpeakerName:
|
|
||||||
Status: 0
|
|
||||||
DialogueStep: {fileID: 0}
|
|
||||||
missionProcess:
|
|
||||||
Amount: 0
|
|
||||||
PrefabAsset: {fileID: 0}
|
|
||||||
_currentAmount: 0
|
|
||||||
NextStepCondition:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
- SpeakerName:
|
|
||||||
Status: 0
|
|
||||||
DialogueStep: {fileID: 0}
|
|
||||||
missionProcess:
|
|
||||||
Amount: 0
|
|
||||||
PrefabAsset: {fileID: 0}
|
|
||||||
_currentAmount: 0
|
|
||||||
NextStepCondition:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
- SpeakerName:
|
|
||||||
Status: 0
|
|
||||||
DialogueStep: {fileID: 0}
|
|
||||||
missionProcess:
|
|
||||||
Amount: 0
|
|
||||||
PrefabAsset: {fileID: 0}
|
|
||||||
_currentAmount: 0
|
|
||||||
NextStepCondition:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls:
|
|
||||||
- m_Target: {fileID: 11400000}
|
|
||||||
m_TargetAssemblyTypeName: Mission, 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
|
|
||||||
missionProcess:
|
|
||||||
Amount: 0
|
|
||||||
PrefabAsset: {fileID: 0}
|
|
||||||
_currentAmount: 0
|
|
||||||
Reward:
|
Reward:
|
||||||
Items: []
|
Items:
|
||||||
Cash: 0
|
- {fileID: 11400000, guid: b366ff81d4bcf0d4f9633bbbf7ea17df, type: 2}
|
||||||
|
Cash: 500
|
||||||
|
@ -14493,6 +14493,30 @@ MonoBehaviour:
|
|||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
|
- m_Target: {fileID: 431601327}
|
||||||
|
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
|
||||||
|
m_MethodName: SaveAccountBalance
|
||||||
|
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: 431601327}
|
||||||
|
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
|
||||||
|
m_MethodName: SaveDialogues
|
||||||
|
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
|
||||||
--- !u!114 &431601330
|
--- !u!114 &431601330
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -14572,6 +14596,51 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: -20, y: 0}
|
m_SizeDelta: {x: -20, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!1 &456741522
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 456741523}
|
||||||
|
- component: {fileID: 456741524}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: DialogueManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &456741523
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 456741522}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 857141515}
|
||||||
|
m_RootOrder: 5
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &456741524
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 456741522}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1ebc89f7b8b469d448c3787923ceb966, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
MultiDialogueDataList: []
|
||||||
--- !u!1 &494020752
|
--- !u!1 &494020752
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -15783,6 +15852,7 @@ Transform:
|
|||||||
- {fileID: 425810219}
|
- {fileID: 425810219}
|
||||||
- {fileID: 132569182}
|
- {fileID: 132569182}
|
||||||
- {fileID: 1642689255}
|
- {fileID: 1642689255}
|
||||||
|
- {fileID: 456741523}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -56537,6 +56607,30 @@ MonoBehaviour:
|
|||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
|
- m_Target: {fileID: 2021738498}
|
||||||
|
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
|
||||||
|
m_MethodName: SaveAccountBalance
|
||||||
|
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: 2021738498}
|
||||||
|
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
|
||||||
|
m_MethodName: SaveDialogues
|
||||||
|
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
|
||||||
--- !u!114 &2021738500
|
--- !u!114 &2021738500
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -67,6 +67,7 @@ public class AnimatedDoorBehaviour : TriggerDoor
|
|||||||
|
|
||||||
SaveController.GetComponent<SaveController>().SaveChests();
|
SaveController.GetComponent<SaveController>().SaveChests();
|
||||||
SaveController.GetComponent<SaveController>().SaveShops();
|
SaveController.GetComponent<SaveController>().SaveShops();
|
||||||
|
SaveController.GetComponent<SaveController>().SaveDialogues();
|
||||||
|
|
||||||
// 2. Change scene
|
// 2. Change scene
|
||||||
SceneManager.LoadScene(gateway.nextMapName);
|
SceneManager.LoadScene(gateway.nextMapName);
|
||||||
|
@ -48,6 +48,7 @@ public class DoorBehaviour : MonoBehaviour
|
|||||||
|
|
||||||
SaveController.GetComponent<SaveController>().SaveChests();
|
SaveController.GetComponent<SaveController>().SaveChests();
|
||||||
SaveController.GetComponent<SaveController>().SaveShops();
|
SaveController.GetComponent<SaveController>().SaveShops();
|
||||||
|
SaveController.GetComponent<SaveController>().SaveDialogues();
|
||||||
|
|
||||||
// 2. Change scene
|
// 2. Change scene
|
||||||
SceneManager.LoadScene(gateway.nextMapName);
|
SceneManager.LoadScene(gateway.nextMapName);
|
||||||
|
@ -66,8 +66,7 @@ public class DialogueController
|
|||||||
{
|
{
|
||||||
if (listOfDialogue.Count == 0)
|
if (listOfDialogue.Count == 0)
|
||||||
{
|
{
|
||||||
CloseCurrentPanel(parentDialController);
|
FinishCurrentDialogue(parentDialController);
|
||||||
FinishDialoguStep();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -83,6 +82,17 @@ public class DialogueController
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function to close currently opened panel
|
||||||
|
/// And invoke final actions
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parentDialController"></param>
|
||||||
|
public void FinishCurrentDialogue(DialogueController parentDialController)
|
||||||
|
{
|
||||||
|
CloseCurrentPanel(parentDialController);
|
||||||
|
FinishDialoguStep();
|
||||||
|
}
|
||||||
|
|
||||||
public void CloseCurrentPanel(DialogueController parentDialController)
|
public void CloseCurrentPanel(DialogueController parentDialController)
|
||||||
{
|
{
|
||||||
MonoBehaviour.Destroy(parentDialController.CurrentPanel);
|
MonoBehaviour.Destroy(parentDialController.CurrentPanel);
|
||||||
|
@ -25,6 +25,22 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region finish action api
|
#region finish action api
|
||||||
|
public void SetActionAfterEachDialogueStep(UnityEvent _endOfDialogueStepAction)
|
||||||
|
{
|
||||||
|
foreach(var dialogueStep in DialogueSteps)
|
||||||
|
{
|
||||||
|
dialogueStep.SetActionAfterDialogueStep(_endOfDialogueStepAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetActionAfterEachDialogueStep(Action _finishDialogueAction)
|
||||||
|
{
|
||||||
|
foreach (var dialogueStep in DialogueSteps)
|
||||||
|
{
|
||||||
|
dialogueStep.SetActionAfterDialogueStep(_finishDialogueAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetActionAfterDialogueStep(int dialogueStepNo, UnityEvent _endOfDialogueStepAction)
|
public void SetActionAfterDialogueStep(int dialogueStepNo, UnityEvent _endOfDialogueStepAction)
|
||||||
{
|
{
|
||||||
if(DialogueSteps.Count >= dialogueStepNo)
|
if(DialogueSteps.Count >= dialogueStepNo)
|
||||||
@ -32,7 +48,7 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
}
|
}
|
||||||
public void SetActionAfterDialogueStep(int dialogueStepNo, Action _finishDialogueAction)
|
public void SetActionAfterDialogueStep(int dialogueStepNo, Action _finishDialogueAction)
|
||||||
{
|
{
|
||||||
Debug.Log(dialogueStepNo);
|
/* Debug.Log(dialogueStepNo); */
|
||||||
if (DialogueSteps.Count >= dialogueStepNo)
|
if (DialogueSteps.Count >= dialogueStepNo)
|
||||||
DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_finishDialogueAction);
|
DialogueSteps[dialogueStepNo].SetActionAfterDialogueStep(_finishDialogueAction);
|
||||||
}
|
}
|
||||||
@ -61,6 +77,60 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function to
|
||||||
|
/// - close panel
|
||||||
|
/// - INVOKE FINAL DIALOGUE ACTION
|
||||||
|
/// - mark as dispalyed
|
||||||
|
/// - increasing step number
|
||||||
|
///
|
||||||
|
/// Dont invoke final action!!!
|
||||||
|
/// </summary>
|
||||||
|
public void FinishDialogue()
|
||||||
|
{
|
||||||
|
foreach (var DialogueStep in DialogueSteps)
|
||||||
|
{
|
||||||
|
if (!DialogueStep.WasDisplayed)
|
||||||
|
{
|
||||||
|
// status must be changes before invoked final action - example - updating state
|
||||||
|
DialogueStep.WasDisplayed = true;
|
||||||
|
|
||||||
|
CurrentStep++;
|
||||||
|
|
||||||
|
DialogueStep.DialogueController.FinishCurrentDialogue(DialogueStep.DialogueController);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function to
|
||||||
|
/// - close panel
|
||||||
|
/// - mark as dispalyed
|
||||||
|
/// - increasing step number
|
||||||
|
///
|
||||||
|
/// Dont invoke final action!!!
|
||||||
|
/// </summary>
|
||||||
|
public void CloseDialogue()
|
||||||
|
{
|
||||||
|
foreach (var DialogueStep in DialogueSteps)
|
||||||
|
{
|
||||||
|
if (!DialogueStep.WasDisplayed)
|
||||||
|
{
|
||||||
|
DialogueStep.WasDisplayed = true;
|
||||||
|
|
||||||
|
CurrentStep++;
|
||||||
|
|
||||||
|
DialogueStep.DialogueController.CloseCurrentPanel(DialogueStep.DialogueController);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dialogue API
|
/// Dialogue API
|
||||||
///
|
///
|
||||||
@ -128,7 +198,6 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
public void GoToNextSentence()
|
public void GoToNextSentence()
|
||||||
{
|
{
|
||||||
// wskazujemy na inny krok kolejno niz nieoznaczony
|
// wskazujemy na inny krok kolejno niz nieoznaczony
|
||||||
Debug.Log($"Step befor next: {CurrentStep}");
|
|
||||||
// MISLEADING - last sentence mark step ad "wasDisplayed" but not increase "CurrentPanel" index
|
// MISLEADING - last sentence mark step ad "wasDisplayed" but not increase "CurrentPanel" index
|
||||||
|
|
||||||
foreach (var DialogueStep in DialogueSteps)
|
foreach (var DialogueStep in DialogueSteps)
|
||||||
@ -137,13 +206,12 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
{
|
{
|
||||||
var nextSentence = DialogueStep.DialogueController.ShowNextPanel(DialogueStep.DialogueController);
|
var nextSentence = DialogueStep.DialogueController.ShowNextPanel(DialogueStep.DialogueController);
|
||||||
|
|
||||||
Debug.Log($"GoToNextSentence - {nextSentence}");
|
|
||||||
if (!nextSentence)
|
if (!nextSentence)
|
||||||
{
|
{
|
||||||
DialogueStep.WasDisplayed = true;
|
DialogueStep.WasDisplayed = true;
|
||||||
|
|
||||||
CurrentStep++;
|
CurrentStep++;
|
||||||
Debug.Log($"Step after: {CurrentStep}");
|
|
||||||
ShowDialogueStepPanel();
|
ShowDialogueStepPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,8 +219,24 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void InvokeFinalAction()
|
||||||
|
{
|
||||||
|
foreach (var DialogueStep in DialogueSteps)
|
||||||
|
{
|
||||||
|
if (!DialogueStep.WasDisplayed)
|
||||||
|
{
|
||||||
|
DialogueStep.DialogueController.FinishDialoguStep();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void BuildDialogue()
|
public void BuildDialogue()
|
||||||
{
|
{
|
||||||
BuildDialogue(DialogueSteps);
|
BuildDialogue(DialogueSteps);
|
||||||
@ -163,8 +247,6 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void BuildDialogue(List<DialogueStepModel> Dialogue)
|
public void BuildDialogue(List<DialogueStepModel> Dialogue)
|
||||||
{
|
{
|
||||||
Debug.Log("BuildDialogue");
|
|
||||||
|
|
||||||
foreach (var dialogueStep in Dialogue)
|
foreach (var dialogueStep in Dialogue)
|
||||||
{
|
{
|
||||||
dialogueStep.Header = SpeakerName;
|
dialogueStep.Header = SpeakerName;
|
||||||
@ -173,16 +255,10 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
|
|
||||||
// synchronize current step counter
|
// synchronize current step counter
|
||||||
// cause ERROR - multi counting ....
|
// cause ERROR - multi counting ....
|
||||||
/* if (dialogueStep.WasDisplayed)
|
|
||||||
CurrentStep++;*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BuildDialogue()
|
#region Dialogue Status API
|
||||||
{
|
|
||||||
BuildDialogue(DialogueSteps);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Function to reset rememebered dialogue status
|
/// Function to reset rememebered dialogue status
|
||||||
///
|
///
|
||||||
@ -205,6 +281,7 @@ public class Dialogue : ScriptableObject, IDialogue
|
|||||||
DialogueSteps[i].WasDisplayed = dialogueData.DialogueStepModelDataList[i].WasDisplayed;
|
DialogueSteps[i].WasDisplayed = dialogueData.DialogueStepModelDataList[i].WasDisplayed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public DialogueStepModel GetCurrentStep()
|
public DialogueStepModel GetCurrentStep()
|
||||||
{// TODO - argument out of colection :/
|
{// TODO - argument out of colection :/
|
||||||
|
@ -37,67 +37,18 @@ public class DialogueManager : MonoBehaviour
|
|||||||
public bool OpenInDefaultWay = true;
|
public bool OpenInDefaultWay = true;
|
||||||
|
|
||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
|
{
|
||||||
|
if(languageDetector.InstanceTemplates.Count() > 0)
|
||||||
{
|
{
|
||||||
// create and config dailogue
|
// create and config dailogue
|
||||||
CreateInstanceBasedOnLanguage();
|
CreateInstanceBasedOnLanguage();
|
||||||
|
|
||||||
Dialogue.BuildCurrentDialogue();
|
Dialogue.BuildCurrentDialogue();
|
||||||
|
}
|
||||||
/*
|
|
||||||
Debug.Log(Dialogue.DialogueStepStatus());
|
|
||||||
Debug.Log(Dialogue
|
|
||||||
.Dialogues
|
|
||||||
.Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1)
|
|
||||||
.First()
|
|
||||||
.Value);
|
|
||||||
|
|
||||||
Debug.Log(
|
|
||||||
Dialogue
|
|
||||||
.Dialogues
|
|
||||||
.Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1)
|
|
||||||
.First()
|
|
||||||
.Value
|
|
||||||
.DialogueSteps.Count());
|
|
||||||
|
|
||||||
Debug.Log(
|
|
||||||
Dialogue
|
|
||||||
.Dialogues
|
|
||||||
.Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1)
|
|
||||||
.First()
|
|
||||||
.Value
|
|
||||||
.DialogueSteps
|
|
||||||
.ElementAtOrDefault(Dialogue.DialogueStepStatus().Item2)
|
|
||||||
);
|
|
||||||
|
|
||||||
Debug.Log(
|
|
||||||
Dialogue
|
|
||||||
.Dialogues
|
|
||||||
.Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1)
|
|
||||||
.First()
|
|
||||||
.Value
|
|
||||||
.DialogueSteps
|
|
||||||
.ElementAtOrDefault(Dialogue.DialogueStepStatus().Item2)
|
|
||||||
.DialogueController
|
|
||||||
);
|
|
||||||
|
|
||||||
Debug.Log(
|
|
||||||
Dialogue
|
|
||||||
.Dialogues
|
|
||||||
.Where(dialogue => dialogue.Key == Dialogue.DialogueStepStatus().Item1)
|
|
||||||
.First()
|
|
||||||
.Value
|
|
||||||
.DialogueSteps
|
|
||||||
.ElementAtOrDefault(Dialogue.DialogueStepStatus().Item2)
|
|
||||||
.DialogueController
|
|
||||||
.listOfDialogue.Count()
|
|
||||||
);
|
|
||||||
|
|
||||||
Debug.Log(GetCurrentDialoguePanelStatus());
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Update()
|
public virtual void Update()
|
||||||
{
|
{
|
||||||
if (OpenInDefaultWay && Input.GetKeyDown(keyToOpen) && OpenPanelCondition())
|
if (OpenInDefaultWay && Input.GetKeyDown(keyToOpen) && OpenPanelCondition())
|
||||||
{
|
{
|
||||||
@ -115,22 +66,22 @@ public class DialogueManager : MonoBehaviour
|
|||||||
if (collision.gameObject.tag == "Player")
|
if (collision.gameObject.tag == "Player")
|
||||||
{
|
{
|
||||||
CanBeOpened = true;
|
CanBeOpened = true;
|
||||||
|
|
||||||
SpeakerName = collision.gameObject.name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnTriggerExit2D(Collider2D collision)
|
public virtual void OnTriggerExit2D(Collider2D collision)
|
||||||
{
|
{
|
||||||
// don't listen when component is disabled
|
// don't listen when component is disabled
|
||||||
if (ComponentEnabledCondition() || !OpenInDefaultWay)
|
if (ComponentEnabledCondition())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (collision.gameObject.tag == "Player")
|
if (collision.gameObject.tag == "Player")
|
||||||
{
|
{
|
||||||
CanBeOpened = false;
|
CanBeOpened = false;
|
||||||
|
|
||||||
if (GetCurrentDialoguePanelStatus())
|
// Shop dont have dialoge in this script but in its own one
|
||||||
|
// TODO change - pass eachd ialogue to this script and use conditions from child class
|
||||||
|
if (Dialogue != null && GetCurrentDialoguePanelStatus())
|
||||||
{
|
{
|
||||||
Dialogue.BreakDialogueStep();
|
Dialogue.BreakDialogueStep();
|
||||||
}
|
}
|
||||||
@ -139,13 +90,26 @@ public class DialogueManager : MonoBehaviour
|
|||||||
|
|
||||||
public virtual void CreateInstanceBasedOnLanguage()
|
public virtual void CreateInstanceBasedOnLanguage()
|
||||||
{
|
{
|
||||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
// DONT CLONE TO HAVE CONSTANT DATA - init - deep copy - to prevent overwritting chil;dern :D
|
||||||
|
Dialogue = languageDetector.DetectInstanceBasedOnLanguage();
|
||||||
|
|
||||||
|
Dialogue.ResetDialogue();
|
||||||
|
/* var cloneDialogues = new List<IndexValuePair<int, Dialogue>>(Dialogue.Dialogues);
|
||||||
|
|
||||||
|
Dialogue.Dialogues.Clear();
|
||||||
|
foreach (var dial in cloneDialogues)
|
||||||
|
{
|
||||||
|
Dialogue.Dialogues.Add(new IndexValuePair<int, Dialogue>(dial.Key, Instantiate(dial.Value)));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
Dialogue.SetSpeakerName(PlayerPrefs.GetString("name"));
|
||||||
|
|
||||||
// Bind setted actions
|
// Bind setted actions
|
||||||
BindEndActionsToDialogues();
|
BindEndActionsToDialogues();
|
||||||
|
|
||||||
// Add one more action
|
// Add one more action - to reset proggress
|
||||||
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterDialogueStep(dial.Key, dial.Value.ResetDialogue)); // reset dial
|
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterEachDialogueStep(dial.Value.ResetDialogue)); // reset dial
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Open Panel API
|
#region Open Panel API
|
||||||
@ -153,9 +117,6 @@ public class DialogueManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if(OpenPanelCondition())
|
if(OpenPanelCondition())
|
||||||
{
|
{
|
||||||
// Update speaker name before every opening
|
|
||||||
Dialogue.SetSpeakerName(SpeakerName);
|
|
||||||
|
|
||||||
gameObject.GetComponent<DialogueManager>().Dialogue.StartDialogue();
|
gameObject.GetComponent<DialogueManager>().Dialogue.StartDialogue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,17 +148,30 @@ public class DialogueManager : MonoBehaviour
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual bool GetCurrentDialoguePanelStatus()
|
public virtual bool GetCurrentDialoguePanelStatus()
|
||||||
{
|
{
|
||||||
Debug.Log(Dialogue);
|
|
||||||
var multiDialStatius = Dialogue.DialogueStepStatus();
|
var multiDialStatius = Dialogue.DialogueStepStatus();
|
||||||
Debug.Log(multiDialStatius);
|
Debug.Log(multiDialStatius);
|
||||||
|
// parse result (dialoge no, step no)
|
||||||
|
// dialogue not exist - finished
|
||||||
|
// dialoge exists & step no > steps sum - finished
|
||||||
|
// dialoge no exists && step no exists - not finished - check panel status
|
||||||
|
|
||||||
Debug.Log(Dialogue
|
if(!Dialogue.Dialogues.Where(dial => dial.Key == multiDialStatius.Item1).Any())
|
||||||
.Dialogues
|
return false;
|
||||||
.Where(dialogue => dialogue.Key == multiDialStatius.Item1)
|
|
||||||
.First()
|
|
||||||
.Value
|
|
||||||
.DialogueSteps);
|
|
||||||
|
|
||||||
|
var fixedDialogue = Dialogue.Dialogues.Where(dial => dial.Key == multiDialStatius.Item1).First().Value;
|
||||||
|
|
||||||
|
if (fixedDialogue.CurrentStep >= fixedDialogue.DialogueSteps.Count())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// CONTINUE dont increment counter - only mark checkboxes
|
||||||
|
if (fixedDialogue
|
||||||
|
.DialogueSteps
|
||||||
|
.Where(step => step.WasDisplayed == false)
|
||||||
|
.ToArray()
|
||||||
|
.Count() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// when we are here we can be sure given points are correct
|
||||||
return Dialogue
|
return Dialogue
|
||||||
.Dialogues
|
.Dialogues
|
||||||
.Where(dialogue => dialogue.Key == multiDialStatius.Item1)
|
.Where(dialogue => dialogue.Key == multiDialStatius.Item1)
|
||||||
|
@ -72,6 +72,13 @@ public class DialogueStepModel
|
|||||||
EndOfDialogueStepAction.AddListener(new UnityAction(_finishDialogueAction));
|
EndOfDialogueStepAction.AddListener(new UnityAction(_finishDialogueAction));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// new function - now we should change all places closing open panels toi use its not manually close
|
||||||
|
public void ClosePanel()
|
||||||
|
{
|
||||||
|
if (DialogueController != null && DialogueController.CurrentPanel != null)
|
||||||
|
DialogueController.CloseCurrentPanel();
|
||||||
|
}
|
||||||
|
|
||||||
public void MarkAsDisplayed()
|
public void MarkAsDisplayed()
|
||||||
{
|
{
|
||||||
WasDisplayed = true;
|
WasDisplayed = true;
|
||||||
|
@ -29,27 +29,6 @@ public class MultiDialogue : ScriptableObject, IDialogue
|
|||||||
* Jesli przechodzimy odpowiedzia do nastepnego dialogu musi to byc osttani panel w obecnym!!!
|
* Jesli przechodzimy odpowiedzia do nastepnego dialogu musi to byc osttani panel w obecnym!!!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
/* CODE DIALOGUE DECLARATION EXAMPLE
|
|
||||||
|
|
||||||
DialogueController DialogueStep = new DialogueController();
|
|
||||||
DialogueStep.AddSentence(new DialogueModel("lorem ipsum"));
|
|
||||||
*//* di.AddSentence(new QuestionDialogueModel("tolore dolore?",
|
|
||||||
new List<Tuple<string, Action>> {
|
|
||||||
new Tuple<string, Action>("AcceptButton", CustomPanel),
|
|
||||||
new Tuple<string, Action>("RejectButton", QuestionPanel)
|
|
||||||
}));*//*
|
|
||||||
DialogueStep.SetActionAfterDialogueEnds(() => { });
|
|
||||||
|
|
||||||
DialogueStepModel dialogueStepModel = new DialogueStepModel(DialogueStep);
|
|
||||||
|
|
||||||
DialogueStepsList = new List<DialogueStepModel> { dialogueStepModel };
|
|
||||||
*/
|
|
||||||
/*if (MultiWayDialogue.Count > 0)
|
|
||||||
BuildDialogue(MultiWayDialogue.Where(el => el.Key == CurrentDialogue).First().Value);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetSpeakerName(string speakerName)
|
public void SetSpeakerName(string speakerName)
|
||||||
{
|
{
|
||||||
SpeakerName = speakerName;
|
SpeakerName = speakerName;
|
||||||
@ -101,23 +80,33 @@ public class MultiDialogue : ScriptableObject, IDialogue
|
|||||||
/// Dialogue API
|
/// Dialogue API
|
||||||
///
|
///
|
||||||
/// Function to prepare next dialogue to start after one more palyer interaction with actor
|
/// Function to prepare next dialogue to start after one more palyer interaction with actor
|
||||||
/// - ends current dialogue (destroy panel & invoke finish action - if setupped)
|
/// - ends current dialogue (destroy panel & invoke finish action!! - if setupped)
|
||||||
/// - set new dialogue pointer
|
/// - set new dialogue pointer
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dialogueNumber"></param>
|
/// <param name="dialogueNumber"></param>
|
||||||
public void SetNextDialogue(int dialogueNumber)
|
public void SetNextDialogue(int dialogueNumber)
|
||||||
{
|
{
|
||||||
Debug.Log("----------------- SetNextDialogue");
|
|
||||||
Debug.Log(dialogueNumber);
|
|
||||||
if (Dialogues.Where(el => el.Key == dialogueNumber).ToArray().Count() == 0)
|
if (Dialogues.Where(el => el.Key == dialogueNumber).ToArray().Count() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped
|
||||||
|
Dialogues.Where(el => el.Key == CurrentDialogue).ToArray().First().Value.FinishDialogue();
|
||||||
|
|
||||||
// 2. Chane index
|
// 2. Chane index
|
||||||
CurrentDialogue = dialogueNumber;
|
CurrentDialogue = dialogueNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNextDialogueWithoutFinalAction(int dialogueNumber)
|
||||||
|
{
|
||||||
|
if (Dialogues.Where(el => el.Key == dialogueNumber).ToArray().Count() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
// 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped
|
// 1. Make sure to close current panel after finishing current dialogue and 'finish action' will invoked if setuped
|
||||||
GoToNextSentence();
|
Dialogues.Where(el => el.Key == CurrentDialogue).ToArray().First().Value.CloseDialogue();
|
||||||
|
|
||||||
|
// 2. Chane index
|
||||||
|
CurrentDialogue = dialogueNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -132,7 +121,32 @@ public class MultiDialogue : ScriptableObject, IDialogue
|
|||||||
// 1. Prepare necessary environoment parts
|
// 1. Prepare necessary environoment parts
|
||||||
SetNextDialogue(dialogueNumber);
|
SetNextDialogue(dialogueNumber);
|
||||||
|
|
||||||
// 2. Build new (next) dialogue & show panel
|
// 2. Update proggress
|
||||||
|
// Savintg one more time because saving in final action invoking by line above
|
||||||
|
// dont contain increased 'CurrentDialogue' index pointer !!!
|
||||||
|
//((MultiDialogueDataManager)MultiDialogueDataManager.Instance).RegisterDialogue(this);
|
||||||
|
|
||||||
|
// 3. Build new (next) dialogue & show panel
|
||||||
|
StartDialogue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function like one above but
|
||||||
|
/// PREFPARED AS FINAL ACTION IN DIALOGUE WHICH IS INVOKED VIA 'Dialogue.FinishDialoge'
|
||||||
|
/// to prevent looping Final aCTION INVOKING
|
||||||
|
/// once from 'Dialogue.FinishDialoge' in button next time from 'MultiDialogue.SetNextDialogue -> FinishDialogue' ....
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dialogueNumber"></param>
|
||||||
|
public void GoToNextDialogueWithoutFinalAction(int dialogueNumber)
|
||||||
|
{
|
||||||
|
// 1. Prepare necessary environoment parts
|
||||||
|
SetNextDialogueWithoutFinalAction(dialogueNumber);
|
||||||
|
|
||||||
|
// 2. Update proggress
|
||||||
|
//((MultiDialogueDataManager)MultiDialogueDataManager.Instance).RegisterDialogue(this);
|
||||||
|
|
||||||
|
|
||||||
|
// 3. Build new (next) dialogue & show panel
|
||||||
StartDialogue();
|
StartDialogue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,12 +184,23 @@ public class MultiDialogue : ScriptableObject, IDialogue
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetDialogue()
|
public void ResetDialogue()
|
||||||
{
|
{
|
||||||
|
SpeakerName = "";
|
||||||
|
CurrentDialogue = 0;
|
||||||
|
|
||||||
|
Dialogues.ForEach(dial => dial.Value.SetSpeakerName(""));
|
||||||
|
Dialogues.ForEach(dial => dial.Value.CurrentStep = 0);
|
||||||
Dialogues.ForEach(dial => dial.Value.DialogueSteps.ForEach(step => step.WasDisplayed = false));
|
Dialogues.ForEach(dial => dial.Value.DialogueSteps.ForEach(step => step.WasDisplayed = false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public (int, int) DialogueStepStatus()
|
public (int, int) DialogueStepStatus()
|
||||||
{
|
{
|
||||||
Debug.Log(CurrentDialogue);
|
/* var currentStep = Dialogues
|
||||||
|
.Where(el => el.Key == CurrentDialogue)
|
||||||
|
.Select(el => el.Value)
|
||||||
|
.First()
|
||||||
|
.CurrentStep
|
||||||
|
;*/
|
||||||
|
|
||||||
var currentDialogueStepIndex = Dialogues
|
var currentDialogueStepIndex = Dialogues
|
||||||
.Where(el => el.Key == CurrentDialogue)
|
.Where(el => el.Key == CurrentDialogue)
|
||||||
.Select(el => el.Value)
|
.Select(el => el.Value)
|
||||||
|
@ -64,7 +64,7 @@ class SaveMissionDialogueManager : SaveModelSystem<MissionDialogue>
|
|||||||
// 1. From model to data format
|
// 1. From model to data format
|
||||||
public static MissionDialogueData ConvertObjectToDataModel(MissionDialogue model)
|
public static MissionDialogueData ConvertObjectToDataModel(MissionDialogue model)
|
||||||
{
|
{
|
||||||
return new MissionDialogueData(); //model
|
return new MissionDialogueData(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<MissionDialogueData> ConvertObjectsListToListOfDataModels(List<MissionDialogue> modelsList)
|
public static List<MissionDialogueData> ConvertObjectsListToListOfDataModels(List<MissionDialogue> modelsList)
|
||||||
|
@ -10,6 +10,9 @@ class MultiDialogueDataManager : SceneBaseDataManager<MultiDialogueData>
|
|||||||
protected override string OBJECT_FOLDER_NAME { get { return "MultiDialogue"; } }
|
protected override string OBJECT_FOLDER_NAME { get { return "MultiDialogue"; } }
|
||||||
protected override string OBJECT_LIST_NAME { get { return "MultiDialogueList"; } }
|
protected override string OBJECT_LIST_NAME { get { return "MultiDialogueList"; } }
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
public List<MultiDialogueData> MultiDialogueDataList;
|
||||||
|
|
||||||
public override void Awake()
|
public override void Awake()
|
||||||
{
|
{
|
||||||
if (Instance == null)
|
if (Instance == null)
|
||||||
@ -37,8 +40,7 @@ class MultiDialogueDataManager : SceneBaseDataManager<MultiDialogueData>
|
|||||||
base.Start();
|
base.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - save ChestPrefabAsset (we need to save coords...) but in manager handle Chest data..
|
|
||||||
//
|
|
||||||
protected override void AfterStart()
|
protected override void AfterStart()
|
||||||
{
|
{
|
||||||
if (OnMapAppearanceMethod.GameStatus == GameStatus.NewGame)
|
if (OnMapAppearanceMethod.GameStatus == GameStatus.NewGame)
|
||||||
@ -70,7 +72,9 @@ class MultiDialogueDataManager : SceneBaseDataManager<MultiDialogueData>
|
|||||||
protected override void UseDefaultSettings()
|
protected override void UseDefaultSettings()
|
||||||
{
|
{
|
||||||
DynamicDataList.SetList(new List<MultiDialogueData>());
|
DynamicDataList.SetList(new List<MultiDialogueData>());
|
||||||
UiManager.SetList(new List<MultiDialogueData>());
|
|
||||||
|
MultiDialogueDataList = DynamicDataList.GetList();
|
||||||
|
|
||||||
// we dont need to convert anything
|
// we dont need to convert anything
|
||||||
// Instead of build elements on scene we collect shops distracted on scene from npc's
|
// Instead of build elements on scene we collect shops distracted on scene from npc's
|
||||||
}
|
}
|
||||||
@ -83,67 +87,59 @@ class MultiDialogueDataManager : SceneBaseDataManager<MultiDialogueData>
|
|||||||
|
|
||||||
LoadDynamicData();
|
LoadDynamicData();
|
||||||
|
|
||||||
|
|
||||||
// VERy VERY provisional SOLUTION
|
// VERy VERY provisional SOLUTION
|
||||||
if (DynamicDataList.GetList().Count == 0)
|
if (DynamicDataList.GetList().Count == 0)
|
||||||
{
|
{
|
||||||
UseDefaultSettings();
|
UseDefaultSettings();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UiManager.SetList(DynamicDataList.GetList());
|
MultiDialogueDataList = DynamicDataList.GetList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void RegisterDialogue(MultiDialogue newDialogue)
|
public void RegisterDialogue(MultiDialogue newDialogue)
|
||||||
{
|
{
|
||||||
if (DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).Any())
|
if (DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).Any())
|
||||||
Debug.LogError("In MultiDialgoue Manager there is register this dialogue already");
|
{
|
||||||
|
// if dial is already registered - update it
|
||||||
|
UpdateDialogue(newDialogue);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var multiDialogueData = SaveMultiDialogueManager.ConvertObjectToDataModel(newDialogue);
|
var multiDialogueData = SaveMultiDialogueManager.ConvertObjectToDataModel(newDialogue);
|
||||||
|
|
||||||
DynamicDataList.AddElementToList(multiDialogueData);
|
//DynamicDataList.AddElementToList(multiDialogueData); - nie dodwaca bo modyfikacja jednej duplikuje
|
||||||
|
MultiDialogueDataList.Add(multiDialogueData);
|
||||||
UiManager.SetList(DynamicDataList.GetList());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update proggress in dialogue - BUT FUNCTION BELOW SYNCH THIS ALREADY righhr???
|
// update proggress in dialogue - BUT FUNCTION BELOW SYNCH THIS ALREADY righhr???
|
||||||
public void UpdateDialogue(MultiDialogue newDialogue)
|
public void UpdateDialogue(MultiDialogue newDialogue)
|
||||||
{
|
{
|
||||||
Debug.Log("Update multi-dialogue ion manager list");
|
if (!DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).Any())
|
||||||
if (DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).Any())
|
Debug.LogError($"There is no registered dialoge like {newDialogue.SpeakerName}");
|
||||||
Debug.LogError("In MultiDialgoue Manager there is register this dialogue already");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Debug.Log($"Dialogue {newDialogue.SpeakerName} - updated");
|
||||||
|
|
||||||
var multiDialogueData = SaveMultiDialogueManager.ConvertObjectToDataModel(newDialogue);
|
var multiDialogueData = SaveMultiDialogueManager.ConvertObjectToDataModel(newDialogue);
|
||||||
|
|
||||||
DynamicDataList.AddElementToList(multiDialogueData);
|
|
||||||
|
|
||||||
UiManager.SetList(DynamicDataList.GetList());
|
MultiDialogueDataList.RemoveAll(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName);
|
||||||
|
|
||||||
|
// duplicated from registerDialogue
|
||||||
|
MultiDialogueDataList.Add(multiDialogueData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiDialogueData GetDialogue(MultiDialogue newDialogue)
|
public MultiDialogueData? GetDialogue(MultiDialogue newDialogue)
|
||||||
{
|
{
|
||||||
return DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).First();
|
return DynamicDataList.GetList().Where(dialogue => dialogue.SpeakerName == newDialogue.SpeakerName).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SaveDynamicData()
|
public override bool SaveDynamicData()
|
||||||
{
|
{
|
||||||
// TODO
|
return SaveData(MultiDialogueDataList, SceneElementTypeEnum.Dynamic);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,12 +17,27 @@ public class NpcDialogueManager : DialogueManager
|
|||||||
|
|
||||||
// UPDATE DIALOGUE
|
// UPDATE DIALOGUE
|
||||||
// search in scene manager list
|
// search in scene manager list
|
||||||
var machedDialogueData = ((MultiDialogueDataManager)MultiDialogueDataManager.Instance).GetDialogue(Dialogue);
|
if (Dialogue != null)
|
||||||
if(Dialogue != null && machedDialogueData != null)
|
{
|
||||||
|
var machedDialogueData = ((MultiDialogueDataManager)MultiDialogueDataManager.Instance).GetDialogue(Dialogue);
|
||||||
|
|
||||||
|
if (machedDialogueData != null)
|
||||||
{
|
{
|
||||||
Debug.Log("Multi Dialogue - updated");
|
|
||||||
UpdateDialogueState(machedDialogueData);
|
UpdateDialogueState(machedDialogueData);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateProggres();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(keyToOpen) && OpenPanelCondition())
|
||||||
|
{
|
||||||
|
OpenDialoguePanel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Open Panel API
|
#region Open Panel API
|
||||||
@ -42,10 +57,30 @@ public class NpcDialogueManager : DialogueManager
|
|||||||
return !gameObject.GetComponent<NpcDialogueManager>().enabled;
|
return !gameObject.GetComponent<NpcDialogueManager>().enabled;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void CreateInstanceBasedOnLanguage()
|
public override void CreateInstanceBasedOnLanguage()
|
||||||
{
|
{
|
||||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
// DONT CLONE TO HAVE CONSTANT DATA - init - deep copy - to prevent overwritting chil;dern :D
|
||||||
|
Dialogue = languageDetector.DetectInstanceBasedOnLanguage();
|
||||||
|
|
||||||
|
Dialogue.ResetDialogue();
|
||||||
|
|
||||||
|
/* var cloneDialogues = new List<IndexValuePair<int, Dialogue>>(Dialogue.Dialogues);
|
||||||
|
|
||||||
|
Dialogue.Dialogues.Clear();
|
||||||
|
foreach (var dial in cloneDialogues)
|
||||||
|
{
|
||||||
|
Dialogue.Dialogues.Add(new IndexValuePair<int, Dialogue>(dial.Key, Instantiate(dial.Value)));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
Dialogue.SetSpeakerName(gameObject.GetComponent<NPC>().Name);
|
||||||
|
|
||||||
|
// Bind setted actions
|
||||||
|
BindEndActionsToDialogues();
|
||||||
|
|
||||||
|
// update dial state - sync in order to prepare to save
|
||||||
|
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterEachDialogueStep(UpdateProggres));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDialogueState(MultiDialogueData dialogueData)
|
public void UpdateDialogueState(MultiDialogueData dialogueData)
|
||||||
@ -64,6 +99,15 @@ public class NpcDialogueManager : DialogueManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function to sync local dialogue state with remote one
|
||||||
|
/// Handled in Scene Manager
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateProggres()
|
||||||
|
{
|
||||||
|
((MultiDialogueDataManager)MultiDialogueDataManager.Instance).RegisterDialogue(Dialogue);
|
||||||
|
}
|
||||||
|
|
||||||
#region Dialogue actions API
|
#region Dialogue actions API
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Function to invoke actions declared in manager on object from scene not onto asset
|
/// Function to invoke actions declared in manager on object from scene not onto asset
|
||||||
|
@ -107,7 +107,7 @@ public class SceneShopDataManager : SceneBaseDataManager<Shop>
|
|||||||
{
|
{
|
||||||
Debug.Log(DynamicDataList);
|
Debug.Log(DynamicDataList);
|
||||||
if (DynamicDataList.GetList().Where(shop => shop.Npc == newShop.Npc && shop.Map == SceneManager.GetActiveScene().name).Any())
|
if (DynamicDataList.GetList().Where(shop => shop.Npc == newShop.Npc && shop.Map == SceneManager.GetActiveScene().name).Any())
|
||||||
Debug.LogError("In Shop Manager there is register this shop already");
|
Debug.LogWarning("In Shop Manager there is register this shop already");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DynamicDataList.AddElementToList(newShop);
|
DynamicDataList.AddElementToList(newShop);
|
||||||
|
@ -154,6 +154,7 @@ public abstract class SceneBaseDataManager<T> : MonoBehaviour
|
|||||||
// approach:
|
// approach:
|
||||||
// 1. get from outside, update local list && us it
|
// 1. get from outside, update local list && us it
|
||||||
// 2. Handle list synchronized all the time & pass local list
|
// 2. Handle list synchronized all the time & pass local list
|
||||||
|
Debug.Log(DynamicDataList.GetList());
|
||||||
return SaveData(DynamicDataList.GetList(), SceneElementTypeEnum.Dynamic);
|
return SaveData(DynamicDataList.GetList(), SceneElementTypeEnum.Dynamic);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -55,7 +55,7 @@ public abstract class WarehousePanelController : DraggablePanelController
|
|||||||
{
|
{
|
||||||
if (slot.Value != null)
|
if (slot.Value != null)
|
||||||
{
|
{
|
||||||
Debug.Log($"Slot nr: {slot.Key} with item: {slot.Value}");
|
/* Debug.Log($"Slot nr: {slot.Key} with item: {slot.Value}"); */
|
||||||
UiManager.Add(new IndexValuePair<int, EquippableItem>(slot.Key, slot.Value));
|
UiManager.Add(new IndexValuePair<int, EquippableItem>(slot.Key, slot.Value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -109,19 +109,19 @@ public abstract class UIBaseManager<T> : MonoBehaviour, ManagerInterface<T>
|
|||||||
|
|
||||||
private async void animateOpening()
|
private async void animateOpening()
|
||||||
{
|
{
|
||||||
GameObject.Find("Gold Chest").GetComponent<Animator>().SetTrigger("OpenIt");
|
/* GameObject.Find("Gold Chest").GetComponent<Animator>().SetTrigger("OpenIt");
|
||||||
GameObject.Find("Prize Chest").GetComponent<Animator>().SetTrigger("OpenIt");
|
GameObject.Find("Prize Chest").GetComponent<Animator>().SetTrigger("OpenIt");
|
||||||
GameObject.Find("Wodden Chest").GetComponent<Animator>().SetTrigger("OpenIt");
|
GameObject.Find("Wodden Chest").GetComponent<Animator>().SetTrigger("OpenIt");*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void animateClosing()
|
private async void animateClosing()
|
||||||
{
|
{
|
||||||
GameObject.Find("Gold Chest").GetComponent<Animator>().ResetTrigger("OpenIt");
|
/* GameObject.Find("Gold Chest").GetComponent<Animator>().ResetTrigger("OpenIt");
|
||||||
GameObject.Find("Prize Chest").GetComponent<Animator>().ResetTrigger("OpenIt");
|
GameObject.Find("Prize Chest").GetComponent<Animator>().ResetTrigger("OpenIt");
|
||||||
GameObject.Find("Wodden Chest").GetComponent<Animator>().ResetTrigger("OpenIt");
|
GameObject.Find("Wodden Chest").GetComponent<Animator>().ResetTrigger("OpenIt");
|
||||||
GameObject.Find("Gold Chest").GetComponent<Animator>().SetTrigger("CloseIt");
|
GameObject.Find("Gold Chest").GetComponent<Animator>().SetTrigger("CloseIt");
|
||||||
GameObject.Find("Prize Chest").GetComponent<Animator>().SetTrigger("CloseIt");
|
GameObject.Find("Prize Chest").GetComponent<Animator>().SetTrigger("CloseIt");
|
||||||
GameObject.Find("Wodden Chest").GetComponent<Animator>().SetTrigger("CloseIt");
|
GameObject.Find("Wodden Chest").GetComponent<Animator>().SetTrigger("CloseIt");*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void resettriggers()
|
private async void resettriggers()
|
||||||
@ -132,12 +132,12 @@ public abstract class UIBaseManager<T> : MonoBehaviour, ManagerInterface<T>
|
|||||||
await System.Threading.Tasks.Task.Yield();
|
await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject.Find("Gold Chest").GetComponent<Animator>().ResetTrigger("CloseIt");
|
/* GameObject.Find("Gold Chest").GetComponent<Animator>().ResetTrigger("CloseIt");
|
||||||
GameObject.Find("Prize Chest").GetComponent<Animator>().ResetTrigger("CloseIt");
|
GameObject.Find("Prize Chest").GetComponent<Animator>().ResetTrigger("CloseIt");
|
||||||
GameObject.Find("Wodden Chest").GetComponent<Animator>().ResetTrigger("CloseIt");
|
GameObject.Find("Wodden Chest").GetComponent<Animator>().ResetTrigger("CloseIt");
|
||||||
GameObject.Find("Wodden Chest").GetComponent<Animator>().SetTrigger("reactivate");
|
GameObject.Find("Wodden Chest").GetComponent<Animator>().SetTrigger("reactivate");
|
||||||
GameObject.Find("Prize Chest").GetComponent<Animator>().SetTrigger("reactivate");
|
GameObject.Find("Prize Chest").GetComponent<Animator>().SetTrigger("reactivate");
|
||||||
GameObject.Find("Gold Chest").GetComponent<Animator>().SetTrigger("reactivate");
|
GameObject.Find("Gold Chest").GetComponent<Animator>().SetTrigger("reactivate");*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool OpenPanel()
|
public virtual bool OpenPanel()
|
||||||
|
@ -84,8 +84,8 @@ public abstract class UIWarehouseManager : UISlotPanelManager<IndexValuePair<int
|
|||||||
if (!CheckIfSlotExists(keyPosition))
|
if (!CheckIfSlotExists(keyPosition))
|
||||||
return; // throw new System.Exception($"Slot with number: {keyPosition} don't exist");
|
return; // throw new System.Exception($"Slot with number: {keyPosition} don't exist");
|
||||||
|
|
||||||
Debug.Log($"Remove from position: {keyPosition}");
|
/* Debug.Log($"Remove from position: {keyPosition}");
|
||||||
|
*/
|
||||||
Elements.RemoveAll(itemSlot => itemSlot.Key == keyPosition);
|
Elements.RemoveAll(itemSlot => itemSlot.Key == keyPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ public class EquipmentPanelController : DraggablePanelController
|
|||||||
|
|
||||||
base.BuildPanelContent(elements);
|
base.BuildPanelContent(elements);
|
||||||
|
|
||||||
Debug.Log("Build content");
|
/* Debug.Log("Build content"); */
|
||||||
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
||||||
{
|
{
|
||||||
Debug.Log($"key: {element.Key} - value: {element.Value}");
|
/* Debug.Log($"key: {element.Key} - value: {element.Value}"); */
|
||||||
|
|
||||||
if(element.Value != null)
|
if(element.Value != null)
|
||||||
ChildBoxList.Where(slot => ((EquipmentSlot)slot).type == (EquipmentPanelSlotsTypeEnum)element.Key).ToList().ForEach(slot => slot.SetItem((EquippableItem)element.Value));
|
ChildBoxList.Where(slot => ((EquipmentSlot)slot).type == (EquipmentPanelSlotsTypeEnum)element.Key).ToList().ForEach(slot => slot.SetItem((EquippableItem)element.Value));
|
||||||
|
@ -87,10 +87,9 @@ public class InventoryPanelController : WarehousePanelController
|
|||||||
|
|
||||||
base.BuildPanelContent(elements);
|
base.BuildPanelContent(elements);
|
||||||
|
|
||||||
Debug.Log("Build content");
|
|
||||||
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
||||||
{
|
{
|
||||||
Debug.Log($"key: {element.Key} - value: {element.Value}");
|
/* Debug.Log($"key: {element.Key} - value: {element.Value}"); */
|
||||||
ChildBoxList[element.Key].SetItem(element.Value);
|
ChildBoxList[element.Key].SetItem(element.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class ShopPanelController : WarehousePanelController
|
|||||||
|
|
||||||
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
||||||
{
|
{
|
||||||
Debug.Log($"key: {element.Key} - value: {element.Value}");
|
/* Debug.Log($"key: {element.Key} - value: {element.Value}"); */
|
||||||
ChildBoxList[element.Key].SetItem(new EquippableItem(element.Value));
|
ChildBoxList[element.Key].SetItem(new EquippableItem(element.Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ public class ShopUIManager : UIBaseManager<Shop>
|
|||||||
if (shop == null)
|
if (shop == null)
|
||||||
throw new Exception($"Shop {CurrentShopOwnerName} not found");
|
throw new Exception($"Shop {CurrentShopOwnerName} not found");
|
||||||
|
|
||||||
Debug.Log("Shop UI setupPanel");
|
|
||||||
|
|
||||||
ShopContentUIManager.Instance.SetList(shop.GetContent());
|
ShopContentUIManager.Instance.SetList(shop.GetContent());
|
||||||
ShopContentUIManager.Instance.DynamicPanel = DynamicPanel;
|
ShopContentUIManager.Instance.DynamicPanel = DynamicPanel;
|
||||||
@ -108,7 +107,6 @@ public class ShopUIManager : UIBaseManager<Shop>
|
|||||||
|
|
||||||
private Shop FindShopInCollection(string _mapName, string _shopOwnerName)
|
private Shop FindShopInCollection(string _mapName, string _shopOwnerName)
|
||||||
{
|
{
|
||||||
Elements.ForEach(el => Debug.Log(el.Npc + " - " + el.Map));
|
|
||||||
return Elements.Find(shop => shop.Map == _mapName && shop.Npc == _shopOwnerName);
|
return Elements.Find(shop => shop.Map == _mapName && shop.Npc == _shopOwnerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,18 +6,32 @@ using System.Threading.Tasks;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class DialogueData<T> : ModelData<T, T>
|
public abstract class DialogueData<T> : IModelMapper<T>
|
||||||
{
|
{
|
||||||
protected override string SPRITE_LOCALIZATION => "";
|
|
||||||
protected override string MODEL_LOCALIZATION => "Dialogue/";
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public int CurrentStep;
|
public int CurrentStep;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public List<DialogueStepData> DialogueStepModelDataList = new List<DialogueStepData>();
|
public List<DialogueStepData> DialogueStepModelDataList = new List<DialogueStepData>();
|
||||||
|
|
||||||
|
|
||||||
|
#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 DialogueData : DialogueData<Dialogue>
|
public class DialogueData : DialogueData<Dialogue>
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -39,28 +53,5 @@ public class DialogueData : DialogueData<Dialogue>
|
|||||||
DialogueStepModelDataList.Add(new DialogueStepData(dialogueStepModelData.WasDisplayed));
|
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,14 @@ using System.Threading.Tasks;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class MultiDialogueData<T> : ModelData<T, T>
|
public abstract class MultiDialogueData<T> : IModelMapper<T>
|
||||||
{
|
{
|
||||||
protected override string SPRITE_LOCALIZATION => "";
|
|
||||||
protected override string MODEL_LOCALIZATION => "Dialogue/";
|
[NonSerialized]
|
||||||
|
public string name;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
public string modelName;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public string SpeakerName;
|
public string SpeakerName;
|
||||||
@ -19,8 +23,25 @@ public abstract class MultiDialogueData<T> : ModelData<T, T>
|
|||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public List<IndexValuePair<int, DialogueData>> DialogueStepModelDataList = new List<IndexValuePair<int, DialogueData>>();
|
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 class MultiDialogueData : MultiDialogueData<MultiDialogue>
|
||||||
{
|
{
|
||||||
public MultiDialogueData(MultiDialogue dialogue)
|
public MultiDialogueData(MultiDialogue dialogue)
|
||||||
@ -41,22 +62,5 @@ public class MultiDialogueData : MultiDialogueData<MultiDialogue>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public abstract class ItemData : ModelData<Item, Item>
|
|||||||
|
|
||||||
public override Item MapDataToObject(string prefarbAssetName)
|
public override Item MapDataToObject(string prefarbAssetName)
|
||||||
{
|
{
|
||||||
Debug.Log(MODEL_LOCALIZATION + prefarbAssetName + ".asset");
|
/* Debug.Log(MODEL_LOCALIZATION + prefarbAssetName + ".asset"); */
|
||||||
|
|
||||||
return TryFindResource(prefarbAssetName);
|
return TryFindResource(prefarbAssetName);
|
||||||
|
|
||||||
|
@ -6,25 +6,24 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
class MissionDialogueData : DialogueData<MissionDialogue>
|
class MissionDialogueData : DialogueData<MissionDialogue>
|
||||||
{
|
{
|
||||||
protected override string SPRITE_LOCALIZATION => "";
|
/// <summary>
|
||||||
protected override string MODEL_LOCALIZATION => "Mission/Dialogue/";
|
/// build Data model based on Object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dialogue"></param>
|
||||||
|
public MissionDialogueData(Dialogue dialogue)
|
||||||
|
|
||||||
public override MissionDialogue MapDataToObject(string prefarbAssetName)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override MissionDialogue MapDataToObject()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override MissionDialogue TryFindResource(string modelName)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,4 +68,10 @@ public class SaveController : MonoBehaviour
|
|||||||
if(SceneShopDataManager.Instance)
|
if(SceneShopDataManager.Instance)
|
||||||
SceneShopDataManager.Instance.SaveDynamicData();
|
SceneShopDataManager.Instance.SaveDynamicData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveDialogues()
|
||||||
|
{
|
||||||
|
if (MultiDialogueDataManager.Instance)
|
||||||
|
MultiDialogueDataManager.Instance.SaveDynamicData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
// Tell what is the beginning state of loaded scene
|
// Tell what is the beginning state of loaded scene
|
||||||
|
[Serializable]
|
||||||
public enum OnMapAppearanceMethodEnum
|
public enum OnMapAppearanceMethodEnum
|
||||||
{
|
{
|
||||||
NewGame = 0,
|
NewGame = 0,
|
||||||
@ -11,17 +13,20 @@ public enum OnMapAppearanceMethodEnum
|
|||||||
//maybe respawn too
|
//maybe respawn too
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
public enum GameStatus
|
public enum GameStatus
|
||||||
{
|
{
|
||||||
NewGame = 0,
|
NewGame = 0,
|
||||||
Continue = 1
|
Continue = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
public class OnMapAppearanceMethod : MonoBehaviour
|
public class OnMapAppearanceMethod : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField]
|
||||||
public static OnMapAppearanceMethodEnum Gateway { get; set; } // Map status
|
public static OnMapAppearanceMethodEnum Gateway { get; set; } // Map status
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
public static GameStatus GameStatus { get; set; }
|
public static GameStatus GameStatus { get; set; }
|
||||||
|
|
||||||
// every script which makes player appear somewhere should change this variable ! ! !
|
// every script which makes player appear somewhere should change this variable ! ! !
|
||||||
|
Loading…
Reference in New Issue
Block a user