Merge branch 'pfau/tutorial_mvp' into 'master'

Initial tutorial MVP

See merge request veloren/veloren!1825
This commit is contained in:
Monty Marz 2021-02-27 19:02:27 +00:00
commit 5589a7b714
7 changed files with 120 additions and 70 deletions

View File

@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed default controller key bindings
- Improved network efficiency by ≈ factor 10 by using tokio.
- Added item tooltips to trade window.
- "Quest" given to new players converted to being a short tutorial
### Removed

BIN
assets/voxygen/element/help.png (Stored with Git LFS)

Binary file not shown.

View File

@ -45,8 +45,7 @@
"You can type /region or /r to only chat with players a couple of hundred blocks around you.",
"Admins can use the /build command to enter build mode.",
"You can type /group or /g to only chat with players in your current group.",
"To send private messages type /tell followed by a player name and your message.",
"NPCs with the same level can have a different difficulty.",
"To send private messages type /tell followed by a player name and your message.",
"Keep an eye out for food, chests and other loot spread all around the world!",
"Inventory filled with food? Try crafting better food from it!",
"Wondering what's there to do? Try out one of the dungeons marked on the map!",
@ -57,8 +56,7 @@
"Press 'L-Shift' to open your Glider and conquer the skies.",
"Veloren is still in Pre-Alpha. We do our best to improve it every day!",
"If you want to join the Dev-Team or just have a chat with us join our Discord-Server.",
"You can toggle showing your amount of health on the healthbar in the settings.",
"In order to see your stats click the 'Stats' button in the inventory.",
"You can toggle showing your amount of health on the healthbar in the settings.",
"Sit near a campfire (with the 'K' key) to slowly recover from your injuries.",
"Need more bags or better armor to continue your journey? Press 'C' to open the crafting menu!",
],

View File

@ -19,50 +19,24 @@
// Respawn message
"hud.press_key_to_respawn": r#"Press {key} to respawn at the last campfire you visited."#,
// Welcome message
"hud.welcome": r#"Welcome to the Veloren Alpha!
// Tutorial Button
"hud.tutorial_btn": r#"Tutorial"#,
"hud.tutorial_click_here": r#"Press [ {key} ] to free your cursor and click this button!"#,
"hud.tutorial_elements": r#"Crafting"#,
"hud.temp_quest_headline": r#"Greetings Traveller!"#,
"hud.temp_quest_text": r#"To begin your journey you could start looking through this village and gather some supplies.
Some tips before you start:
You are welcome to take whatever you need on your journey!
Look at the bottom right of the screen to find various things like your bag, the crafting menu and the map.
Press F1 to see the available key commands.
The crafting menu allows you to create armor, weapons, food and much more!
Type /help into the chat to see chat commands
The wild animals all around town are a great source of Leather Scraps to create some protection against the dangers of the world.
There are chests and other objects randomly spawning in the World!
Right-Click to collect them.
To actually use whatever you loot from those chests open your inventory with 'B'.
Double click the items in your bag to use or equip them.
Throw them away by clicking them once and clicking outside of the bag
Nights can get pretty dark in Veloren.
Light your lantern by pressing 'G'
Want to free your cursor to close this window? Press TAB!
Enjoy your stay in the World of Veloren."#,
"hud.temp_quest_headline": r#"Please, help us Traveller!"#,
"hud.temp_quest_text": r#"Dungeons filled with evil cultists
have emerged all around our peaceful towns!
Gather some company, stack up on food
and defeat their vile leaders and acolytes.
Maybe you can even obtain one of their
magically infused items?"#,
Whenever you feel ready, try to get even better equipment from the many challenges marked on your map!
"#,
"hud.spell": "Spells",
// Diary

View File

