update
All checks were successful
Rust Checks / checks (push) Successful in 3m12s

This commit is contained in:
CoCo_Sol 2024-03-18 08:26:53 +01:00
parent 84cdf51420
commit b0bd34dd7e

View file

@ -21,7 +21,11 @@ impl Plugin for AdminLobbyPlugin {
}
}
/// Display the UI of the lobby.
fn lobby_ui(mut ctx: EguiContexts, connection: Res<Connection>) {
fn lobby_ui(
mut ctx: EguiContexts,
connection: Res<Connection>,
mut next_scene: ResMut<NextState<CurrentScene>>,
) {
let Some(connection) = connection.identifier() else {
egui::CentralPanel::default().show(ctx.ctx_mut(), |ui| {
ui.label("Connecting...");
@ -36,6 +40,11 @@ fn lobby_ui(mut ctx: EguiContexts, connection: Res<Connection>) {
ui.label("Game ID: ");
ui.text_edit_singleline(&mut connection.to_string());
ui.separator();
if ui.button("Run the game").clicked() {
next_scene.set(CurrentScene::Game);
}
});
}
@ -45,7 +54,6 @@ fn admin_panel(
connection: Res<Connection>,
all_players: Res<AllPlayers>,
mut event: EventWriter<SendTo<RemovePlayer>>,
mut next_scene: ResMut<NextState<CurrentScene>>,
) {
egui::Window::new("Admin").show(ctx.ctx_mut(), |ui| {
for player in all_players.0.iter() {
@ -61,11 +69,6 @@ fn admin_panel(
}
}
}
ui.separator();
if ui.button("Run the game").clicked() {
next_scene.set(CurrentScene::Game);
}
});
}