From 3c18d2409c57dfbef3fd443832a43fbb49c92fce Mon Sep 17 00:00:00 2001 From: CoCo_Sol007 Date: Sun, 17 Mar 2024 19:19:23 +0100 Subject: [PATCH] update --- crates/border-wars/src/connection.rs | 4 ++++ crates/border-wars/src/scenes/menu.rs | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/border-wars/src/connection.rs b/crates/border-wars/src/connection.rs index f6b9239..4cf9a99 100644 --- a/crates/border-wars/src/connection.rs +++ b/crates/border-wars/src/connection.rs @@ -32,12 +32,16 @@ pub struct RequestConnection { /// The message sent in order to update the list of players. #[derive(Deserialize, Serialize, Event)] pub struct AddPlayer { + /// The uuid of the new player. pub uuid: Uuid, + + /// The name of the new player. pub name: String, } /// The packet sent when a player is removed. #[derive(Event, Deserialize, Serialize)] pub struct RemovePlayer { + /// The uuid of the player. pub uuid: Uuid, } diff --git a/crates/border-wars/src/scenes/menu.rs b/crates/border-wars/src/scenes/menu.rs index 0dd631b..43e997b 100644 --- a/crates/border-wars/src/scenes/menu.rs +++ b/crates/border-wars/src/scenes/menu.rs @@ -31,10 +31,6 @@ fn menu_ui( return; }; - let Ok(target_uuid) = Uuid::parse_str(&connection_string) else { - return; - }; - egui::CentralPanel::default().show(ctx.ctx_mut(), |ui| { ui.heading("Border Wars"); @@ -45,6 +41,9 @@ fn menu_ui( ui.label("Game ID: "); ui.text_edit_singleline(&mut *connection_string); + let Ok(target_uuid) = Uuid::parse_str(&connection_string) else { + return; + }; if ui.button("Join").clicked() { next_scene.set(CurrentScene::Lobby); request_join_event.send(SendTo(