直播平台搭建,小小倒计时器
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";
}
}
}
}
以上就是直播平台搭建,小小倒计时器, 更多内容欢迎关注之后的文章
标签:text,image,倒计时,直播,fillAmount,搭建 From: https://www.cnblogs.com/yunbaomengnan/p/17553561.html