Merge branch 'feature/升级Yarn3.2' into feature/Yarn3.0升级合入
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using AibisDream.Framework;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream
|
||||
@@ -9,14 +10,14 @@ namespace AibisDream
|
||||
public class DialogController : Singleton<DialogController>
|
||||
{
|
||||
private DialogueRunner _dialogueRunner;
|
||||
private LocalisedLineProvider _lineProvider;
|
||||
|
||||
[SerializeField] private LineAdvanceInput lineAdvanceInput;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_dialogueRunner = GetComponentInChildren<DialogueRunner>();
|
||||
_lineProvider = GetComponentInChildren<LocalisedLineProvider>();
|
||||
_dialogueRunner.onDialogueStart ??= new UnityEvent();
|
||||
_dialogueRunner.onDialogueComplete ??= new UnityEvent();
|
||||
|
||||
_dialogueRunner.onDialogueStart.AddListener(() =>
|
||||
{
|
||||
@@ -73,13 +74,12 @@ namespace AibisDream
|
||||
public void StartDialog(YarnProject yarnProject)
|
||||
{
|
||||
_dialogueRunner.SetProject(yarnProject);
|
||||
_lineProvider.InitStringTable(yarnProject.name);
|
||||
_dialogueRunner.StartDialogue("Start");
|
||||
_ = _dialogueRunner.StartDialogue("Start");
|
||||
}
|
||||
|
||||
public void StopDialog()
|
||||
{
|
||||
_dialogueRunner.Stop();
|
||||
_ = _dialogueRunner.Stop();
|
||||
StorageSystem.Instance.Clear();
|
||||
DialogUIManager.Instance.HideDialog();
|
||||
}
|
||||
@@ -87,8 +87,7 @@ namespace AibisDream
|
||||
public void LoadDialog(YarnProject yarnProject)
|
||||
{
|
||||
_dialogueRunner.SetProject(yarnProject);
|
||||
_lineProvider.InitStringTable(yarnProject.name);
|
||||
_dialogueRunner.StartDialogue("Center");
|
||||
_ = _dialogueRunner.StartDialogue("Center");
|
||||
}
|
||||
|
||||
public void StartDialogNode(string nodeName)
|
||||
@@ -102,7 +101,7 @@ namespace AibisDream
|
||||
|
||||
if (CheckIfNodeExistInCurrentYarnProject(nodeName))
|
||||
{
|
||||
_dialogueRunner.StartDialogue(nodeName);
|
||||
_ = _dialogueRunner.StartDialogue(nodeName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,7 +111,13 @@ namespace AibisDream
|
||||
|
||||
private bool CheckIfNodeExistInCurrentYarnProject(string nodeName)
|
||||
{
|
||||
YarnProject currentProject = _dialogueRunner.yarnProject;
|
||||
var currentProject = _dialogueRunner.YarnProject;
|
||||
if (currentProject == null)
|
||||
{
|
||||
Debug.LogWarning("当前没有可用的 YarnProject,无法检查节点");
|
||||
return false;
|
||||
}
|
||||
|
||||
string[] nodeNames = currentProject.NodeNames;
|
||||
if (Array.Exists(nodeNames, item => item == nodeName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user