From 5409a8d8c9754cee5562f63c70d252c9a62095b4 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Tue, 21 Mar 2023 11:54:21 +0200 Subject: [PATCH] feat(client): handle create game datarequestresponse --- .../src/plugins/networking/systems/events/receive/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/plugins/networking/systems/events/receive/mod.rs b/client/src/plugins/networking/systems/events/receive/mod.rs index 986313a..14efbd9 100644 --- a/client/src/plugins/networking/systems/events/receive/mod.rs +++ b/client/src/plugins/networking/systems/events/receive/mod.rs @@ -21,7 +21,7 @@ use crate::{ plugins::menu::{ ui::{ connect::{ConnectScreenData, ConnectState}, - play::PlayScreenData, + play::{PlayScreenData, PlayScreenState}, }, MenuState, }, @@ -84,7 +84,10 @@ pub fn message_events( for response in events.read::() { match DataRequestType::from_u8(&response.r#type) { DataRequestType::GameCreate => { - // TODO: set cur_game, send player to lobby screen + // TODO: handle possible error (unwrap, + // and if the response data is an error) + play_data.cur_game = serde_json::from_str(&response.data).unwrap(); + play_data.state = PlayScreenState::InLobbyHost; } DataRequestType::GameAllForming => { // TODO: handle possible error -- 2.44.1