Use rFactor typical angled ui elements #6
2 changed files with 36 additions and 5 deletions
|
@ -9,6 +9,9 @@ use vulkan_rs::prelude::*;
|
|||
pub enum BehindLeader {
|
||||
Time(f64),
|
||||
Laps(i32),
|
||||
DNF,
|
||||
DSQ,
|
||||
PITS,
|
||||
}
|
||||
|
||||
pub struct LeaderBoardEntry {
|
||||
|
@ -164,6 +167,15 @@ impl LeaderBoardEntry {
|
|||
BehindLeader::Laps(laps_behind) => {
|
||||
self.time_label.set_text(format!("+{}", laps_behind))?;
|
||||
}
|
||||
BehindLeader::DNF => {
|
||||
self.time_label.set_text("DNF")?;
|
||||
}
|
||||
BehindLeader::DSQ => {
|
||||
self.time_label.set_text("DSQ")?;
|
||||
}
|
||||
BehindLeader::PITS => {
|
||||
self.time_label.set_text("PIT")?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -327,12 +327,31 @@ impl LeaderBoard {
|
|||
}
|
||||
|
||||
fn query_behind_leader(scoring: &VehicleScoringInfoV01) -> BehindLeader {
|
||||
let laps_behind = scoring.mLapsBehindLeader;
|
||||
match scoring.mFinishStatus {
|
||||
0 | 1 => {
|
||||
if scoring.mInPits != 0 {
|
||||
BehindLeader::PITS
|
||||
} else {
|
||||
let laps_behind = scoring.mLapsBehindLeader;
|
||||
|
||||
if laps_behind != 0 {
|
||||
BehindLeader::Laps(laps_behind)
|
||||
} else {
|
||||
BehindLeader::Time(scoring.mTimeBehindLeader)
|
||||
if laps_behind != 0 {
|
||||
BehindLeader::Laps(laps_behind)
|
||||
} else {
|
||||
BehindLeader::Time(scoring.mTimeBehindLeader)
|
||||
}
|
||||
}
|
||||
}
|
||||
2 => BehindLeader::DNF,
|
||||
3 => BehindLeader::DSQ,
|
||||
|
||||
_ => {
|
||||
write_log!(format!(
|
||||
"not allowed finish state: {}",
|
||||
scoring.mFinishStatus
|
||||
));
|
||||
|
||||
BehindLeader::Time(scoring.mTimeBehindLeader)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue