Ver.0.3.0.33
This commit is contained in:
@@ -3,6 +3,7 @@ using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using Febucci.UI;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -17,16 +18,12 @@ namespace AibisDream
|
||||
private Action _nextStep;
|
||||
|
||||
#endregion
|
||||
|
||||
private bool _skipLineDelay;
|
||||
|
||||
[Header("跳过阻塞延迟时间/ms")] [SerializeField]
|
||||
private int delayTime = 300;
|
||||
|
||||
private TextParam _textParam;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitComponents();
|
||||
AddSomeListener();
|
||||
}
|
||||
|
||||
private void InitComponents()
|
||||
@@ -34,17 +31,7 @@ namespace AibisDream
|
||||
_dialogText = transform.Find("Dialog Text")?.gameObject.GetComponent<TypewriterByCharacter>();
|
||||
}
|
||||
|
||||
private void AddSomeListener()
|
||||
{
|
||||
// 对话显示后有一段延时不可跳过
|
||||
_dialogText.onTypewriterStart.AddListener(() =>
|
||||
{
|
||||
_skipLineDelay = true;
|
||||
_ = CommonUtil.Delay(delayTime, () => { _skipLineDelay = false; });
|
||||
});
|
||||
}
|
||||
|
||||
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, bool isAutoSkip = false)
|
||||
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, string lineId, bool isAutoSkip = false)
|
||||
{
|
||||
// 把原有对话清掉
|
||||
ClearBox();
|
||||
@@ -58,12 +45,6 @@ namespace AibisDream
|
||||
_dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShown));
|
||||
|
||||
_nextStep = nextStep;
|
||||
|
||||
// 执行自动跳过结局
|
||||
if (isAutoSkip)
|
||||
{
|
||||
_dialogText.onTextShowed.AddListener(() => _ = CommonUtil.Delay(200, NextStep));
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowOptions(DialogOption[] dialogueOptions)
|
||||
@@ -78,11 +59,6 @@ namespace AibisDream
|
||||
|
||||
public bool TrySkipLine(bool isForceSkip)
|
||||
{
|
||||
if (_skipLineDelay && !isForceSkip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_dialogText.isShowingText)
|
||||
{
|
||||
_dialogText.SkipTypewriter();
|
||||
@@ -102,7 +78,16 @@ namespace AibisDream
|
||||
_nextStep = null;
|
||||
next.Invoke();
|
||||
}
|
||||
|
||||
|
||||
public void OnLocalizationChanged(string value)
|
||||
{
|
||||
_textParam = JsonUtil.ReadBeanByText<TextParam>(value);
|
||||
var tmp = _dialogText.GetComponent<TMP_Text>();
|
||||
// 修改对话文本
|
||||
|
||||
tmp.characterSpacing = _textParam.charSpace;
|
||||
}
|
||||
|
||||
private void ClearBox()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
Reference in New Issue
Block a user