直播平台搭建,小小倒计时器

直播平台搭建,小小倒计时器

 

public class jishiqi : MonoBehaviour
{
    Image m_image;
    Text m_text;
    void Start ()
    {
        m_image = GetComponent <Image> ();
        m_text = GameObject.Find ("Text").GetComponent <Text> ();
        m_image.fillAmount = 0f;
        m_text.text = "5";
    }
    void Update ()
    {
    //time.deltaTime是一秒,实现一秒图片完成一次填充。
        m_image.fillAmount += Time.deltaTime;
        if (m_image.fillAmount >= 1) {
            m_image.fillAmount = 0;
            m_text.text = (int.Parse (m_text.text) - 1).ToString ();
            if (m_text.text == "0") {
                m_text.text = "5";
            }
        }
    }
}

以上就是直播平台搭建,小小倒计时器, 更多内容欢迎关注之后的文章

 

posted @ 2023-07-14 14:12  云豹科技-苏凌霄  阅读(11)  评论(0编辑  收藏  举报