Fix goal game option propagating to client
This commit is contained in:
parent
b53b6289bd
commit
0527567350
@ -132,6 +132,7 @@ impl GameManager {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct GameOptions {
|
||||
pub values: HashMap<GameOption, GameOptionValue>,
|
||||
}
|
||||
|
||||
@ -174,6 +174,8 @@ impl IPanel for LobbyPanel {
|
||||
},
|
||||
);
|
||||
|
||||
self.option_nodes.insert(option, spinbox.clone().upcast());
|
||||
|
||||
spinbox.upcast()
|
||||
}
|
||||
};
|
||||
@ -221,22 +223,27 @@ 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() {
|
||||
|
||||
let values = opts.values.clone();
|
||||
let nodes = self.option_nodes.clone();
|
||||
self.run_deferred_gd(move |_| {
|
||||
for (key, value) in values {
|
||||
if let Some(control) = nodes.get(&key).cloned() {
|
||||
match value {
|
||||
GameOptionValue::Boolean(value) => {
|
||||
if let Ok(mut checkbox) = control.try_cast::<CheckBox>() {
|
||||
checkbox.set_pressed(*value);
|
||||
checkbox.set_pressed(value);
|
||||
}
|
||||
}
|
||||
GameOptionValue::Number(value) => {
|
||||
if let Ok(mut spinbox) = control.try_cast::<SpinBox>() {
|
||||
spinbox.set_value(*value);
|
||||
spinbox.set_value(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn update_ready_button(&mut self) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user