From d3e082084a8a240d1e3baaacd5706766e1fdd219 Mon Sep 17 00:00:00 2001 From: Sofia Date: Wed, 22 Jul 2026 04:17:15 +0300 Subject: [PATCH] Update options for client as well --- rust/src/ui/lobby.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index e4792ec..8afc23a 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use godot::{ classes::{ Button, CheckBox, Control, GridContainer, IPanel, Label, OptionButton, Panel, TextEdit, @@ -30,6 +32,8 @@ pub struct LobbyPanel { #[export] options_grid: Option>, + option_nodes: HashMap>, + is_ready: bool, base: Base, @@ -154,6 +158,8 @@ impl IPanel for LobbyPanel { ); }); + self.option_nodes.insert(option, checkbox.clone().upcast()); + checkbox.upcast::() } }; @@ -195,6 +201,17 @@ impl LobbyPanel { if let Some(selection) = &mut self.map_selection { selection.set_disabled(!is_host && !opts.is_true(GameOption::AllowAnyMap)); } + for (key, value) in &opts.values { + if let Some(control) = self.option_nodes.get(key).cloned() { + match value { + GameOptionValue::Boolean(value) => { + if let Ok(mut checkbox) = control.try_cast::() { + checkbox.set_pressed(*value); + } + } + } + } + } } fn update_ready_button(&mut self) {