Merge branch 'featrue/stoneTotal' into 'develop'
插线系统重构 See merge request aibis-dream/aibis-dream!106
This commit is contained in:
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using Yarn.Unity;
|
||||
@@ -13,7 +12,7 @@ namespace AibisDream
|
||||
public class DialogController : Singleton<DialogController>
|
||||
{
|
||||
private const string BookManager = "BookManager";
|
||||
|
||||
|
||||
private DialogueRunner dialogueRunner;
|
||||
private VariableStorageBehaviour _variableStorage;
|
||||
|
||||
@@ -41,20 +40,17 @@ namespace AibisDream
|
||||
OnDialogueComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
get
|
||||
{
|
||||
return _isTalking;
|
||||
}
|
||||
get { return _isTalking; }
|
||||
}
|
||||
|
||||
// 对话框被阻塞时不能继续对话框交互
|
||||
public bool IsBlock { get; private set; }
|
||||
|
||||
public bool quickRunMode;
|
||||
|
||||
|
||||
// 暂停对话
|
||||
public bool isInPause;
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
public static UnityAction OnDialogueStart;
|
||||
@@ -70,8 +66,16 @@ namespace AibisDream
|
||||
bookManager.OnBookClosed += () => { IsBlock = false; };
|
||||
bookManager.OnBookOpen += () => { IsBlock = true; };
|
||||
|
||||
dialogueRunner.onDialogueStart.AddListener(() => { OnDialogueStart?.Invoke(); IsTalking = true;});
|
||||
dialogueRunner.onDialogueComplete.AddListener(() => { OnDialogueComplete?.Invoke(); IsTalking = false;});
|
||||
dialogueRunner.onDialogueStart.AddListener(() =>
|
||||
{
|
||||
OnDialogueStart?.Invoke();
|
||||
IsTalking = true;
|
||||
});
|
||||
dialogueRunner.onDialogueComplete.AddListener(() =>
|
||||
{
|
||||
OnDialogueComplete?.Invoke();
|
||||
IsTalking = false;
|
||||
});
|
||||
//dialogueRunner.AddCommandListener(_ => { IsTalking = false; });
|
||||
|
||||
// 对话结束时切下一个SO
|
||||
@@ -126,31 +130,28 @@ namespace AibisDream
|
||||
dialogueRunner.SetProject(yarnProject);
|
||||
dialogueRunner.StartDialogue("Start");
|
||||
}
|
||||
|
||||
public void StartDialogNode(string nodeName)
|
||||
{
|
||||
if(CheckIfNodeExistInCurrentYarnProject(nodeName))
|
||||
{
|
||||
dialogueRunner.StartDialogue(nodeName);
|
||||
|
||||
}
|
||||
|
||||
if (CheckIfNodeExistInCurrentYarnProject(nodeName))
|
||||
{
|
||||
dialogueRunner.StartDialogue(nodeName);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckIfNodeExistInCurrentYarnProject(string nodeName)
|
||||
{
|
||||
YarnProject currentProject = dialogueRunner.yarnProject;
|
||||
string[] nodeNames = currentProject.NodeNames;
|
||||
if (Array.Exists(nodeNames, name => name == nodeName))
|
||||
if (Array.Exists(nodeNames, item => item == nodeName))
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"节点 {nodeName} 不存在!");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region 选项指令
|
||||
@@ -235,7 +236,7 @@ namespace AibisDream
|
||||
Debug.LogWarning($"命令 {commandName} 不存在");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册暂停命令
|
||||
/// </summary>
|
||||
@@ -268,15 +269,14 @@ namespace AibisDream
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 命令名
|
||||
|
||||
|
||||
[YarnCommand("NextYarn")]
|
||||
public static void NextYarn()
|
||||
{
|
||||
DialogController.Instance.StartCoroutine(GameLoopManager.Instance.NextSceneSo());
|
||||
DialogController.Instance.StartCoroutine(GameLoopManager.Instance.NextSceneSo());
|
||||
}
|
||||
|
||||
[YarnCommand("switch_tv")]
|
||||
@@ -291,42 +291,12 @@ namespace AibisDream
|
||||
MainUIController.Instance.TVFadeOut(duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色初始化
|
||||
/// </summary>
|
||||
/// <param name="picName">角色图片名</param>
|
||||
// [YarnCommand("character_init")]
|
||||
// public static void CharacterInit(string picName)
|
||||
// {
|
||||
// MainSceneController.Instance.Guest.SwitchImage(picName);
|
||||
// MainSceneController.Instance.Guest.Show();
|
||||
// }
|
||||
|
||||
// [YarnCommand("character_switch_image")]
|
||||
// public static void CharacterSwitchImage(string picPath)
|
||||
// {
|
||||
// // TODO 统一路径后就不用路径做参数了
|
||||
// MainSceneController.Instance.Guest.SwitchImage(picPath);
|
||||
// }
|
||||
|
||||
// [YarnCommand("character_fade_in")]
|
||||
// public static IEnumerator CharacterFadeIn(float duration = 1)
|
||||
// {
|
||||
// return MainSceneController.Instance.Guest.FadeInSync(duration);
|
||||
// }
|
||||
|
||||
// [YarnCommand("character_fade_Out")]
|
||||
// public static IEnumerator CharacterFadeOut(float duration = 1)
|
||||
// {
|
||||
// return MainSceneController.Instance.Guest.FadeOutSync(duration);
|
||||
// }
|
||||
|
||||
// [YarnCommand("character_move_to_fix")]
|
||||
// public static IEnumerator CharacterMoveToFix()
|
||||
// {
|
||||
// return MainSceneController.Instance.MoveToFix();
|
||||
// }
|
||||
|
||||
[YarnCommand("show_tv_scene")]
|
||||
public static void ShowTVScene(float duration)
|
||||
{
|
||||
MainUIController.Instance.TVFadeIn(duration);
|
||||
}
|
||||
|
||||
[YarnCommand("load_scene")]
|
||||
public static IEnumerator LoadScene(string sceneName, float duration = 1)
|
||||
{
|
||||
@@ -338,7 +308,7 @@ namespace AibisDream
|
||||
DialogCanvasManager.Instance.SwitchDialogView(sceneName == "ClinicScene"
|
||||
? DialogViewType.Bubble
|
||||
: DialogViewType.OldBox);
|
||||
if(sceneName=="ClinicScene")
|
||||
if (sceneName == "ClinicScene")
|
||||
{
|
||||
AudioManager.PlayAmb1Audio("amb_room");
|
||||
}
|
||||
@@ -346,8 +316,8 @@ namespace AibisDream
|
||||
{
|
||||
AudioManager.PlayAmb1Audio("amb_main");
|
||||
}
|
||||
AudioManager.PlayAmb2Audio("amb_general");
|
||||
|
||||
AudioManager.PlayAmb2Audio("amb_general");
|
||||
}
|
||||
|
||||
[YarnCommand("unload_scene")]
|
||||
|
||||
Reference in New Issue
Block a user