Tick client when in server info menu

This commit is contained in:
Joshua Barretto 2024-01-14 19:22:18 +00:00 committed by Maxicarlos08
parent f991a5677f
commit e4dbe50f39
No known key found for this signature in database

View File

@ -12,7 +12,10 @@ use crate::{
Direction, GlobalState, PlayState, PlayStateResult,
};
use client::ServerInfo;
use common::assets::{self, AssetExt};
use common::{
assets::{self, AssetExt},
comp,
};
use common_base::span;
use i18n::LocalizationHandle;
use iced::{
@ -23,6 +26,7 @@ use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use tracing::error;
image_ids_ice! {
struct Imgs {
@ -164,6 +168,20 @@ impl PlayState for ServerInfoState {
}
}
if let Some(char_select) = &mut self.char_select {
if let Err(err) = char_select
.client()
.borrow_mut()
.tick(comp::ControllerInputs::default(), global_state.clock.dt())
{
let i18n = &global_state.i18n.read();
global_state.info_message =
Some(i18n.get_msg("common-connection_lost").into_owned());
error!(?err, "[server_info] Failed to tick the client");
return PlayStateResult::Pop;
}
}
// Maintain the UI.
let view = self.controls.view();
let (messages, _) = self.ui.maintain(