Hot Fix - fix speaker name in dialogue panel header

This commit is contained in:
kabix09 2022-12-06 03:10:36 +01:00
parent 78405a418e
commit ba894215fa
9 changed files with 45 additions and 14 deletions

View File

@ -12,15 +12,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 45b41589283138641ba006c2243b0637, type: 3} m_Script: {fileID: 11500000, guid: 45b41589283138641ba006c2243b0637, type: 3}
m_Name: BossThugDialPl m_Name: BossThugDialPl
m_EditorClassIdentifier: m_EditorClassIdentifier:
SpeakerName:
CurrentDialogue: 0 CurrentDialogue: 0
MultiWayDialogue: MultiWayDialogue:
- Key: 0 - Key: 0
Value: Value:
- WasDisplayed: 0 - Header:
WasDisplayed: 0
ListOfSentences: ListOfSentences:
- Sentence: Who are you? Hod did you get past my guards?! - Header:
Sentence: Who are you? Hod did you get past my guards?!
Buttons: [] Buttons: []
- Sentence: Don't answer. I don't care anyway. You're dead to me/. - Header:
Sentence: Don't answer. I don't care anyway. You're dead to me/.
Buttons: [] Buttons: []
EndOfDialogueStepAction: EndOfDialogueStepAction:
m_PersistentCalls: m_PersistentCalls:

View File