@ -346,8 +346,6 @@ image_ids! {
not_found: "voxygen.element.not_found",
help: "voxygen.element.help",
death_bg: "voxygen.background.death",
hurt_bg: "voxygen.background.hurt",

View File

@ -204,17 +204,6 @@ widget_ids! {
overheads[],
overitems[],
// Intro Text
intro_bg,
intro_text,
intro_close,
intro_close_2,
intro_close_3,
intro_close_4,
intro_close_5,
intro_check,
intro_check_text,
// Alpha Disclaimer
alpha_text,
@ -284,13 +273,17 @@ widget_ids! {
auto_walk_txt,
auto_walk_bg,
// Example Quest
// Tutorial
quest_bg,
q_headline_bg,
q_headline,
q_text_bg,
q_text,
accept_button,
intro_button,
tut_arrow,
tut_arrow_txt_bg,
tut_arrow_txt,
}
}
@ -603,7 +596,8 @@ impl Show {
};
}
fn toggle_help(&mut self) { self.help = !self.help }
// TODO: Add self updating key-bindings element
//fn toggle_help(&mut self) { self.help = !self.help }
fn toggle_ui(&mut self) { self.ui = !self.ui; }
@ -791,7 +785,7 @@ impl Hud {
//intro_2: false,
show: Show {
help: false,
intro: true,
intro: false,
debug: false,
bag: false,
bag_inv: false,
@ -1617,10 +1611,69 @@ impl Hud {
}
// Temporary Example Quest
let arrow_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer
if let Some(toggle_cursor_key) = global_state
.settings
.controls
.get_binding(GameInput::ToggleCursor)
{
if !self.show.intro {
match global_state.settings.gameplay.intro_show {
Intro::Show => {
if Button::image(self.imgs.button)
.w_h(150.0, 40.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.bottom_left_with_margins_on(ui_widgets.window, 200.0, 120.0)
.label(&i18n.get("hud.tutorial_btn"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(18))
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(2.0))
.image_color(ENEMY_HP_COLOR)
.set(self.ids.intro_button, ui_widgets)
.was_clicked()
{
self.show.intro = true;
self.show.want_grab = true;
}
Image::new(self.imgs.sp_indicator_arrow)
.w_h(20.0, 11.0)
.mid_top_with_margin_on(self.ids.intro_button, -20.0 + arrow_ani as f64)
.color(Some(QUALITY_LEGENDARY))
.set(self.ids.tut_arrow, ui_widgets);
Text::new(
&i18n
.get("hud.tutorial_click_here")
.replace("{key}", toggle_cursor_key.to_string().as_str()),
)
.mid_top_with_margin_on(self.ids.tut_arrow, -18.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(BLACK)
.set(self.ids.tut_arrow_txt_bg, ui_widgets);
Text::new(
&i18n
.get("hud.tutorial_click_here")
.replace("{key}", toggle_cursor_key.to_string().as_str()),
)
.bottom_right_with_margins_on(self.ids.tut_arrow_txt_bg, 1.0, 1.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(QUALITY_LEGENDARY)
.set(self.ids.tut_arrow_txt, ui_widgets);
},
Intro::Never => {
self.show.intro = false;
},
}
}
}
// TODO: Add event/stat based tutorial system
if self.show.intro && !self.show.esc_menu {
match global_state.settings.gameplay.intro_show {
Intro::Show => {
if self.pulse > 20.0 {
if self.show.intro {
self.show.want_grab = false;
let quest_headline = &i18n.get("hud.temp_quest_headline");
let quest_text = &i18n.get("hud.temp_quest_text");
@ -1643,13 +1696,15 @@ impl Hud {
.set(self.ids.q_headline, ui_widgets);
Text::new(quest_text)
.down_from(self.ids.q_headline_bg, 40.0)
.mid_top_with_margin_on(self.ids.quest_bg, 360.0)
.w(350.0)
.font_size(self.fonts.cyri.scale(17))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_BG)
.set(self.ids.q_text_bg, ui_widgets);
Text::new(quest_text)
.bottom_left_with_margins_on(self.ids.q_text_bg, 1.0, 1.0)
.w(350.0)
.font_size(self.fonts.cyri.scale(17))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
@ -1659,8 +1714,8 @@ impl Hud {
.w_h(212.0, 52.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.mid_bottom_with_margin_on(self.ids.q_text_bg, -120.0)
.label(&i18n.get("common.accept"))
.mid_bottom_with_margin_on(self.ids.q_text_bg, -80.0)
.label(&i18n.get("common.close"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(22))
.label_color(TEXT_COLOR)
@ -1668,10 +1723,35 @@ impl Hud {
.set(self.ids.accept_button, ui_widgets)
.was_clicked()
{
self.show.intro = !self.show.intro;
self.show.intro = false;
events.push(Event::Intro(Intro::Never));
self.show.want_grab = true;
}
if !self.show.crafting && !self.show.bag {
Image::new(self.imgs.sp_indicator_arrow)
.w_h(20.0, 11.0)
.bottom_right_with_margins_on(
ui_widgets.window,
40.0 + arrow_ani as f64,
205.0,
)
.color(Some(QUALITY_LEGENDARY))
.set(self.ids.tut_arrow, ui_widgets);
Text::new(&i18n.get("hud.tutorial_elements"))
.mid_top_with_margin_on(self.ids.tut_arrow, -50.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(40))
.color(BLACK)
.floating(true)
.set(self.ids.tut_arrow_txt_bg, ui_widgets);
Text::new(&i18n.get("hud.tutorial_elements"))
.bottom_right_with_margins_on(self.ids.tut_arrow_txt_bg, 1.0, 1.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(40))
.color(QUALITY_LEGENDARY)
.floating(true)
.set(self.ids.tut_arrow_txt, ui_widgets);
}
}
},
Intro::Never => {
@ -1918,7 +1998,8 @@ impl Hud {
}
// Help Text
if self.show.help && !self.show.map && !self.show.esc_menu {
// TODO Add dynamic controls display
/*if self.show.help && !self.show.map && !self.show.esc_menu {
Image::new(self.imgs.help)
.middle_of(ui_widgets.window)
.w_h(1260.0, 519.0)
@ -1935,7 +2016,7 @@ impl Hud {
{
self.show.help = false;
};
}
}*/
// Bag button and nearby icons
let ecs = client.state().ecs();
@ -2884,7 +2965,8 @@ impl Hud {
true
},
GameInput::Help if state => {
self.show.toggle_help();
self.show.toggle_settings(global_state);
self.show.settings_tab = SettingsTab::Controls;
true
},
GameInput::ToggleDebug if state => {

View File

@ -120,7 +120,7 @@ impl ControlSettings {
match game_input {
GameInput::Primary => KeyMouse::Mouse(MouseButton::Left),
GameInput::Secondary => KeyMouse::Mouse(MouseButton::Right),
GameInput::ToggleCursor => KeyMouse::Key(VirtualKeyCode::Caret),
GameInput::ToggleCursor => KeyMouse::Key(VirtualKeyCode::Comma),
GameInput::Escape => KeyMouse::Key(VirtualKeyCode::Escape),
GameInput::Chat => KeyMouse::Key(VirtualKeyCode::Return),
GameInput::Command => KeyMouse::Key(VirtualKeyCode::Slash),