本地记录重新上传,一些界面bug修复
This commit is contained in:
1 parent
470d52b1bc
commit
f1eeb11543
11 files changed
+6363
-3355
No files matched your search
@@ -10,36 +10,61 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public class NumberDotween:MonoBehaviour
|
||||
{
|
||||
private Sequence mScoreSequence;
|
||||
private Sequence mProgressSequence;
|
||||
private Text text;
|
||||
private float mOldScore = 0;
|
||||
|
||||
private float mOldScoreNew = 0;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//函数内初始化
|
||||
mScoreSequence = DOTween.Sequence();
|
||||
mProgressSequence = DOTween.Sequence();
|
||||
//函数内设置属性
|
||||
mScoreSequence.SetAutoKill(false);
|
||||
mProgressSequence.SetAutoKill(false);
|
||||
text = transform.GetComponent<Text>();
|
||||
}
|
||||
private double temp = 0;
|
||||
private int index = -1;
|
||||
private int indexNew = -1;
|
||||
public void AnimateNum(float newScore,double totalDistance,int currentIndex, int digit, string format,Image process)
|
||||
{
|
||||
if (currentIndex != index)
|
||||
if (currentIndex != indexNew)
|
||||
{
|
||||
text.text = string.Format(format, totalDistance);
|
||||
index = currentIndex;
|
||||
indexNew = currentIndex;
|
||||
process.fillAmount = 1;
|
||||
StartCoroutine(CompleteFill(process));
|
||||
}
|
||||
else
|
||||
{
|
||||
mProgressSequence.Append(DOTween.To(delegate (float value)
|
||||
{
|
||||
process.fillAmount = (float)(value / totalDistance);
|
||||
}, mOldScoreNew, newScore, 1f));
|
||||
//将更新后的值记录下来, 用于下一次滚动动画
|
||||
mOldScoreNew = newScore;
|
||||
}
|
||||
}
|
||||
|
||||
public void AnimateNumText(float newScore, double totalDistance, int currentIndex, int digit, string format, Image process)
|
||||
{
|
||||
if (currentIndex != index)
|
||||
{
|
||||
text.text = string.Format(format, totalDistance);
|
||||
index = currentIndex;
|
||||
mOldScore = (float)totalDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
mScoreSequence.Append(DOTween.To(delegate (float value)
|
||||
{
|
||||
temp = Math.Round(value, digit);
|
||||
process.fillAmount = (float)(value / totalDistance);
|
||||
//向Text组件赋值
|
||||
text.text = string.Format(format, temp);
|
||||
//if (value != newScore)
|
||||
{
|
||||
temp = Math.Round(value, digit);
|
||||
//向Text组件赋值
|
||||
text.text = string.Format(format, temp);
|
||||
}
|
||||
}, mOldScore, newScore, 1f));
|
||||
//将更新后的值记录下来, 用于下一次滚动动画
|
||||
mOldScore = newScore;
|
||||
@@ -48,7 +73,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
IEnumerator CompleteFill(Image process)
|
||||
{
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
mOldScore = 0;
|
||||
mOldScoreNew = 0;
|
||||
process.fillAmount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user