@ -167,6 +167,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2bd5e7fa2661ee649861ce0b80373740, type: 3} m_Script: {fileID: 11500000, guid: 2bd5e7fa2661ee649861ce0b80373740, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
SpeakerName: Thug Boss
DialogueTemplate: {fileID: 11400000, guid: b47b2441f5e5f9e4ab687bf2a2fddbfa, type: 2} DialogueTemplate: {fileID: 11400000, guid: b47b2441f5e5f9e4ab687bf2a2fddbfa, type: 2}
Dialogue: {fileID: 0} Dialogue: {fileID: 0}
EndactionEventList: EndactionEventList:

View File

@ -39632,7 +39632,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 221b868deecf9a94c86d5e989abeb8a8, type: 3} m_Script: {fileID: 11500000, guid: 221b868deecf9a94c86d5e989abeb8a8, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
name: goldOre name: Gold Ore
sprites: sprites:
- {fileID: -2769473736760253650, guid: 707503ddc182f7e4aad33c5e3a9a56ba, type: 3} - {fileID: -2769473736760253650, guid: 707503ddc182f7e4aad33c5e3a9a56ba, type: 3}
- {fileID: 2172676185572096100, guid: 1942087f81e48a6418d29c06a6482774, type: 3} - {fileID: 2172676185572096100, guid: 1942087f81e48a6418d29c06a6482774, type: 3}

View File

@ -7,6 +7,9 @@ using UnityEngine;
[CreateAssetMenu(fileName = "New Dialogue", menuName = "Dialogue/New Dialogue")] [CreateAssetMenu(fileName = "New Dialogue", menuName = "Dialogue/New Dialogue")]
public class Dialogue : ScriptableObject public class Dialogue : ScriptableObject
{ {
[SerializeField]
public string SpeakerName;
[SerializeField] [SerializeField]
int CurrentDialogue = 0; int CurrentDialogue = 0;
@ -64,15 +67,12 @@ public class Dialogue : ScriptableObject
foreach (var DialogueStep in dialogueStepsList) foreach (var DialogueStep in dialogueStepsList)
{ {
Debug.Log($"List of dialogue count: {DialogueStep.DialogueController.listOfDialogue.Count}"); if (!DialogueStep.WasDisplayed && DialogueStep.DialogueController.CurrentPanel != null)
if (!DialogueStep.WasDisplayed && DialogueStep.DialogueController.listOfDialogue.Count != 0)
{ {
Debug.Log("Break Dialogue - close panel");
DialogueStep.DialogueController.CloseCurrentPanel(); // close panel DialogueStep.DialogueController.CloseCurrentPanel(); // close panel
break; break;
} }
Debug.Log("a");
} }
} }
@ -182,6 +182,8 @@ public class Dialogue : ScriptableObject
{ {
foreach (var dialogueStep in Dialogue) foreach (var dialogueStep in Dialogue)
{ {
dialogueStep.Header = SpeakerName;
dialogueStep.Build(); dialogueStep.Build();
} }
} }

View File

@ -48,7 +48,7 @@ public class DialogueController
public void Show(DialogueModel panelModel) public void Show(DialogueModel panelModel)
{ {
Panel panelDis = panelModel.Panel("Kabix", panelModel); Panel panelDis = panelModel.Panel(panelModel.Header, panelModel);
panelDis.PanelInstance = panelDis.BuildPanel(); panelDis.PanelInstance = panelDis.BuildPanel();
if(!(panelDis is QuestionPanel)) if(!(panelDis is QuestionPanel))
@ -91,7 +91,6 @@ public class DialogueController
public void CloseCurrentPanel() public void CloseCurrentPanel()
{ {
Debug.Log(CurrentPanel);
MonoBehaviour.Destroy(CurrentPanel); MonoBehaviour.Destroy(CurrentPanel);
} }

View File

@ -6,6 +6,9 @@ using UnityEngine;
[Serializable] [Serializable]
public class DialogueModel //<TPanel> where TPanel : AbstractPanel public class DialogueModel //<TPanel> where TPanel : AbstractPanel
{ {
[NonSerialized]
public string Header;
public Func<string, DialogueModel, Panel> Panel = PanelFactory.BasePanel; public Func<string, DialogueModel, Panel> Panel = PanelFactory.BasePanel;
[SerializeField] [SerializeField]
@ -22,10 +25,26 @@ public class DialogueModel //<TPanel> where TPanel : AbstractPanel
Sentence = _sentence; Sentence = _sentence;
} }
public DialogueModel(string _sentence, string _header)
{
Sentence = _sentence;
Header = _header;
}
public DialogueModel(string _sentence, List<PanelButtonStepModel> _buttonsModelsList) public DialogueModel(string _sentence, List<PanelButtonStepModel> _buttonsModelsList)
{ {
Sentence = _sentence; Sentence = _sentence;
Buttons = _buttonsModelsList; Buttons = _buttonsModelsList;
} }
public DialogueModel(string _sentence, string _header, List<PanelButtonStepModel> _buttonsModelsList)
{
Sentence = _sentence;
Header = _header;
Buttons = _buttonsModelsList;
}
} }

View File

@ -8,6 +8,9 @@ using UnityEngine.Events;
[Serializable] [Serializable]
public class DialogueStepModel public class DialogueStepModel
{ {
[SerializeField]
public string Header;
[SerializeField] // this flag tell whatewer dialoge ware already display to user [SerializeField] // this flag tell whatewer dialoge ware already display to user
public bool WasDisplayed = false; public bool WasDisplayed = false;
@ -43,6 +46,8 @@ public class DialogueStepModel
foreach (DialogueModel DialogueModel in ListOfSentences) foreach (DialogueModel DialogueModel in ListOfSentences)
{ {
// Pass data to builded panel (name, sentence, buttons) // Pass data to builded panel (name, sentence, buttons)
DialogueModel.Header = Header; // set header
DialogueController.AddSentence(DialogueModel); DialogueController.AddSentence(DialogueModel);
} }

View File

@ -8,6 +8,9 @@ using UnityEngine.Events;
[Serializable] [Serializable]
public class NpcDialogueManager : MonoBehaviour public class NpcDialogueManager : MonoBehaviour
{ {
[SerializeField]
public string SpeakerName;
[SerializeField] [SerializeField]
public Dialogue DialogueTemplate; public Dialogue DialogueTemplate;
@ -21,6 +24,7 @@ public class NpcDialogueManager : MonoBehaviour
public void Start() public void Start()
{ {
Dialogue = Instantiate(DialogueTemplate); Dialogue = Instantiate(DialogueTemplate);
Dialogue.SpeakerName = SpeakerName;
} }
public void Update() { } public void Update() { }

View File

@ -61,7 +61,6 @@ public class SceneChestDataManager : SceneBaseDataManager<ChestPrefabAsset>
{ {
if(OnMapAppearanceMethod.GameStatus == GameStatus.NewGame) if(OnMapAppearanceMethod.GameStatus == GameStatus.NewGame)
{ {
Debug.Log(OnMapAppearanceMethod.Gateway);
if (OnMapAppearanceMethod.Gateway != OnMapAppearanceMethodEnum.NewGame) if (OnMapAppearanceMethod.Gateway != OnMapAppearanceMethodEnum.NewGame)
UseDynamicSettings(); // if there is nothing saved we will use UseDefaultSettings UseDynamicSettings(); // if there is nothing saved we will use UseDefaultSettings
else else
@ -87,7 +86,6 @@ public class SceneChestDataManager : SceneBaseDataManager<ChestPrefabAsset>
protected override void UseDefaultSettings() protected override void UseDefaultSettings()
{ {
Debug.Log("Chestmanager - UseDefaultSettings");
foreach (ChestPrefabAssetData asset in ElementsToBuildOnSceneList) { convertedData.Add((ChestPrefabAsset)asset.MapDataToPrefabAssetModel()); } foreach (ChestPrefabAssetData asset in ElementsToBuildOnSceneList) { convertedData.Add((ChestPrefabAsset)asset.MapDataToPrefabAssetModel()); }
ChestBuilder.ElementsToBuildOnSceneList = convertedData; ChestBuilder.ElementsToBuildOnSceneList = convertedData;
@ -109,7 +107,6 @@ public class SceneChestDataManager : SceneBaseDataManager<ChestPrefabAsset>
// when chest detect player in near arrea and player press "c" // 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 // 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 // Manager Build panel and pass info about chest content
Debug.Log("Chestmanager - UseDynamicSettings");
LoadDynamicData(); LoadDynamicData();