DialogueManager.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Common.Utility.CombatEvent;
  5. using Excel2Json;
  6. using Fort23.Mono;
  7. using Fort23.UTool;
  8. using UnityEngine;
  9. using Utility;
  10. public class DialogueManager : Singleton<DialogueManager>
  11. {
  12. private readonly EventSystemManager eventManager;
  13. private int currentDialogueID;
  14. private int currentNodeID;
  15. private int currentEventID;
  16. // private List<DialogueConfig> dialogueConfigs;
  17. // private List<DialogueOptionConfig> dialogueOptionConfigs;
  18. public void CustomInit()
  19. {
  20. // dialogueConfigs = ConfigComponent.Instance.GetAll<DialogueConfig>().ToList();
  21. // dialogueOptionConfigs = ConfigComponent.Instance.GetAll<DialogueOptionConfig>().ToList();
  22. }
  23. /// <summary>
  24. /// 开始对话
  25. /// </summary>
  26. public void StartDialogue(int dialogueID, int eventID)
  27. {
  28. currentDialogueID = dialogueID;
  29. currentNodeID = 1;
  30. currentEventID = eventID;
  31. ShowDialogue();
  32. }
  33. /// <summary>
  34. /// 显示当前对话
  35. /// </summary>
  36. private void ShowDialogue()
  37. {
  38. //找到当前对话组
  39. // var dialogueConfig = dialogueConfigs.Find(n =>
  40. // n.ID == currentDialogueID && n.GroupId == currentNodeID);
  41. // if (dialogueConfig.ID == 0)
  42. // {
  43. // EndDialogue();
  44. // return;
  45. // }
  46. //todo 加载对话ui
  47. // DialoguePanel.OpenDialoguePanel(dialogueConfig.Content, null, ShowDialogueEventData.MessageShowType.Default, () =>
  48. // {
  49. //
  50. // });
  51. currentNodeID++;
  52. }
  53. /// <summary>
  54. /// 处理选项选择,跳转节点或触发逻辑。
  55. /// </summary>
  56. /// <param name="optionID">选项ID</param>
  57. public void SelectOption(int optionID)
  58. {
  59. // var option = dialogueOptionConfigs.Find(o => o.ID == optionID);
  60. // if (option.ID == 0)
  61. // {
  62. // EndDialogue();
  63. // return;
  64. // }
  65. //
  66. // if (option.DialogueConfigID > 0)
  67. // {
  68. // currentNodeID = option.DialogueConfigID;
  69. // ShowDialogue();
  70. // }
  71. // else
  72. // {
  73. // EndDialogue();
  74. // }
  75. }
  76. /// <summary>
  77. /// 结束对话
  78. /// </summary>
  79. private void EndDialogue()
  80. {
  81. }
  82. }