金钱数据动画

时间:2021-05-11   阅读次数:

public void ShowTextAnim(int type,int qold,int qnew){
    StartCoroutine(IEShowQianAnim(type,qold,qnew));
}
IEnumerator IEShowQianAnim(int type,int oldq, int newq)
{
int tempq=oldq;
int changeCount=10;
int onceAddCount =Mathf.CeilToInt(1.0f / changeCount * (newq - oldq));
int i = 0;
while (i < changeCount)
{
    i++;
    tempq += onceAddCount;
    if(type==1){
        qianLab.text=tempq.ToString();
    }else if(type==2){
        shengwangLab.text=tempq.ToString();
    }else if(type==3){
        qianfzLab.text=tempq.ToString();
    }
    yield return new WaitForSeconds(0.1f);
    }
    if(type==1){
        qianLab.text=newq+"";
    }else if(type==2){
        shengwangLab.text=newq+"";
    }else if(type==3){
        qianfzLab.text=newq+"";
    }
}
其它文章