mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 07:25:47 +03:00
adjust time warp experience for trips
This commit is contained in:
parent
7dab105d19
commit
0005feb0ac
@ -154,6 +154,7 @@ d4615c4cb06658959bacb474293211f8 data/system/assets/pregame/start.svg
|
||||
cc045df994fa528adafee4f7115fcc0d data/system/assets/speed/slow_down.svg
|
||||
11b856ac818e797ef5e496f38b397cf1 data/system/assets/speed/sunrise.svg
|
||||
bc920c3406bd82b4f54b63845fede3ca data/system/assets/speed/pause.svg
|
||||
5c6762f5323eb76a305846da6b9a482a data/system/assets/speed/info_jump_to_time.svg
|
||||
11cdf641bcffa88cfbcb9bfa3c1542bd data/system/assets/speed/jump_to_time.svg
|
||||
a28c5fa18d32c3325a5f7326fed876fa data/system/assets/speed/reset.svg
|
||||
e348fda658d0fcb6bb8abdcec23d1dab data/system/assets/speed/speed_up.svg
|
||||
|
5
data/system/assets/speed/info_jump_to_time.svg
Normal file
5
data/system/assets/speed/info_jump_to_time.svg
Normal file
@ -0,0 +1,5 @@
|
||||
<svg width="77" height="32" viewBox="0 0 77 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="76.25" height="32" rx="4" fill="white"/>
|
||||
<path d="M18.25 14.5116H12.8821L15.0514 12.2789C12.8901 10.1413 9.39065 10.0621 7.22926 12.1997C5.06786 14.3453 5.06786 17.8051 7.22926 19.9507C9.39065 22.0962 12.8901 22.0962 15.0514 19.9507C16.1282 18.8898 16.6666 17.6468 16.6666 16.0792H18.25C18.25 17.6468 17.5533 19.6815 16.1599 21.0591C13.3809 23.8143 8.86812 23.8143 6.08918 21.0591C3.31816 18.3118 3.29441 13.8465 6.07334 11.0992C8.85228 8.35198 13.3097 8.35198 16.0886 11.0992L18.25 8.87451V14.5116ZM11.5204 12.8331V16.1979L14.2914 17.8447L13.7214 18.8027L10.3328 16.7917V12.8331H11.5204Z" fill="black"/>
|
||||
<path d="M28.736 10.001C28.526 10.211 28.26 10.316 27.938 10.316C27.616 10.316 27.343 10.211 27.119 10.001C26.895 9.777 26.783 9.504 26.783 9.182C26.783 8.86 26.895 8.587 27.119 8.363C27.343 8.125 27.616 8.006 27.938 8.006C28.26 8.006 28.526 8.125 28.736 8.363C28.96 8.587 29.072 8.86 29.072 9.182C29.072 9.504 28.96 9.777 28.736 10.001ZM25.124 27.494L24.263 26.108C25.299 25.94 26.013 25.674 26.405 25.31C26.811 24.946 27.014 24.428 27.014 23.756V12.269H28.841V23.084C28.841 24.386 28.575 25.352 28.043 25.982C27.371 26.808 26.398 27.312 25.124 27.494ZM38.835 23V21.971C38.177 22.825 37.274 23.252 36.126 23.252C34.824 23.252 33.844 22.874 33.186 22.118C32.542 21.362 32.22 20.144 32.22 18.464V12.269H34.047V18.737C34.047 19.703 34.25 20.417 34.656 20.879C35.076 21.327 35.643 21.551 36.357 21.551C38.009 21.551 38.835 20.627 38.835 18.779V12.269H40.662V23H38.835ZM56.737 23V16.49C56.737 14.628 56.016 13.697 54.574 13.697C53.888 13.697 53.328 13.963 52.894 14.495C52.474 15.013 52.264 15.699 52.264 16.553V23H50.437V16.49C50.437 14.628 49.723 13.697 48.295 13.697C47.581 13.697 47.014 13.949 46.594 14.453C46.188 14.943 45.985 15.615 45.985 16.469V23H44.158V12.269H45.985V13.277C46.615 12.437 47.553 12.017 48.799 12.017C49.401 12.017 49.954 12.157 50.458 12.437C50.976 12.703 51.382 13.088 51.676 13.592C52.362 12.542 53.398 12.017 54.784 12.017C55.904 12.017 56.814 12.36 57.514 13.046C58.214 13.732 58.564 14.705 58.564 15.965V23H56.737ZM66.4958 23.252C65.3758 23.252 64.4588 22.832 63.7448 21.992V26.381L61.9178 27.242V12.269H63.7448V13.172C64.5148 12.402 65.4318 12.017 66.4958 12.017C67.8538 12.017 68.9318 12.521 69.7298 13.529C70.5278 14.537 70.9268 15.902 70.9268 17.624C70.9268 19.374 70.5208 20.753 69.7088 21.761C68.8968 22.755 67.8258 23.252 66.4958 23.252ZM66.2648 21.551C67.1608 21.551 67.8468 21.215 68.3228 20.543C68.8128 19.857 69.0578 18.884 69.0578 17.624C69.0578 16.434 68.8058 15.482 68.3018 14.768C67.8118 14.054 67.1328 13.697 66.2648 13.697C65.1308 13.697 64.2908 14.18 63.7448 15.146V20.102C64.4868 21.068 65.3268 21.551 66.2648 21.551Z" fill="black"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
@ -181,6 +181,7 @@ impl GeomBatch {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum RewriteColor {
|
||||
NoOp,
|
||||
Change(Color, Color),
|
||||
|
@ -192,6 +192,7 @@ impl Btn {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum BtnBuilder {
|
||||
SVG {
|
||||
path: String,
|
||||
|
@ -111,19 +111,6 @@ pub fn future(ctx: &mut EventCtx, app: &App, trip: TripID, details: &mut Details
|
||||
|
||||
let mut col = Vec::new();
|
||||
|
||||
col.push(
|
||||
Btn::text_bg2("Wait for trip")
|
||||
.tooltip(Text::from(Line(format!(
|
||||
"This will advance the simulation to {}",
|
||||
start_time.ampm_tostring()
|
||||
))))
|
||||
.build(ctx, format!("wait for {}", trip), None)
|
||||
.margin(5),
|
||||
);
|
||||
details
|
||||
.time_warpers
|
||||
.insert(format!("wait for {}", trip), (trip, start_time));
|
||||
|
||||
if app.has_prebaked().is_some() {
|
||||
let phases = app.prebaked().get_trip_phases(trip, &app.primary.map);
|
||||
let estimated_trip_time =
|
||||
@ -146,6 +133,19 @@ pub fn future(ctx: &mut EventCtx, app: &App, trip: TripID, details: &mut Details
|
||||
("To", name2),
|
||||
],
|
||||
));
|
||||
|
||||
col.push(
|
||||
Btn::text_bg2("Wait for trip")
|
||||
.tooltip(Text::from(Line(format!(
|
||||
"This will advance the simulation to {}",
|
||||
start_time.ampm_tostring()
|
||||
))))
|
||||
.build(ctx, format!("wait for {}", trip), None)
|
||||
.margin(5),
|
||||
);
|
||||
details
|
||||
.time_warpers
|
||||
.insert(format!("wait for {}", trip), (trip, start_time));
|
||||
}
|
||||
|
||||
Widget::col(col)
|
||||
@ -172,45 +172,31 @@ pub fn finished(
|
||||
|
||||
let mut col = Vec::new();
|
||||
|
||||
col.push(
|
||||
Widget::row(vec![
|
||||
Btn::text_bg2("Watch trip")
|
||||
.tooltip(Text::from(Line(format!(
|
||||
"This will reset the simulation to {}",
|
||||
start_time.ampm_tostring()
|
||||
))))
|
||||
.build(ctx, format!("watch {}", trip), None),
|
||||
if show_after && app.has_prebaked().is_some() {
|
||||
let mut open = open_trips.clone();
|
||||
open.insert(trip, false);
|
||||
details.hyperlinks.insert(
|
||||
format!("show before changes for {}", trip),
|
||||
Tab::PersonTrips(person, open),
|
||||
);
|
||||
Btn::text_bg2("Show before changes").build(
|
||||
ctx,
|
||||
format!("show before changes for {}", trip),
|
||||
None,
|
||||
)
|
||||
} else {
|
||||
let mut open = open_trips.clone();
|
||||
open.insert(trip, true);
|
||||
details.hyperlinks.insert(
|
||||
format!("show after changes for {}", trip),
|
||||
Tab::PersonTrips(person, open),
|
||||
);
|
||||
Btn::text_bg2("Show after changes").build(
|
||||
ctx,
|
||||
format!("show after changes for {}", trip),
|
||||
None,
|
||||
)
|
||||
},
|
||||
])
|
||||
.evenly_spaced(),
|
||||
);
|
||||
details
|
||||
.time_warpers
|
||||
.insert(format!("watch {}", trip), (trip, start_time));
|
||||
if show_after && app.has_prebaked().is_some() {
|
||||
let mut open = open_trips.clone();
|
||||
open.insert(trip, false);
|
||||
details.hyperlinks.insert(
|
||||
format!("show before changes for {}", trip),
|
||||
Tab::PersonTrips(person, open),
|
||||
);
|
||||
col.push(Btn::text_bg2("Show before changes").build(
|
||||
ctx,
|
||||
format!("show before changes for {}", trip),
|
||||
None,
|
||||
));
|
||||
} else if app.has_prebaked().is_some() {
|
||||
let mut open = open_trips.clone();
|
||||
open.insert(trip, true);
|
||||
details.hyperlinks.insert(
|
||||
format!("show after changes for {}", trip),
|
||||
Tab::PersonTrips(person, open),
|
||||
);
|
||||
col.push(Btn::text_bg2("Show after changes").build(
|
||||
ctx,
|
||||
format!("show after changes for {}", trip),
|
||||
None,
|
||||
));
|
||||
}
|
||||
|
||||
{
|
||||
let col_width = 15;
|
||||
@ -440,16 +426,57 @@ fn make_timeline(
|
||||
|
||||
timeline.insert(0, start_btn.margin(5));
|
||||
timeline.push(goal_btn.margin(5));
|
||||
|
||||
let mut col = vec![
|
||||
Widget::row(timeline).evenly_spaced().margin_above(25),
|
||||
if let Some(t) = end_time {
|
||||
Widget::row(vec![
|
||||
start_time.ampm_tostring().draw_text(ctx),
|
||||
t.ampm_tostring().draw_text(ctx).align_right(),
|
||||
])
|
||||
} else {
|
||||
start_time.ampm_tostring().draw_text(ctx)
|
||||
},
|
||||
Widget::row(vec![
|
||||
start_time.ampm_tostring().draw_text(ctx),
|
||||
if let Some(t) = end_time {
|
||||
t.ampm_tostring().draw_text(ctx).align_right()
|
||||
} else {
|
||||
Widget::nothing()
|
||||
},
|
||||
]),
|
||||
Widget::row(vec![
|
||||
{
|
||||
details
|
||||
.time_warpers
|
||||
.insert(format!("jump to {}", start_time), (trip, start_time));
|
||||
Btn::svg(
|
||||
"../data/system/assets/speed/info_jump_to_time.svg",
|
||||
RewriteColor::Change(Color::WHITE, app.cs.hovering),
|
||||
)
|
||||
.tooltip({
|
||||
let mut txt = Text::from(Line("This will jump to "));
|
||||
txt.append(Line(start_time.ampm_tostring()).fg(Color::hex("#F9EC51")));
|
||||
txt.add(Line("The simulation will continue, and your score"));
|
||||
txt.add(Line("will be calculated at this new time."));
|
||||
txt
|
||||
})
|
||||
.build(ctx, format!("jump to {}", start_time), None)
|
||||
},
|
||||
if let Some(t) = end_time {
|
||||
details
|
||||
.time_warpers
|
||||
.insert(format!("jump to {}", t), (trip, t));
|
||||
Btn::svg(
|
||||
"../data/system/assets/speed/info_jump_to_time.svg",
|
||||
RewriteColor::Change(Color::WHITE, app.cs.hovering),
|
||||
)
|
||||
.tooltip({
|
||||
let mut txt = Text::from(Line("This will jump to "));
|
||||
txt.append(Line(t.ampm_tostring()).fg(Color::hex("#F9EC51")));
|
||||
txt.add(Line("The simulation will continue, and your score"));
|
||||
txt.add(Line("will be calculated at this new time."));
|
||||
txt
|
||||
})
|
||||
.build(ctx, format!("jump to {}", t), None)
|
||||
.align_right()
|
||||
} else {
|
||||
Widget::nothing()
|
||||
},
|
||||
])
|
||||
.margin_above(5),
|
||||
];
|
||||
// TODO This just needs too much more work
|
||||
if false {
|
||||
|
Loading…
Reference in New Issue
Block a user