mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 10:44:56 +03:00
show individual pandemic state in info panels (and some formatting
tweaks)
This commit is contained in:
parent
d4af10ae2d
commit
b508a0a8f8
@ -427,7 +427,7 @@ fn make_table<I: Into<String>>(ctx: &EventCtx, rows: Vec<(I, String)>) -> Vec<Wi
|
||||
rows.into_iter()
|
||||
.map(|(k, v)| {
|
||||
Widget::row(vec![
|
||||
Line(k).draw(ctx),
|
||||
Line(k).secondary().draw(ctx),
|
||||
// TODO not quite...
|
||||
v.draw_text(ctx).centered_vert().align_right(),
|
||||
])
|
||||
|
@ -26,6 +26,30 @@ pub fn trips(
|
||||
is_paused,
|
||||
);
|
||||
|
||||
// TODO This probably belongs on a different tab, but it's also convenient to see it up-front.
|
||||
if let Some(p) = app.primary.sim.get_pandemic_model() {
|
||||
let status = if p.sane.contains(&id) {
|
||||
"Susceptible".to_string()
|
||||
} else if let Some((t, _)) = p.exposed.get(&id) {
|
||||
format!("Exposed at {}", t.ampm_tostring())
|
||||
} else if let Some((t, _)) = p.infected.get(&id) {
|
||||
format!("Infected at {}", t.ampm_tostring())
|
||||
} else if p.recovered.contains(&id) {
|
||||
"Recovered".to_string()
|
||||
} else {
|
||||
// TODO More info here? Make these public too?
|
||||
"Other (hospitalized or quarantined)".to_string()
|
||||
};
|
||||
rows.push(
|
||||
Text::from_all(vec![
|
||||
Line("Pandemic model state: ").secondary(),
|
||||
Line(status),
|
||||
])
|
||||
.draw(ctx)
|
||||
.margin_below(5),
|
||||
);
|
||||
}
|
||||
|
||||
let map = &app.primary.map;
|
||||
let sim = &app.primary.sim;
|
||||
let person = sim.get_person(id);
|
||||
@ -322,6 +346,5 @@ fn current_status(ctx: &EventCtx, person: &Person, map: &Map) -> Widget {
|
||||
occurred)"
|
||||
.draw_text(ctx),
|
||||
})
|
||||
.outline(2.0, Color::WHITE)
|
||||
.margin_vert(16)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user