Made char select handle client events

This commit is contained in:
Joshua Barretto
2020-07-06 17:11:19 +01:00
parent bdab3972c2
commit ddaa0a9246
2 changed files with 38 additions and 17 deletions

View File

@ -156,8 +156,8 @@ https://account.veloren.net."#,
"hud.press_key_to_toggle_debug_info_fmt": "Press {key} to toggle debug info", "hud.press_key_to_toggle_debug_info_fmt": "Press {key} to toggle debug info",
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] is now online.", "hud.chat.online_msg": "[{name}] is now online.",
"hud.chat.offline_msg": "{name} went offline.", "hud.chat.offline_msg": "{name} went offline.",
"hud.chat.loot_msg": "You picked up [{item}]", "hud.chat.loot_msg": "You picked up [{item}]",
"hud.chat.loot_fail": "Your Inventory is full!", "hud.chat.loot_fail": "Your Inventory is full!",
"hud.chat.goodbye": "Goodbye!", "hud.chat.goodbye": "Goodbye!",
@ -204,15 +204,15 @@ Want to free your cursor to close this window? Press TAB!
Enjoy your stay in the World of Veloren."#, Enjoy your stay in the World of Veloren."#,
"hud.temp_quest_headline": r#"Please, help us Traveller!"#, "hud.temp_quest_headline": r#"Please, help us Traveller!"#,
"hud.temp_quest_text": r#"Dungeons filled with evil cultists "hud.temp_quest_text": r#"Dungeons filled with evil cultists
have emerged all around our peaceful towns! have emerged all around our peaceful towns!
Gather some company, stack up on food Gather some company, stack up on food
and defeat their vile leaders and acolytes. and defeat their vile leaders and acolytes.
Maybe you can even obtain one of their Maybe you can even obtain one of their
magically infused items?"#, magically infused items?"#,
@ -236,7 +236,7 @@ magically infused items?"#,
"hud.bag.legs": "Legs", "hud.bag.legs": "Legs",
"hud.bag.feet": "Feet", "hud.bag.feet": "Feet",
"hud.bag.mainhand": "Mainhand", "hud.bag.mainhand": "Mainhand",
"hud.bag.offhand": "Offhand", "hud.bag.offhand": "Offhand",
// Map and Questlog // Map and Questlog
@ -256,7 +256,7 @@ magically infused items?"#,
"hud.settings.custom_scaling": "Custom Scaling", "hud.settings.custom_scaling": "Custom Scaling",
"hud.settings.crosshair": "Crosshair", "hud.settings.crosshair": "Crosshair",
"hud.settings.transparency": "Transparency", "hud.settings.transparency": "Transparency",
"hud.settings.hotbar": "Hotbar", "hud.settings.hotbar": "Hotbar",
"hud.settings.toggle_shortcuts": "Toggle Shortcuts", "hud.settings.toggle_shortcuts": "Toggle Shortcuts",
"hud.settings.toggle_bar_experience": "Toggle Experience Bar", "hud.settings.toggle_bar_experience": "Toggle Experience Bar",
"hud.settings.scrolling_combat_text": "Scrolling Combat Text", "hud.settings.scrolling_combat_text": "Scrolling Combat Text",
@ -313,7 +313,7 @@ magically infused items?"#,
"hud.spell": "Spells", "hud.spell": "Spells",
"hud.free_look_indicator": "Free look active", "hud.free_look_indicator": "Free look active",
"hud.auto_walk_indicator": "Auto walk active", "hud.auto_walk_indicator": "Auto walk active",
/// End HUD section /// End HUD section
@ -323,7 +323,7 @@ magically infused items?"#,
"gameinput.primary": "Basic Attack", "gameinput.primary": "Basic Attack",
"gameinput.secondary": "Secondary Attack/Block/Aim", "gameinput.secondary": "Secondary Attack/Block/Aim",
"gameinput.slot1": "Hotbar Slot 1", "gameinput.slot1": "Hotbar Slot 1",
"gameinput.slot2": "Hotbar Slot 2", "gameinput.slot2": "Hotbar Slot 2",
"gameinput.slot3": "Hotbar Slot 3", "gameinput.slot3": "Hotbar Slot 3",
"gameinput.slot4": "Hotbar Slot 4", "gameinput.slot4": "Hotbar Slot 4",
@ -369,7 +369,7 @@ magically infused items?"#,
"gameinput.freelook": "Free Look", "gameinput.freelook": "Free Look",
"gameinput.autowalk": "Auto Walk", "gameinput.autowalk": "Auto Walk",
"gameinput.dance": "Dance", "gameinput.dance": "Dance",
/// End GameInput section /// End GameInput section
@ -390,7 +390,7 @@ magically infused items?"#,
"char_selection.plains_of_uncertainty": "Plains of Uncertainty", "char_selection.plains_of_uncertainty": "Plains of Uncertainty",
"char_selection.beard": "Beard", "char_selection.beard": "Beard",
"char_selection.hair_style": "Hair Style", "char_selection.hair_style": "Hair Style",
"char_selection.hair_color": "Hair Color", "char_selection.hair_color": "Hair Color",
"char_selection.eye_color": "Eye Color", "char_selection.eye_color": "Eye Color",
"char_selection.skin": "Skin", "char_selection.skin": "Skin",
"char_selection.eyeshape": "Eye Details", "char_selection.eyeshape": "Eye Details",

View File

@ -154,16 +154,37 @@ impl PlayState for CharSelectionState {
let localized_strings = assets::load_expect::<VoxygenLocalization>(&i18n_asset_key( let localized_strings = assets::load_expect::<VoxygenLocalization>(&i18n_asset_key(
&global_state.settings.language.selected_language, &global_state.settings.language.selected_language,
)); ));
if let Err(e) = self.client.borrow_mut().tick(
match self.client.borrow_mut().tick(
comp::ControllerInputs::default(), comp::ControllerInputs::default(),
clock.get_last_delta(), clock.get_last_delta(),
|_| {}, |_| {},
) { ) {
global_state.info_message = Ok(events) => {
Some(localized_strings.get("common.connection_lost").to_owned()); for event in events {
error!(?e, "[char_selection] Failed to tick the scene"); match event {
client::Event::SetViewDistance(vd) => {
return PlayStateResult::Pop; global_state.settings.graphics.view_distance = vd;
global_state.settings.save_to_file_warn();
},
client::Event::Disconnect => {
global_state.info_message = Some(
localized_strings
.get("main.login.server_shut_down")
.to_owned(),
);
return PlayStateResult::Pop;
},
_ => {},
}
}
},
Err(err) => {
global_state.info_message =
Some(localized_strings.get("common.connection_lost").to_owned());
error!(?err, "[char_selection] Failed to tick the client");
return PlayStateResult::Pop;
},
} }
self.client.borrow_mut().cleanup(); self.client.borrow_mut().cleanup();