加载进度条提示内容定时切换

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JeanShaw/article/details/82627506

进度条的内容直接存放在一个队列中,每5帧即可切换一次,随机生成一个整型数显示文本内容。

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class LoginTipChange : MonoBehaviour 
{
    public UILabel processText;//进度条的默认显示内容
    public List<UILabel> labelList;
    int listCount;
    int curIndex = 0;

    void Start ()
    {
        listCount = labelList.Count;
        curIndex = Random.Range(0,listCount);
        processText.text = labelList[curIndex].text;
        Invoke("change",5);
    }

    public void change()
    {
        if(gameObject.activeSelf)
        {
            curIndex++;
            if(curIndex >= listCount)
            {
                curIndex = 0;
            }
            processText.text = labelList[curIndex].text;
            Invoke("change",5);
        }
    }

}

猜你喜欢

转载自blog.csdn.net/JeanShaw/article/details/82627506
今日推荐