fix(dialog): 重构对话推进模式为响应式状态绑定
This commit is contained in:
@@ -33,6 +33,7 @@ namespace AibisDream
|
||||
SingleCastEventSystem.Global.Register<DialogEventEnum, string>(DialogEventEnum.StartNode, StartDialogNode);
|
||||
|
||||
EnumEventSystem.Global.Register(GameLoopEnum.GameStart, ResetAdvanceMode);
|
||||
EnumEventSystem.Global.Register(GameLoopEnum.GameQuit, ResetAdvanceMode);
|
||||
|
||||
EnumEventSystem.Global.Register(DialogEventEnum.OptionShow, OnOptionShow);
|
||||
EnumEventSystem.Global.Register<DialogEventEnum, LineInfo>(DialogEventEnum.OptionSelected, OnOptionSelected);
|
||||
@@ -43,6 +44,7 @@ namespace AibisDream
|
||||
SingleCastEventSystem.Global.Unregister(DialogEventEnum.StartNode);
|
||||
|
||||
EnumEventSystem.Global.UnRegister(GameLoopEnum.GameStart, ResetAdvanceMode);
|
||||
EnumEventSystem.Global.UnRegister(GameLoopEnum.GameQuit, ResetAdvanceMode);
|
||||
|
||||
EnumEventSystem.Global.UnRegister(DialogEventEnum.OptionShow, OnOptionShow);
|
||||
EnumEventSystem.Global.UnRegister<DialogEventEnum, LineInfo>(DialogEventEnum.OptionSelected, OnOptionSelected);
|
||||
@@ -50,7 +52,7 @@ namespace AibisDream
|
||||
|
||||
private void ResetAdvanceMode()
|
||||
{
|
||||
advanceMode = new AdvanceMode
|
||||
advanceMode.Value = new AdvanceMode
|
||||
{
|
||||
isAuto = false,
|
||||
isQuick = false
|
||||
@@ -60,7 +62,6 @@ namespace AibisDream
|
||||
lineSyncToken = null;
|
||||
|
||||
Time.timeScale = 1f;
|
||||
lineAdvanceInput.ResetAdvanceMode();
|
||||
}
|
||||
|
||||
#region Yarn控制
|
||||
@@ -128,25 +129,37 @@ namespace AibisDream
|
||||
|
||||
#region 推进方式修改
|
||||
|
||||
public AdvanceMode advanceMode;
|
||||
public BindProperty<AdvanceMode> advanceMode = new(new AdvanceMode());
|
||||
|
||||
public void SwitchAutoMode()
|
||||
{
|
||||
advanceMode.isAuto = !advanceMode.isAuto;
|
||||
lineAdvanceInput.SwitchAdvanceHandler(advanceMode.CurrentMode);
|
||||
var mode = advanceMode.Value;
|
||||
mode.isAuto = !mode.isAuto;
|
||||
advanceMode.Value = mode;
|
||||
}
|
||||
|
||||
public void SwitchQuickMode()
|
||||
{
|
||||
advanceMode.isQuick = !advanceMode.isQuick;
|
||||
var mode = advanceMode.Value;
|
||||
mode.isQuick = !mode.isQuick;
|
||||
advanceMode.Value = mode;
|
||||
|
||||
lineAdvanceInput.SwitchAdvanceHandler(advanceMode.CurrentMode);
|
||||
Time.timeScale = advanceMode.CurrentMode == AdvanceModeEnum.Quick ? 8f : 1f;
|
||||
Time.timeScale = advanceMode.Value.CurrentMode == AdvanceModeEnum.Quick ? 8f : 1f;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public LineSyncToken lineSyncToken;
|
||||
private LineSyncToken _lineSyncToken;
|
||||
public LineSyncToken lineSyncToken
|
||||
{
|
||||
get => _lineSyncToken;
|
||||
set
|
||||
{
|
||||
_lineSyncToken = value;
|
||||
lineAdvanceInput?.RunLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool isInOption;
|
||||
|
||||
public LineSyncState GetDialogState()
|
||||
|
||||
Reference in New Issue
Block a user