UGUI打字机效果文本组件
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; public class TypewriterText : MonoBehaviour {
private Text text;
private string content;
private float delay;
// Use this for initialization
void Start () {
text = gameObject.GetComponent<Text>();
if(text == null)
{
Debug.LogError("没添加Text脚本");
}
} public void TypeShow(string txt, float _delay=0.5f)
{
content = txt;
delay = _delay;
StartCoroutine(AppearText());
}
public void AllShow(string txt)
{
StopAllCoroutines();
text.text = txt;
}
private IEnumerator AppearText()
{
char[] arr = content.ToCharArray();
for(int i = 0; i<arr.Length; i++)
{
text.text += arr[i];
yield return new WaitForSeconds(delay);
}
}
}
UGUI打字机效果文本组件的更多相关文章
- 关于Unity中NGUI的Tab商城、Scrollview和打字机效果的实现
Tab商城实例 UIToggle 和 UIToggledObjects+ Box Collider(实现商城功能必备) 1.创建两个个UI Sprite,Sprite1和Sprite2 2.给Spri ...
- 【Unity笔记】UGUI的Text文本框的大小随着文本字数变化
需求:UGUI的Text文本框的内容会随着文本字数多少/换行而自动改变大小. 给Text加一个Content Size Filter组件(脚本),设置Horizontal Fit和Vertical F ...
- Java Swing实战(三)文本组件JTextField和密码组件JPasswordField
接下来添加文本组件JTextField和密码组件JPasswordField. /** * @author: lishuai * @date: 2018/11/26 13:51 */ public c ...
- Flutter学习笔记(11)--文本组件、图标及按钮组件
如需转载,请注明出处:Flutter学习笔记(10)--容器组件.图片组件 文本组件 文本组件(text)负责显示文本和定义显示样式,下表为text常见属性 Text组件属性及描述 属性名 类型 默认 ...
- 【Flutter学习】基本组件之文本组件Text
一,概述 文本组件(Text)负责显示文本和定义显示样式, 二,继承关系 Object > Diagnosticable > DiagnosticableTree > Widget ...
- Flutter实战】文本组件及五大案例
老孟导读:大家好,这是[Flutter实战]系列文章的第二篇,这一篇讲解文本组件,文本组件包括文本展示组件(Text和RichText)和文本输入组件(TextField),基础用法和五个案例助你快速 ...
- Angular封装WangEditor富文本组件
富文本组件是web程序中很常用的一个组件,特别是要开发一个博客,论坛这类的网站后台. 得益于Angular的强大,封装WangEditor组件非常简单 1.使用yarn或者npm安装wangedito ...
- Vue个人博客关于标题自动打字机效果Typewriter
最近在写个人Blog 中间看过很多个人博客的开发 一大部分用的是Hexo框架或者vuePress框架 导入各种主题样式插件等等 但是看多了就会发现 很多博主的个人博客基本都很相似 并没有什么新东西呈现 ...
- css3线条围绕跑马+jquery打字机效果
原文地址:css3线条围绕跑马+jquery打字机效果 有图有真相,今天偶然看到了一种效果,仔细看了下,发现它是用css的clip+css3的动画实现的,简直叼.于是自己拿来了前一阵子写的打字机效果, ...
随机推荐
- Python_if
if if c语言中的if语句格式如下: if (条件) { 结果} python的格式与其不同,定义了自己的格式,更加的简明: if 条件 : 结果 print(111) if 3 > 2: ...
- mybatis将传入的Integer类型的0被识别成空字符串的问题
更改mapper文件的sql如下: <if test="interger != null"> interger= #{interger} </if> 原因: ...
- Warning: Using a password on the command line interface can be insecure.
[root@qttc ~]# /usr/local/mysql/bin/mysqldump -uroot -proot db > bak.sqlWarning: Using a passwor ...
- codeforces510D
Fox And Jumping CodeForces - 510D Fox Ciel is playing a game. In this game there is an infinite long ...
- opencv debug版本在linux下编译,并写了一个DEMO
用如下方法编译opencv: git clone "https://github.com/opencv/opencv.git" mkdir opencv_debug cd open ...
- 关于gcd的四道题
T1:bzoj2705 题目描述: 给定一个n求\(\sum\limits_{i=1}^ngcd(i,n)\) 因为n太大,所以O(n)的做法肯定不行,然后就去想根号的方法. \[\sum\limit ...
- marquee标签的使用
marquee语法 <marquee></marquee> 实例一<marquee>Hello, World</marquee> marquee常 ...
- Android studio Error: Modules no specified解决和真机调试
如何配置SDK百度一大堆: 前言:Android Studio很完善,如果SDK配置好,理论上就是 创建项目->创建个APP(名字自己随便起)->打开手机开发者模式运行即可:如果出了问题, ...
- 编写高质量的Python代码系列(五)之并发与并行
用Python可以很容易就能写出并发程序,这种程序可以在同一时间做许多间不同的事情.我们也可以通过系统调用.子进程(subprocess)及C语言扩展来实现并行处理. 第三十六条: 用subproce ...
- datable中table.row() not a funtion 解决方法
解决办法一: 改为.DataTable({ (初始化时候) 解决办法二: 或者改为var data = myTable.api().row( this ).data();(获取值的时候)