move some associated-stuff coloring to debug mode

This commit is contained in:
Dustin Carlino 2019-11-08 11:36:46 -08:00
parent b7dd4d5ec0
commit de88805ec0
4 changed files with 17 additions and 7 deletions

View File

@ -177,7 +177,17 @@ fn info_for(id: ID, ui: &UI, ctx: &EventCtx) -> Text {
}
}
// TODO Associated cars
let cars = sim.get_parked_cars_by_owner(id);
if !cars.is_empty() {
txt.add(Line(""));
txt.add(Line(format!(
"{} parked cars owned by this building",
cars.len()
)));
for p in cars {
txt.add(Line(format!("- {}", p.vehicle.id)));
}
}
}
ID::Car(id) => {
for line in sim.car_tooltip(id) {

View File

@ -1,5 +1,4 @@
mod agent;
mod associated;
mod colors;
mod info;
mod navigate;
@ -34,7 +33,6 @@ use ezgui::{
use std::collections::BTreeSet;
pub struct CommonState {
associated: associated::ShowAssociatedState,
turn_cycler: turn_cycler::TurnCyclerState,
location_tools: MenuUnderButton,
}
@ -42,7 +40,6 @@ pub struct CommonState {
impl CommonState {
pub fn new(ctx: &EventCtx) -> CommonState {
CommonState {
associated: associated::ShowAssociatedState::Inactive,
turn_cycler: turn_cycler::TurnCyclerState::Inactive,
location_tools: MenuUnderButton::new(
"assets/ui/location.png",
@ -71,7 +68,6 @@ impl CommonState {
return Some(Transition::Push(shortcuts::ChoosingShortcut::new()));
}
self.associated.event(ui);
if let Some(t) = self.turn_cycler.event(ctx, ui) {
return Some(t);
}
@ -209,8 +205,6 @@ impl CommonState {
pub fn draw_options(&self, ui: &UI) -> DrawOptions {
let mut opts = DrawOptions::new();
self.associated
.override_colors(&mut opts.override_colors, ui);
opts.suppress_traffic_signal_details = self
.turn_cycler
.suppress_traffic_signal_details(&ui.primary.map);

View File

@ -1,3 +1,4 @@
mod associated;
mod color_picker;
mod connected_roads;
mod floodfill;
@ -23,6 +24,7 @@ pub struct DebugMode {
menu: ModalMenu,
general_tools: MenuUnderButton,
common: CommonState,
associated: associated::ShowAssociatedState,
connected_roads: connected_roads::ShowConnectedRoads,
objects: objects::ObjectDebugger,
hidden: HashSet<ID>,
@ -65,6 +67,7 @@ impl DebugMode {
ctx,
),
common: CommonState::new(ctx),
associated: associated::ShowAssociatedState::Inactive,
connected_roads: connected_roads::ShowConnectedRoads::new(),
objects: objects::ObjectDebugger::new(),
hidden: HashSet::new(),
@ -112,6 +115,7 @@ impl State for DebugMode {
if let Some(t) = self.common.event(ctx, ui) {
return t;
}
self.associated.event(ui);
if self.general_tools.action("return to previous mode") {
return Transition::Pop;
@ -264,6 +268,8 @@ impl State for DebugMode {
}
}
}
self.associated
.override_colors(&mut opts.override_colors, ui);
ui.draw(g, opts, &ui.primary.sim, self);