Clarify instructions on the level prep screen and mark the start.

This commit is contained in:
Dustin Carlino 2020-12-15 12:45:08 -08:00
parent 551d28b3df
commit 54eee6d3e4
3 changed files with 52 additions and 15 deletions

View File

@ -0,0 +1,3 @@
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9 8H13V5H16L11 0L6 5H9V8ZM8 9H5V6L0 11L5 16V13H8V9ZM22 11L17 6V9H14V13H17V16L22 11ZM13 14H9V17H6L11 22L16 17H13V14Z" fill="#7FFA4D"/>
</svg>

After

Width:  |  Height:  |  Size: 247 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M13 1.07V9h7c0-4.08-3.05-7.44-7-7.93zM4 15c0 4.42 3.58 8 8 8s8-3.58 8-8v-4H4v4zm7-13.93C7.05 1.56 4 4.92 4 9h7V1.07z" fill="#7FFA4D"/></svg>

After

Width:  |  Height:  |  Size: 272 B

View File

@ -10,8 +10,8 @@ use map_gui::load::MapLoader;
use map_gui::ID;
use map_model::BuildingID;
use widgetry::{
Btn, Color, EventCtx, GfxCtx, HorizontalAlignment, Key, Line, Outcome, Panel, RewriteColor,
State, Text, TextExt, VerticalAlignment, Widget,
Btn, Color, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line, Outcome,
Panel, RewriteColor, State, Text, TextExt, VerticalAlignment, Widget,
};
use crate::buildings::{BldgState, Buildings};
@ -30,6 +30,7 @@ pub struct Picker {
level: Level,
bldgs: Buildings,
current_picks: HashSet<BuildingID>,
draw_start: Drawable,
}
impl Picker {
@ -40,22 +41,22 @@ impl Picker {
level.map.clone(),
Box::new(move |ctx, app| {
ctx.canvas.cam_zoom = ZOOM;
ctx.canvas.center_on_map_pt(app.map.get_bounds().center());
let start = app
.map
.get_i(app.map.find_i_by_osm_id(level.start).unwrap())
.polygon
.center();
ctx.canvas.center_on_map_pt(start);
let bldgs = Buildings::new(ctx, app, HashSet::new());
let mut txt = Text::new();
txt.add(Line(format!("Prepare for {}", level.title)).small_heading());
txt.add(Line(format!("Ready for {}?", level.title)).small_heading());
txt.add(Line(format!(
"Goal: deliver {} presents in {}",
prettyprint_usize(level.goal),
level.time_limit
"Goal: deliver {} presents",
prettyprint_usize(level.goal)
)));
txt.add_appended(vec![
Line("Use the "),
Line("arrow keys").fg(ctx.style().hotkey_color),
Line(" to move"),
]);
txt.add(Line(format!("Time limit: {}", level.time_limit)));
txt.add_appended(vec![
Line("Deliver presents to "),
Line("single-family homes").fg(app.cs.residential_building),
@ -67,15 +68,46 @@ impl Picker {
Line("stores").fg(app.session.colors.store),
]);
let instructions_panel = Panel::new(Widget::col(vec![
txt.draw(ctx),
Widget::row(vec![
Widget::draw_svg(ctx, "system/assets/tools/arrow_keys.svg"),
Text::from_all(vec![
Line("arrow keys").fg(ctx.style().hotkey_color),
Line(" to move"),
])
.draw(ctx),
]),
Widget::row(vec![
Widget::draw_svg(ctx, "system/assets/tools/mouse.svg"),
Text::from_all(vec![
Line("mouse scroll wheel or touchpad").fg(ctx.style().hotkey_color),
Line(" to zoom in or out"),
])
.draw(ctx),
]),
Text::from_all(vec![
Line("Escape key").fg(ctx.style().hotkey_color),
Line(" to pause"),
])
.draw(ctx),
]))
.aligned(HorizontalAlignment::Center, VerticalAlignment::BottomInset)
.build(ctx);
let draw_start = GeomBatch::load_svg(ctx, "system/assets/timeline/start_pos.svg")
.scale(3.0)
.color(RewriteColor::ChangeAll(Color::RED))
.centered_on(start);
Transition::Replace(Box::new(Picker {
vehicle_panel: make_vehicle_panel(ctx, app),
upzone_panel: make_upzone_panel(ctx, app, 0),
instructions_panel: Panel::new(txt.draw(ctx).container())
.aligned(HorizontalAlignment::Center, VerticalAlignment::BottomInset)
.build(ctx),
instructions_panel,
level,
bldgs,
current_picks: HashSet::new(),
draw_start: ctx.upload(draw_start),
}))
}),
)
@ -169,6 +201,7 @@ impl State<App> for Picker {
if let Some(ID::Building(b)) = app.current_selection {
g.draw_polygon(app.cs.selected, app.map.get_b(b).polygon.clone());
}
g.redraw(&self.draw_start);
}
}