Allow maps to be hidden
This commit is contained in:
parent
be5960dba8
commit
cf68bd7887
@ -14,3 +14,4 @@ scene = ExtResource("1_k5804")
|
||||
teams = Array[TeamResource]([ExtResource("2_kkbjr"), ExtResource("3_o48fm")])
|
||||
music = Array[AudioStream]([ExtResource("1_bjd18"), ExtResource("2_an43b"), ExtResource("3_e1bs0")])
|
||||
icon = ExtResource("1_an43b")
|
||||
hidden = true
|
||||
|
||||
@ -8,3 +8,4 @@
|
||||
name = "Diner"
|
||||
scene = ExtResource("1_yteo6")
|
||||
teams = Array[TeamResource]([ExtResource("2_47vax"), ExtResource("3_i3gdq")])
|
||||
hidden = true
|
||||
|
||||
@ -18,6 +18,8 @@ pub struct MapResource {
|
||||
pub music: Array<Gd<AudioStream>>,
|
||||
#[export]
|
||||
pub icon: Option<Gd<CompressedTexture2D>>,
|
||||
#[export]
|
||||
pub hidden: bool,
|
||||
|
||||
base: Base<Resource>,
|
||||
}
|
||||
|
||||
@ -97,11 +97,20 @@ impl IPanel for LobbyPanel {
|
||||
};
|
||||
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() {
|
||||
for (id, map) in game.bind().maps.iter_shared().enumerate() {
|
||||
if map.bind().hidden {
|
||||
continue;
|
||||
}
|
||||
if let Some(icon) = &map.bind().icon {
|
||||
map_selection.add_icon_item(icon, &map.bind().name);
|
||||
map_selection
|
||||
.add_icon_item_ex(icon, &map.bind().name)
|
||||
.id(id as i32)
|
||||
.done();
|
||||
} else {
|
||||
map_selection.add_item(&map.bind().name);
|
||||
map_selection
|
||||
.add_item_ex(&map.bind().name)
|
||||
.id(id as i32)
|
||||
.done();
|
||||
}
|
||||
}
|
||||
map_selection.select(prev_selection);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user