修复单人骑行ridingtime差一秒

This commit is contained in:
lishuo 2021-08-12 18:57:30 +08:00
parent 906dc7dec8
commit 11e9acdb14

View File

@ -35,7 +35,7 @@ namespace Assets.Scenes.Ride.Scripts
protected Text currentSlopeToatalDistanceText;//当前坡度总距离
protected Text speedTxt;//当前速度
protected Text powerTxt;//功率
protected Text timerTxt;//计时器
protected Text timerTxt { get; set; }//计时器
protected Text timerTxtTitle;//计时器标题
protected Text ditance;//当前骑行距离
protected Text totalDistance;//当前骑行距离
@ -354,9 +354,14 @@ namespace Assets.Scenes.Ride.Scripts
var currentPlayer = mainController.currentPlayer;
if (currentPlayer != null)
{
int ticks = 0;
if (mainController.cyclingController != null)
{
ticks = mainController.cyclingController.recorderData.RiderDatas.LastOrDefault()?.Ticks ?? 0;
}
speedTxt.text = $"{Math.Round(currentPlayer.Speed, 1)}";
powerTxt.text = $"{currentPlayer.Power}";
timerTxt.text = Helper.FormatTicks(currentPlayer.TotalTicks);
timerTxt.text = Helper.FormatTicks(ticks);
ditance.text = Math.Round(currentPlayer.TotalDistance, 1).ToString("f1");
heartRate.text = (currentPlayer.HeartRate ?? 0).ToString();
candance.text = $"{Math.Round(currentPlayer.Cadance, 0)}";