Unity UGUI模拟打字效果
来源:互联网 发布:php在线文件管理系统 编辑:程序博客网 时间:2024/06/16 20:26
代码如下
using System.Collections;using UnityEngine;using UnityEngine.UI;public class SelfWritingText : MonoBehaviour{ [SerializeField] private Text textToUse; [SerializeField] private bool useThisText = false; [SerializeField] private bool useThisTextText = false; [SerializeField] private float letterPause = 0.1f; [TextAreaAttribute(4, 15)] [SerializeField] private string message; private void Start() { message = textToShow[0]; if (useThisText) { textToUse = GetComponent<Text>(); } if (useThisTextText) { message = textToUse.text; } textToUse.text = ""; StartCoroutine(TypeText(textToUse, message, letterPause)); } private IEnumerator TypeText(Text text, string textText, float timePause) { for (int i = 0; i < textText.Length; i++) { text.text += textText[i]; yield return 0; yield return new WaitForSeconds(timePause); } } public void WriteText(Text newText = null, string newTextToShow = null, float newLetterPause = -1.0f) { if (newText != null && newTextToShow != null && newLetterPause > 0.0f) { StartCoroutine(TypeText(newText, newTextToShow, newLetterPause)); return; } if (newText != null && newTextToShow != null) { StartCoroutine(TypeText(newText, newTextToShow, letterPause)); return; } if (newText != null && newLetterPause > 0.0f) { StartCoroutine(TypeText(newText, message, newLetterPause)); return; } if (newTextToShow != null && newLetterPause > 0.0f) { StartCoroutine(TypeText(textToUse, newTextToShow, newLetterPause)); return; } if (newTextToShow != null) { StartCoroutine(TypeText(textToUse, newTextToShow, letterPause)); return; } if (newLetterPause > 0.0f) { StartCoroutine(TypeText(textToUse, message, letterPause)); return; } }}
阅读全文
0 0
- Unity UGUI模拟打字效果
- UGUI 实现文本打字效果
- Unity UGUI烟雾效果
- [Unity UGUI]ScrollRect效果大全
- unity中实现键盘打字的效果
- jQ模拟打字效果插件typetype
- Unity实现滑页效果(UGUI)
- Unity实现滑页效果(UGUI)
- Unity实现UI渐变效果(UGUI)
- Unity实现UI渐变效果(UGUI)
- 打字效果
- Unity UGUI
- 【Unity&UGUI】
- Unity UGUI——遮罩效果(Mask)
- Unity教程之- UGUI分页效果的实现
- Unity 毛玻璃效果(UGUI)—高斯模糊
- Unity学习——UGUI制作技能的冷却效果
- unity ugui 文字渐变效果 5.4.3可用
- Myeclipse创建servlet的时候提示路径需求错误
- 脚本自动ping检测网络情况
- java学习笔记
- .net core 自动生成EF代码
- UVa 488 Triangle Wave(格式控制)
- Unity UGUI模拟打字效果
- arcgis api for javascrpit 基于dojo框架的query查询功能3
- 计算机蓝屏处理办法
- spark SQL
- 基于大华SDK 实现大华NVR 取流显示和文件回放功能的实现
- Linode服务器购买与LNMP搭建
- centos 新增用户
- rsync的配置
- 转: 联合体(union)的使用方法及其本质