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:
@ -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();
|
||||||
|
Reference in New Issue
Block a user