/// <summary> /// 输入错误内容回调 /// </summary> private void OnInputWrong() { TextTool.RefreshText(_promptText, _wrongPromptStr); Tweener tweener = _promptText.DOFade(0, _promptFadeoutTime); tweener.OnComplete(() => { TextTool.ClearText(_promptText); TextTool.SetTextAlpha(_promptText, 1); _nameInput.text = string.Empty; SetInputInteractable(true); }); }
/// <summary> /// 开场动画 /// </summary> /// <returns></returns> private void PlayContentTextAnim() { string welcomeStr = _welcomeText.text; TextTool.ClearText(_welcomeText); TweenCallback callback = () => { TypeWriter(_nameInput.placeholder.GetComponent <Text>(), _placeHolderStr, 2.5f, () => { SetInputInteractable(true); }, ScrambleMode.None); }; TypeWriter(_welcomeText, welcomeStr, 6.5f, callback, ScrambleMode.Numerals); }
/// <summary> /// 内容开场出现动画效果 /// </summary> /// <returns></returns> IEnumerator PlayContentTextAnim() { string str = _contentText.text; TextTool.ClearText(_contentText); string[] strArr = str.Split('\n'); Text[] txtArr = new Text[strArr.Length]; for (int i = 0; i < txtArr.Length; i++) { txtArr[i] = _contentText.transform.GetChild(i).GetComponent <Text>(); TextTool.RefreshText(txtArr[i], strArr[i]); TextTool.SetTextAlpha(txtArr[i], 0); } yield return(new WaitForSeconds(1.5f)); TweenCallback callback = () => { _lineButton.enabled = true; }; AllTextDoFade(txtArr, txtArr.Length, 2, callback); }