mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Made char select handle client events
This commit is contained in:
parent
bdab3972c2
commit
ddaa0a9246
@ -154,16 +154,37 @@ impl PlayState for CharSelectionState {
|
||||
let localized_strings = assets::load_expect::<VoxygenLocalization>(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
if let Err(e) = self.client.borrow_mut().tick(
|
||||
|
||||
match self.client.borrow_mut().tick(
|
||||
comp::ControllerInputs::default(),
|
||||
clock.get_last_delta(),
|
||||
|_| {},
|
||||
) {
|
||||
global_state.info_message =
|
||||
Some(localized_strings.get("common.connection_lost").to_owned());
|
||||
error!(?e, "[char_selection] Failed to tick the scene");
|
||||
|
||||
return PlayStateResult::Pop;
|
||||
Ok(events) => {
|
||||
for event in events {
|
||||
match event {
|
||||
client::Event::SetViewDistance(vd) => {
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user