mirror of
https://github.com/a-b-street/abstreet.git
synced 2025-01-08 07:41:57 +03:00
dont pause after returning to sandbox mode. common complaint from people.
This commit is contained in:
parent
d257535a7c
commit
57b8843a18
@ -80,10 +80,6 @@ impl GUI for Game {
|
||||
cb(self.states.last_mut().unwrap(), &mut self.app, ctx);
|
||||
}
|
||||
Transition::PushWithData(cb) => {
|
||||
self.states
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.on_suspend(ctx, &mut self.app);
|
||||
let new_state = cb(self.states.last_mut().unwrap(), &mut self.app, ctx);
|
||||
self.states.push(new_state);
|
||||
}
|
||||
@ -101,10 +97,6 @@ impl GUI for Game {
|
||||
self.states.pop().unwrap().on_destroy(ctx, &mut self.app);
|
||||
}
|
||||
Transition::Push(state) => {
|
||||
self.states
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.on_suspend(ctx, &mut self.app);
|
||||
self.states.push(state);
|
||||
}
|
||||
Transition::Replace(state) => {
|
||||
@ -129,10 +121,6 @@ impl GUI for Game {
|
||||
self.states.extend(states);
|
||||
}
|
||||
Transition::PushTwice(s1, s2) => {
|
||||
self.states
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.on_suspend(ctx, &mut self.app);
|
||||
self.states.push(s1);
|
||||
self.states.push(s2);
|
||||
}
|
||||
@ -207,8 +195,6 @@ pub trait State: downcast_rs::Downcast {
|
||||
DrawBaselayer::DefaultMap
|
||||
}
|
||||
|
||||
// Before we push a new state on top of this one, call this.
|
||||
fn on_suspend(&mut self, _: &mut EventCtx, _: &mut App) {}
|
||||
// Before this state is popped or replaced, call this.
|
||||
fn on_destroy(&mut self, _: &mut EventCtx, _: &mut App) {}
|
||||
// We don't need an on_enter -- the constructor for the state can just do it.
|
||||
|
@ -524,6 +524,13 @@ impl Layers {
|
||||
Some(Transition::Pop)
|
||||
}),
|
||||
)
|
||||
.maybe_cb(
|
||||
"map edits",
|
||||
Box::new(|ctx, app| {
|
||||
app.layer = map::edits(ctx, app);
|
||||
Some(Transition::Pop)
|
||||
}),
|
||||
)
|
||||
.maybe_cb(
|
||||
"amenities",
|
||||
Box::new(|ctx, app| {
|
||||
|
@ -227,12 +227,6 @@ impl State for SandboxMode {
|
||||
self.gameplay.draw(g, app);
|
||||
}
|
||||
|
||||
fn on_suspend(&mut self, ctx: &mut EventCtx, app: &mut App) {
|
||||
if let Some(ref mut s) = self.controls.speed {
|
||||
s.pause(ctx, app);
|
||||
}
|
||||
}
|
||||
|
||||
fn on_destroy(&mut self, _: &mut EventCtx, app: &mut App) {
|
||||
app.layer = Layers::Inactive;
|
||||
app.agent_cs = AgentColorScheme::new(&app.cs);
|
||||
|
Loading…
Reference in New Issue
Block a user