Persist map selection
This commit is contained in:
parent
1d56e103a2
commit
e04ded2e20
@ -86,20 +86,23 @@ impl IPanel for LobbyPanel {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(map_selection) = &mut self.map_selection {
|
|
||||||
for map in game.bind().maps.iter_shared() {
|
|
||||||
map_selection.add_item(&map.bind().name);
|
|
||||||
}
|
|
||||||
map_selection.select(0);
|
|
||||||
}
|
|
||||||
let is_host = if let Some(peer) = &NetworkManager::singleton().bind().peer {
|
let is_host = if let Some(peer) = &NetworkManager::singleton().bind().peer {
|
||||||
peer.is_host()
|
peer.is_host()
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
if let Some(map_selection) = &mut self.map_selection {
|
||||||
|
let prev_selection = game.bind().selected_map_idx as i32;
|
||||||
|
for map in game.bind().maps.iter_shared() {
|
||||||
|
map_selection.add_item(&map.bind().name);
|
||||||
|
}
|
||||||
|
map_selection.select(prev_selection);
|
||||||
|
if is_host {
|
||||||
|
self.update_map_selection(prev_selection as u8);
|
||||||
|
}
|
||||||
|
}
|
||||||
self.on_game_opts_update(&game.bind().opts, is_host);
|
self.on_game_opts_update(&game.bind().opts, is_host);
|
||||||
}
|
}
|
||||||
self.update_map_selection(0);
|
|
||||||
|
|
||||||
if let Some(name_field) = &self.name_field {
|
if let Some(name_field) = &self.name_field {
|
||||||
name_field
|
name_field
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user