Sun Guangdong 2015.6.17
The person familiar with the Ngui will know.
But Ngui made some tedious, interested people can turn Ngui Typewritereffect class Ugui specific, because some of the other scripts, do not love to get.
I'm just simplifying the content. It's enough.
Using system;using unityengine;using unityengine.ui;using unityengine.events;///<summary>/// This script is capable of typing or fading text strings over time. </summary>[requirecomponent (typeof (Text))][addcomponentmenu ("Typewriter Effect")]public class typewritereffect:monobehaviour{public unityevent MyEvent; public int charspersecond = 0; Public AudioClip Maudioclip; The sound of typing, not to play a word, the beginning of the end of the playback stop the private bool isActive = false; private float timer; private string words; Private Text MText; void Start () {if (MyEvent = = null) MyEvent = new Unityevent (); Words = Getcomponent<text> (). Text; Getcomponent<text> (). Text = string. Empty; Timer = 0; IsActive = true; Charspersecond = Mathf.max (1, Charspersecond); MText = getcomponent<text> (); } void Reloadtext () {words = Getcomponent<text> (). Text; MText = getcomponent<text> (); } public void OnStart (){Reloadtext (); IsActive = true; } void Onstartwriter () {if (isActive) {try {mtext.text = words . Substring (0, (int) (Charspersecond * timer)); Timer + = Time.deltatime; } catch (Exception) {onfinish (); }}} void OnFinish () {isActive = false; Timer = 0; Getcomponent<text> (). Text = words; try {myevent.invoke (); } catch (Exception) {Debug.Log ("problem"); }} void Update () {onstartwriter (); }}
It's not finished.
To use the plug-in TEXTFX introduced the previous few days to implement this feature:
??
Ugui achieve text typing effect