mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
start undoing the separate DynamicMenu experiment. move agent colorscheme back into main modalmenu
This commit is contained in:
parent
d0879117f3
commit
13976ea0c5
@ -146,9 +146,9 @@ impl State for ABTestMode {
|
||||
return Transition::Push(Box::new(explorer));
|
||||
}
|
||||
|
||||
/*if let Some(t) = self.primary_agent_tools.event(ctx, ui, &mut self.menu) {
|
||||
if let Some(t) = self.primary_agent_tools.event(ctx, ui, &mut self.menu) {
|
||||
return t;
|
||||
}*/
|
||||
}
|
||||
|
||||
if self.menu.action("save state") {
|
||||
ctx.loading_screen("savestate", |_, timer| {
|
||||
|
@ -3,7 +3,7 @@ use crate::common::ColorLegend;
|
||||
use crate::game::{Transition, WizardState};
|
||||
use crate::render::{AgentColorScheme, MIN_ZOOM_FOR_DETAIL};
|
||||
use crate::ui::UI;
|
||||
use ezgui::{hotkey, Choice, DynamicMenu, EventCtx, GfxCtx, Key};
|
||||
use ezgui::{hotkey, Choice, DynamicMenu, EventCtx, GfxCtx, Key, ModalMenu};
|
||||
use geom::{Duration, Pt2D};
|
||||
use sim::{TripID, TripResult};
|
||||
use std::cell::RefCell;
|
||||
@ -19,18 +19,20 @@ pub struct AgentTools {
|
||||
|
||||
impl AgentTools {
|
||||
pub fn new(ctx: &mut EventCtx) -> AgentTools {
|
||||
let mut menu = DynamicMenu::new("Agent Tools", ctx);
|
||||
menu.add_action(hotkey(Key::Semicolon), "change agent colorscheme", ctx);
|
||||
|
||||
AgentTools {
|
||||
following: None,
|
||||
route_viewer: RouteViewer::Inactive,
|
||||
agent_cs_legend: RefCell::new(None),
|
||||
menu,
|
||||
menu: DynamicMenu::new("Agent Tools", ctx),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn event(&mut self, ctx: &mut EventCtx, ui: &UI) -> Option<Transition> {
|
||||
pub fn event(
|
||||
&mut self,
|
||||
ctx: &mut EventCtx,
|
||||
ui: &UI,
|
||||
menu: &mut ModalMenu,
|
||||
) -> Option<Transition> {
|
||||
self.menu.handle_event(ctx);
|
||||
|
||||
if self.following.is_none() {
|
||||
@ -91,7 +93,7 @@ impl AgentTools {
|
||||
}
|
||||
self.route_viewer.event(ctx, ui, &mut self.menu);
|
||||
|
||||
if self.menu.action("change agent colorscheme") {
|
||||
if menu.action("change agent colorscheme") {
|
||||
return Some(Transition::Push(WizardState::new(Box::new(
|
||||
|wiz, ctx, ui| {
|
||||
let (_, acs) = wiz.wrap(ctx).choose("Which colorscheme for agents?", || {
|
||||
|
@ -61,10 +61,10 @@ impl SandboxMode {
|
||||
(hotkey(Key::S), "start a scenario"),
|
||||
],
|
||||
vec![
|
||||
// TODO Strange to always have this. Really it's a case of stacked modal?
|
||||
(hotkey(Key::T), "start time traveling"),
|
||||
(hotkey(Key::Q), "scoreboard"),
|
||||
(hotkey(Key::L), "change analytics overlay"),
|
||||
(hotkey(Key::Semicolon), "change agent colorscheme"),
|
||||
],
|
||||
vec![
|
||||
(hotkey(Key::Escape), "quit"),
|
||||
@ -121,7 +121,7 @@ impl State for SandboxMode {
|
||||
return Transition::Push(Box::new(explorer));
|
||||
}
|
||||
|
||||
if let Some(t) = self.agent_tools.event(ctx, ui) {
|
||||
if let Some(t) = self.agent_tools.event(ctx, ui, &mut self.menu) {
|
||||
return t;
|
||||
}
|
||||
if ui.primary.current_selection.is_none() && self.menu.action("start time traveling") {
|
||||
|
Loading…
Reference in New Issue
Block a user