This commit is contained in:
ntr committed 2023-08-04 16:00:10 +10:00
1 parent d97efd0e88
commit c61fd84f90
4 files changed
+57 -50

No files matched your search

+7 -7
View File
@@ -129,17 +129,17 @@ public class Timing: MonoBehaviour {
return LapStorageService.PB(mapName);
}
public double PBSectorDiff(SectorTime s) => PB() switch {
public TimingNotice PBSectorDiff(SectorTime s) => PB() switch {
Lap pb => pb.Sectors.SingleOrDefault(fls => fls.Sector == s.Sector) switch {
SectorTime fastestSector => s.Seconds - fastestSector.Seconds,
null => -1d,
SectorTime fastestSector => (new TimingNotice { Seconds = s.Seconds }).Compare(fastestSector.Seconds),
null => new TimingNotice { Seconds = s.Seconds }, // this one should never happen
},
null => -1d,
null => new TimingNotice { Seconds = s.Seconds }, // there is no pb
};
public double PBLapDiff(Lap lap) => PB() switch {
Lap pb => lap.TotalTime - pb.TotalTime,
null => -1d,
public TimingNotice PBLapDiff(Lap lap) => PB() switch {
Lap pb => (new TimingNotice { Seconds = lap.TotalTime }).Compare(pb.TotalTime),
null => new TimingNotice { Seconds = lap.TotalTime },
};
}