pub struct LobbyState {Show 15 fields
id: LobbyId,
server: Arc<SyncedServerState>,
pub configs: ConfigSet,
game_started: bool,
pub(crate) round: u64,
pub(crate) phase: LobbyPhase,
pub(crate) paused: Sender<bool>,
pub(crate) pause_requested: bool,
pub clients: Clients,
pub matchups: Vec<(PlayerId, PlayerId, bool)>,
pub(crate) hist_lightsaber_options: Vec<LightsaberOptions>,
pub(crate) hist_unit_options: Vec<[UnitType; 3]>,
pub(crate) prev_matchups: Matchups,
pub on_game_start: TxRx<bool>,
pub(super) game_start_timer_id: u32,
}Expand description
The state of a lobby. The game may not have started yet, or it could be in-progress already.
Fields§
§id: LobbyId§server: Arc<SyncedServerState>§configs: ConfigSet§game_started: bool§round: u64§phase: LobbyPhase§paused: Sender<bool>§pause_requested: bool§clients: Clients§matchups: Vec<(PlayerId, PlayerId, bool)>Matchups. 3rd field is true if 2nd field is a ghost.
hist_lightsaber_options: Vec<LightsaberOptions>Contains a history of all previous lightsaber options
hist_unit_options: Vec<[UnitType; 3]>Contains a history of all previous unit options
prev_matchups: MatchupsIs initialized when the game is started
on_game_start: TxRx<bool>§game_start_timer_id: u32Implementations§
Source§impl LobbyState
impl LobbyState
pub async fn consider_starting_game(&mut self)
pub fn could_start_timer_for_game_start(&self) -> bool
pub async fn start_game_now(&mut self)
Source§impl LobbyState
impl LobbyState
Sourcepub async fn message_from(
&mut self,
player_id: &PlayerId,
msg: RxMessage,
original_message: String,
)
pub async fn message_from( &mut self, player_id: &PlayerId, msg: RxMessage, original_message: String, )
handles non-chat messages sent by playing clients
Source§impl LobbyState
impl LobbyState
Source§impl LobbyState
impl LobbyState
pub async fn player_join<F, Fut>( &mut self, player: Player, player_identification: F, ) -> Result<(PlayerId, ReconnectToken), PlayerJoinError>
pub async fn client_leave( &mut self, name: &str, player_id: Option<PlayerId>, ) -> bool
pub fn spectator_join( &mut self, spectator: Spectator, ) -> Result<(), SpectatorJoinError>
Source§impl LobbyState
impl LobbyState
pub fn min_players(&self) -> usize
pub fn max_players(&self) -> usize
pub fn game_started(&self) -> bool
pub(super) fn set_game_started(&mut self)
Source§impl LobbyState
impl LobbyState
pub async fn broadcast_chat_message(&mut self, name: &str, message: &str)
Source§impl LobbyState
impl LobbyState
pub fn character_taken(&self, character: PlayerCharacter) -> bool
pub fn available_characters(&self) -> Vec<PlayerCharacter>
pub async fn broadcast_lobby_info(&mut self)
pub async fn broadcast_gamestate(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LobbyState
impl !RefUnwindSafe for LobbyState
impl Send for LobbyState
impl Sync for LobbyState
impl Unpin for LobbyState
impl !UnwindSafe for LobbyState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more