骑行界面按钮替换,界面&逻辑调整

This commit is contained in:
lishuo committed 2021-04-29 18:07:30 +08:00
1 parent 9993752ff5
commit ae55258b9b
28 files changed
+11438 -8086

No files matched your search

+21 -9
View File
@@ -20,17 +20,29 @@ namespace Assets.Scenes.Ride.Scripts
mScoreSequence.SetAutoKill(false);
text = transform.GetComponent<Text>();
}
public void AnimateNum(float newScore, int digit, string format)
private double temp = 0;
private int index = -1;
public void AnimateNum(float newScore,double totalDistance,int currentIndex, int digit, string format)
{
mScoreSequence.Append(DOTween.To(delegate (float value)
if (currentIndex != index)
{
var temp = Math.Round(value, digit);
//向Text组件赋值
text.text = string.Format(format, temp);
}, mOldScore, newScore, 1f));
//将更新后的值记录下来, 用于下一次滚动动画
mOldScore = newScore;
text.text = string.Format(format, totalDistance);
index = currentIndex;
}
else
{
mScoreSequence.Append(DOTween.To(delegate (float value)
{
if (value != newScore)
{
temp = Math.Round(value, digit);
//向Text组件赋值
text.text = string.Format(format, temp);
}
}, mOldScore, newScore, 1f));
//将更新后的值记录下来, 用于下一次滚动动画
mOldScore = newScore;
}
}
}
}