mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Enter the world by pressing "enter" at character selection
This commit is contained in:
parent
522e3493c5
commit
701f38ab69
@ -68,6 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added dungeon entrances
|
||||
- Villagers tools and clothing
|
||||
- Cultists clothing
|
||||
- You can start the game by pressing "enter" from the character selection menu
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -19,6 +19,8 @@ use common::{
|
||||
use conrod_core::{
|
||||
color,
|
||||
color::TRANSPARENT,
|
||||
event::{Event as WorldEvent, Input},
|
||||
input::{Button as ButtonType, Key},
|
||||
position::Relative,
|
||||
widget::{text_box::Event as TextBoxEvent, Button, Image, Rectangle, Scrollbar, Text, TextBox},
|
||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
||||
@ -405,6 +407,26 @@ impl CharSelectionUi {
|
||||
// TODO: Split this into multiple modules or functions.
|
||||
fn update_layout(&mut self, global_state: &mut GlobalState, client: &Client) -> Vec<Event> {
|
||||
let mut events = Vec::new();
|
||||
|
||||
let can_enter_world = match &self.mode {
|
||||
Mode::Select(opt) => opt.is_some(),
|
||||
Mode::Create { .. } => false,
|
||||
};
|
||||
|
||||
// Handle enter keypress to enter world
|
||||
if can_enter_world {
|
||||
for event in self.ui.ui.global_input().events() {
|
||||
match event {
|
||||
// TODO allow this to be rebound
|
||||
WorldEvent::Raw(Input::Press(ButtonType::Keyboard(Key::Return)))
|
||||
| WorldEvent::Raw(Input::Press(ButtonType::Keyboard(Key::Return2)))
|
||||
| WorldEvent::Raw(Input::Press(ButtonType::Keyboard(Key::NumPadEnter))) => {
|
||||
events.push(Event::Play)
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
|
||||
let version = format!(
|
||||
"{}-{}",
|
||||
@ -567,10 +589,7 @@ impl CharSelectionUi {
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0));
|
||||
|
||||
if match &self.mode {
|
||||
Mode::Select(opt) => opt.is_some(),
|
||||
Mode::Create { .. } => true,
|
||||
} {
|
||||
if can_enter_world {
|
||||
if enter_button
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
|
Loading…
Reference in New Issue
Block a user