mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +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));
|
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;
|
return t;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if self.menu.action("save state") {
|
if self.menu.action("save state") {
|
||||||
ctx.loading_screen("savestate", |_, timer| {
|
ctx.loading_screen("savestate", |_, timer| {
|
||||||
|
@ -3,7 +3,7 @@ use crate::common::ColorLegend;
|
|||||||
use crate::game::{Transition, WizardState};
|
use crate::game::{Transition, WizardState};
|
||||||
use crate::render::{AgentColorScheme, MIN_ZOOM_FOR_DETAIL};
|
use crate::render::{AgentColorScheme, MIN_ZOOM_FOR_DETAIL};
|
||||||
use crate::ui::UI;
|
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 geom::{Duration, Pt2D};
|
||||||
use sim::{TripID, TripResult};
|
use sim::{TripID, TripResult};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@ -19,18 +19,20 @@ pub struct AgentTools {
|
|||||||
|
|
||||||
impl AgentTools {
|
impl AgentTools {
|
||||||
pub fn new(ctx: &mut EventCtx) -> 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 {
|
AgentTools {
|
||||||
following: None,
|
following: None,
|
||||||
route_viewer: RouteViewer::Inactive,
|
route_viewer: RouteViewer::Inactive,
|
||||||
agent_cs_legend: RefCell::new(None),
|
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);
|
self.menu.handle_event(ctx);
|
||||||
|
|
||||||
if self.following.is_none() {
|
if self.following.is_none() {
|
||||||
@ -91,7 +93,7 @@ impl AgentTools {
|
|||||||
}
|
}
|
||||||
self.route_viewer.event(ctx, ui, &mut self.menu);
|
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(
|
return Some(Transition::Push(WizardState::new(Box::new(
|
||||||
|wiz, ctx, ui| {
|
|wiz, ctx, ui| {
|
||||||
let (_, acs) = wiz.wrap(ctx).choose("Which colorscheme for agents?", || {
|
let (_, acs) = wiz.wrap(ctx).choose("Which colorscheme for agents?", || {
|
||||||
|
@ -61,10 +61,10 @@ impl SandboxMode {
|
|||||||
(hotkey(Key::S), "start a scenario"),
|
(hotkey(Key::S), "start a scenario"),
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
// TODO Strange to always have this. Really it's a case of stacked modal?
|
|
||||||
(hotkey(Key::T), "start time traveling"),
|
(hotkey(Key::T), "start time traveling"),
|
||||||
(hotkey(Key::Q), "scoreboard"),
|
(hotkey(Key::Q), "scoreboard"),
|
||||||
(hotkey(Key::L), "change analytics overlay"),
|
(hotkey(Key::L), "change analytics overlay"),
|
||||||
|
(hotkey(Key::Semicolon), "change agent colorscheme"),
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
(hotkey(Key::Escape), "quit"),
|
(hotkey(Key::Escape), "quit"),
|
||||||
@ -121,7 +121,7 @@ impl State for SandboxMode {
|
|||||||
return Transition::Push(Box::new(explorer));
|
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;
|
return t;
|
||||||
}
|
}
|
||||||
if ui.primary.current_selection.is_none() && self.menu.action("start time traveling") {
|
if ui.primary.current_selection.is_none() && self.menu.action("start time traveling") {
|
||||||
|
Loading…
Reference in New Issue
Block a user