倒计时的算法及界面调整

This commit is contained in:
lishuo committed 2021-07-30 15:38:40 +08:00
1 parent bea0e40ec1
commit 074200cb4f
16 files changed
+2714 -2596

No files matched your search

@@ -140,6 +140,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
HeartRate = item.HeartRate,
Cadence = item.Cadence,
TotalTicks = item.TotalTicks,
WeightKg = item.WeightKg,
});
}
@@ -367,27 +368,38 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
if (CanStart()) return 0;
return (int)Math.Floor((mapCompetition.StartTime.ToLocalTime() - Now).TotalSeconds);
}
public int RaceStartTime()
{
return (int)Math.Floor((Now - mapCompetition.StartTime.ToLocalTime() ).TotalSeconds);
}
/// <summary>
/// 结束倒计时,bool值为true说明倒计时是关门时间
/// </summary>
/// <returns></returns>
public (int, bool) EndCountDown()
public (int,int, bool) EndCountDown()
{
//if (CanStart() == false) return (0, false);
//if (recorderData.IsCompleted) return 0;
var end1 = (int)Math.Floor((mapCompetition.EndTime.ToLocalTime() - Now).TotalSeconds);
var now = Now ;
var mi = now.Millisecond;
now = now.AddMilliseconds(-mi);
var end1 = (int)Math.Floor((mapCompetition.EndTime.ToLocalTime() - now).TotalSeconds);
var s = (int)Math.Floor((now - mapCompetition.EndTime.ToLocalTime()).TotalSeconds);
var start = (int)Math.Floor((now - mapCompetition.StartTime.ToLocalTime()).TotalSeconds);
if (!FirstEndTime.HasValue)
{
return (end1, false);
return (end1, start, false);
}
//var end2 = (int)Math.Floor((FirstEndTime.Value - Now).TotalSeconds);
var end2 = (int)Math.Floor((FirstEndTime.Value.ToLocalTime().AddMinutes(mapCompetition.CloseTime) - Now).TotalSeconds);
if (end1 < end2)
{
return (end1, false);
return (end1, start, false);
}
//return Math.Min(end1, end2);
return (end2, true);
return (end2, start, true);
}
}
}
@@ -224,6 +224,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
}
catch (Exception ex)
{
Helper.DelectDir(path);
Debug.Log(ex.Message);
}
recordData.Add(interruptRecord, files);
@@ -249,7 +250,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
{
if (result.result && Directory.Exists(path))
{
Helper.DelectDir(path);
//Helper.DelectDir(path);
}
}
catch (Exception e)