mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 16:02:23 +03:00
woops, fix a tutorial crash from the refactor. and tweak a few info
panels [rebuild]
This commit is contained in:
parent
da67fb0da1
commit
403232e48e
@ -57,7 +57,8 @@ impl<T: 'static + Ord + PartialEq + Copy + core::fmt::Debug + Yvalue<T>> Plot<T>
|
|||||||
Circle::new(Pt2D::new(radius, radius), Distance::meters(radius))
|
Circle::new(Pt2D::new(radius, radius), Distance::meters(radius))
|
||||||
.to_polygon(),
|
.to_polygon(),
|
||||||
)]),
|
)]),
|
||||||
),
|
)
|
||||||
|
.margin(5),
|
||||||
s.label.clone().draw_text(ctx),
|
s.label.clone().draw_text(ctx),
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -79,7 +79,9 @@ pub fn people(ctx: &mut EventCtx, app: &App, details: &mut Details, id: Building
|
|||||||
let mut rows = header(ctx, app, details, id, Tab::BldgPeople(id));
|
let mut rows = header(ctx, app, details, id, Tab::BldgPeople(id));
|
||||||
// TODO Sort/group better
|
// TODO Sort/group better
|
||||||
// Show minimal info: ID, next departure time, type of that trip
|
// Show minimal info: ID, next departure time, type of that trip
|
||||||
|
let mut any = false;
|
||||||
for p in app.primary.sim.bldg_to_people(id) {
|
for p in app.primary.sim.bldg_to_people(id) {
|
||||||
|
any = true;
|
||||||
let person = app.primary.sim.get_person(p);
|
let person = app.primary.sim.get_person(p);
|
||||||
|
|
||||||
let mut next_trip: Option<(Time, TripMode)> = None;
|
let mut next_trip: Option<(Time, TripMode)> = None;
|
||||||
@ -112,6 +114,9 @@ pub fn people(ctx: &mut EventCtx, app: &App, details: &mut Details, id: Building
|
|||||||
},
|
},
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
if !any {
|
||||||
|
rows.push("Nobody's inside right now".draw_text(ctx));
|
||||||
|
}
|
||||||
|
|
||||||
rows
|
rows
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use crate::app::App;
|
|||||||
use crate::helpers::rotating_color_map;
|
use crate::helpers::rotating_color_map;
|
||||||
use crate::info::{header_btns, make_tabs, throughput, Details, Tab};
|
use crate::info::{header_btns, make_tabs, throughput, Details, Tab};
|
||||||
use abstutil::prettyprint_usize;
|
use abstutil::prettyprint_usize;
|
||||||
use ezgui::{EventCtx, Line, Plot, PlotOptions, Series, Text, Widget};
|
use ezgui::{EventCtx, Line, Plot, PlotOptions, Series, Text, TextExt, Widget};
|
||||||
use geom::{Duration, Statistic, Time};
|
use geom::{Duration, Statistic, Time};
|
||||||
use map_model::{IntersectionID, IntersectionType};
|
use map_model::{IntersectionID, IntersectionType};
|
||||||
use sim::Analytics;
|
use sim::Analytics;
|
||||||
@ -36,9 +36,7 @@ pub fn traffic(
|
|||||||
|
|
||||||
let mut txt = Text::new();
|
let mut txt = Text::new();
|
||||||
|
|
||||||
txt.add(Line("Throughput"));
|
txt.add(Line(format!(
|
||||||
txt.add(
|
|
||||||
Line(format!(
|
|
||||||
"Since midnight: {} agents crossed",
|
"Since midnight: {} agents crossed",
|
||||||
prettyprint_usize(
|
prettyprint_usize(
|
||||||
app.primary
|
app.primary
|
||||||
@ -48,10 +46,8 @@ pub fn traffic(
|
|||||||
.count_per_intersection
|
.count_per_intersection
|
||||||
.get(id)
|
.get(id)
|
||||||
)
|
)
|
||||||
))
|
)));
|
||||||
.secondary(),
|
txt.add(Line(format!("In 20 minute buckets:")));
|
||||||
);
|
|
||||||
txt.add(Line(format!("In 20 minute buckets:")).secondary());
|
|
||||||
rows.push(txt.draw(ctx));
|
rows.push(txt.draw(ctx));
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
@ -69,9 +65,7 @@ pub fn delay(ctx: &EventCtx, app: &App, details: &mut Details, id: IntersectionI
|
|||||||
let i = app.primary.map.get_i(id);
|
let i = app.primary.map.get_i(id);
|
||||||
|
|
||||||
assert!(i.is_traffic_signal());
|
assert!(i.is_traffic_signal());
|
||||||
let mut txt = Text::from(Line("Delay"));
|
rows.push("In 20 minute buckets".draw_text(ctx));
|
||||||
txt.add(Line(format!("In 20 minute buckets:")).secondary());
|
|
||||||
rows.push(txt.draw(ctx));
|
|
||||||
|
|
||||||
rows.push(delay_plot(ctx, app, id, Duration::minutes(20)).margin(10));
|
rows.push(delay_plot(ctx, app, id, Duration::minutes(20)).margin(10));
|
||||||
|
|
||||||
|
@ -100,10 +100,8 @@ pub fn traffic(ctx: &EventCtx, app: &App, details: &mut Details, id: LaneID) ->
|
|||||||
let r = map.get_r(l.parent);
|
let r = map.get_r(l.parent);
|
||||||
|
|
||||||
// Since this applies to the entire road, ignore lane type.
|
// Since this applies to the entire road, ignore lane type.
|
||||||
let mut txt = Text::from(Line(""));
|
let mut txt = Text::from(Line("Traffic over entire road, not just this lane"));
|
||||||
txt.add(Line("Throughput (entire road)"));
|
txt.add(Line(format!(
|
||||||
txt.add(
|
|
||||||
Line(format!(
|
|
||||||
"Since midnight: {} agents crossed",
|
"Since midnight: {} agents crossed",
|
||||||
prettyprint_usize(
|
prettyprint_usize(
|
||||||
app.primary
|
app.primary
|
||||||
@ -113,10 +111,8 @@ pub fn traffic(ctx: &EventCtx, app: &App, details: &mut Details, id: LaneID) ->
|
|||||||
.count_per_road
|
.count_per_road
|
||||||
.get(r.id)
|
.get(r.id)
|
||||||
)
|
)
|
||||||
))
|
)));
|
||||||
.secondary(),
|
txt.add(Line(format!("In 20 minute buckets:")));
|
||||||
);
|
|
||||||
txt.add(Line(format!("In 20 minute buckets:")).secondary());
|
|
||||||
rows.push(txt.draw(ctx));
|
rows.push(txt.draw(ctx));
|
||||||
|
|
||||||
let r = map.get_l(id).parent;
|
let r = map.get_l(id).parent;
|
||||||
|
@ -80,8 +80,11 @@ impl GameplayState for Tutorial {
|
|||||||
) -> (Option<Transition>, bool) {
|
) -> (Option<Transition>, bool) {
|
||||||
// TODO Hack. We have to do this before grabbing the tutorial session.
|
// TODO Hack. We have to do this before grabbing the tutorial session.
|
||||||
let target = CarID(30, VehicleType::Car);
|
let target = CarID(30, VehicleType::Car);
|
||||||
let following_car =
|
let following_car = controls
|
||||||
controls.common.as_ref().unwrap().info_panel_open(app) == Some(ID::Car(target));
|
.common
|
||||||
|
.as_ref()
|
||||||
|
.map(|c| c.info_panel_open(app) == Some(ID::Car(target)))
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
let mut tut = app.session.tutorial.as_mut().unwrap();
|
let mut tut = app.session.tutorial.as_mut().unwrap();
|
||||||
|
|
||||||
@ -439,7 +442,7 @@ impl Task {
|
|||||||
}
|
}
|
||||||
Task::TimeControls => "Simulate until after 5pm",
|
Task::TimeControls => "Simulate until after 5pm",
|
||||||
Task::PauseResume => {
|
Task::PauseResume => {
|
||||||
let mut txt = Text::from(Line("☐ Pause/resume "));
|
let mut txt = Text::from(Line("[ ] Pause/resume "));
|
||||||
txt.append(Line(format!("{} times", 3 - state.num_pauses)).fg(Color::GREEN));
|
txt.append(Line(format!("{} times", 3 - state.num_pauses)).fg(Color::GREEN));
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
@ -472,7 +475,7 @@ impl Task {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut txt = Text::new();
|
let mut txt = Text::new();
|
||||||
txt.add_wrapped(format!("☐ {}", simple), 0.6 * ctx.canvas.window_width);
|
txt.add_wrapped(format!("[ ] {}", simple), 0.6 * ctx.canvas.window_width);
|
||||||
txt
|
txt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user