|
@@ -37,6 +37,8 @@ namespace GFGGame
|
|
private string _currentWords;
|
|
private string _currentWords;
|
|
private string _storyStartID;
|
|
private string _storyStartID;
|
|
private string lastTextFieldType; // 上一段文本框的类型
|
|
private string lastTextFieldType; // 上一段文本框的类型
|
|
|
|
+ TypingFadeEffect _typingEffect;
|
|
|
|
+
|
|
|
|
|
|
//屏幕效果中
|
|
//屏幕效果中
|
|
private Action<object> _onScreenEffectComplete;
|
|
private Action<object> _onScreenEffectComplete;
|
|
@@ -61,7 +63,7 @@ namespace GFGGame
|
|
EffectUIPool.Recycle(_effectUI1);
|
|
EffectUIPool.Recycle(_effectUI1);
|
|
_effectUI1 = null;
|
|
_effectUI1 = null;
|
|
_onScreenEffectComplete = null;
|
|
_onScreenEffectComplete = null;
|
|
- Timers.inst.Remove(UpdateLetters);
|
|
|
|
|
|
+ _typingEffect = null;
|
|
if (_ui != null)
|
|
if (_ui != null)
|
|
{
|
|
{
|
|
_ui.Dispose();
|
|
_ui.Dispose();
|
|
@@ -155,7 +157,6 @@ namespace GFGGame
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
- Timers.inst.Remove(UpdateLetters);
|
|
|
|
Timers.inst.Remove(UpdateShake);
|
|
Timers.inst.Remove(UpdateShake);
|
|
Timers.inst.Remove(OnScreenEffectComplete);
|
|
Timers.inst.Remove(OnScreenEffectComplete);
|
|
Timers.inst.Remove(ShowNextWords);
|
|
Timers.inst.Remove(ShowNextWords);
|
|
@@ -305,6 +306,7 @@ namespace GFGGame
|
|
delay = delay / 1000f;
|
|
delay = delay / 1000f;
|
|
_onScreenEffectComplete = OnScreenEffectComplete;
|
|
_onScreenEffectComplete = OnScreenEffectComplete;
|
|
Timers.inst.Add(delay, 1, OnScreenEffectComplete);
|
|
Timers.inst.Add(delay, 1, OnScreenEffectComplete);
|
|
|
|
+ StoryDialogDataManager.Instance.dialogShowDelay = 0.6f;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -341,14 +343,15 @@ namespace GFGGame
|
|
string content = storyDialogCfg.content;
|
|
string content = storyDialogCfg.content;
|
|
content = storyDialogCfg.content.Replace("self", RoleDataManager.roleName);
|
|
content = storyDialogCfg.content.Replace("self", RoleDataManager.roleName);
|
|
|
|
|
|
- bool delay = StoryDialogDataManager.Instance.waitBgChange;
|
|
|
|
while (StoryDialogDataManager.Instance.waitBgChange)
|
|
while (StoryDialogDataManager.Instance.waitBgChange)
|
|
{
|
|
{
|
|
yield return new WaitForEndOfFrame();
|
|
yield return new WaitForEndOfFrame();
|
|
}
|
|
}
|
|
- if (delay)
|
|
|
|
|
|
+
|
|
|
|
+ if(StoryDialogDataManager.Instance.dialogShowDelay > 0)
|
|
{
|
|
{
|
|
- yield return new WaitForSeconds(0.4f);
|
|
|
|
|
|
+ yield return new WaitForSeconds(StoryDialogDataManager.Instance.dialogShowDelay);
|
|
|
|
+ StoryDialogDataManager.Instance.dialogShowDelay = 0f;
|
|
}
|
|
}
|
|
|
|
|
|
_canClickBtnNext = true;
|
|
_canClickBtnNext = true;
|
|
@@ -500,6 +503,8 @@ namespace GFGGame
|
|
}
|
|
}
|
|
_wordList = Regex.Split(words, "&&");
|
|
_wordList = Regex.Split(words, "&&");
|
|
_wordIndex = 0;
|
|
_wordIndex = 0;
|
|
|
|
+ _typingEffect = new TypingFadeEffect(_wordTextField);
|
|
|
|
+ _typingEffect.typeFinishedAction = ShowCurrentWords;
|
|
|
|
|
|
ShowNextDialog();
|
|
ShowNextDialog();
|
|
}
|
|
}
|
|
@@ -532,7 +537,9 @@ namespace GFGGame
|
|
private void ShowCurrentWords()
|
|
private void ShowCurrentWords()
|
|
{
|
|
{
|
|
_arrow.target.visible = true;
|
|
_arrow.target.visible = true;
|
|
- Timers.inst.Remove(UpdateLetters);
|
|
|
|
|
|
+ //Timers.inst.Remove(UpdateLetters);
|
|
|
|
+ StopTyping();
|
|
|
|
+ _typingEffect?.Cancel();
|
|
_wordTextField.text = _currentWords;
|
|
_wordTextField.text = _currentWords;
|
|
_dialogListLookBack.Add(_currentWords);
|
|
_dialogListLookBack.Add(_currentWords);
|
|
_isShowLetters = false;
|
|
_isShowLetters = false;
|
|
@@ -573,33 +580,30 @@ namespace GFGGame
|
|
_wordTextField.verticalAlign = VertAlignType.Top;
|
|
_wordTextField.verticalAlign = VertAlignType.Top;
|
|
_wordTextField.text = "";
|
|
_wordTextField.text = "";
|
|
ArrayList letters = StoryUtil.GetLettersList(_currentWords);
|
|
ArrayList letters = StoryUtil.GetLettersList(_currentWords);
|
|
|
|
+ _canClickBtnNext = false;
|
|
|
|
|
|
- if (StoryDialogDataManager.Instance.waitPicFade)
|
|
|
|
|
|
+ while (StoryDialogDataManager.Instance.waitPicFade)
|
|
{
|
|
{
|
|
- StoryDialogDataManager.Instance.waitPicFade = false;
|
|
|
|
- _canClickBtnNext = false;
|
|
|
|
- yield return new WaitForSeconds(0.4f);
|
|
|
|
- _canClickBtnNext = true;
|
|
|
|
|
|
+ yield return new WaitForEndOfFrame();
|
|
}
|
|
}
|
|
|
|
|
|
- Timers.inst.Add(GameConst.LETTERS_INTERVAL_MAX / _speedAutoPlay, 0, UpdateLetters, letters);
|
|
|
|
|
|
+ _canClickBtnNext = true;
|
|
|
|
+ _wordTextField.text = _currentWords;
|
|
|
|
+ StartTyping();
|
|
}
|
|
}
|
|
|
|
|
|
- private void UpdateLetters(object param)
|
|
|
|
|
|
+ private void StartTyping()
|
|
{
|
|
{
|
|
- ArrayList letters = (ArrayList)param;
|
|
|
|
- if (letters == null || letters.Count <= 0)
|
|
|
|
- {
|
|
|
|
- ShowCurrentWords();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- string letter = (string)letters[0];
|
|
|
|
- letters.RemoveAt(0);
|
|
|
|
- _wordTextField.text = _wordTextField.text + letter;
|
|
|
|
- }
|
|
|
|
|
|
+ _typingEffect.SetSpeed(GameConst.LETTERS_INTERVAL_MAX / _speedAutoPlay);
|
|
|
|
+ _typingEffect.Start();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void StopTyping()
|
|
|
|
+ {
|
|
|
|
+ _typingEffect.Cancel();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
private void UpdateBg(string value)
|
|
private void UpdateBg(string value)
|
|
{
|
|
{
|
|
if (value.Length > 0)
|
|
if (value.Length > 0)
|
|
@@ -712,6 +716,8 @@ namespace GFGGame
|
|
{
|
|
{
|
|
_ui.m_btnSpeedUp.text = "";
|
|
_ui.m_btnSpeedUp.text = "";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ _typingEffect?.SetSpeed(GameConst.LETTERS_INTERVAL_MAX / _speedAutoPlay);
|
|
}
|
|
}
|
|
|
|
|
|
private void StopAutoPlay()
|
|
private void StopAutoPlay()
|