From 5c71afb43ada7200717e19368e579f0c18084247 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Mon, 28 Nov 2022 21:08:12 -0600 Subject: [PATCH] Distinguish Default and Experimental Levels --- assets/default.game.yaml | 30 +- assets/locales/en-US/map-select.ftl | 5 +- assets/map/levels/level4.map.yaml | 1299 +++++++++++++++++++++++++++ src/assets.rs | 17 +- src/metadata.rs | 7 +- src/ui/editor.rs | 26 +- src/ui/main_menu/map_select.rs | 74 +- 7 files changed, 1395 insertions(+), 63 deletions(-) create mode 100644 assets/map/levels/level4.map.yaml diff --git a/assets/default.game.yaml b/assets/default.game.yaml index 9c669ac0dd..eda8a3fd1b 100644 --- a/assets/default.game.yaml +++ b/assets/default.game.yaml @@ -13,23 +13,25 @@ players: - player/skins/sharky/sharky.player.yaml - player/skins/pescy/pescy.player.yaml -maps: +stable_maps: - map/levels/level1.map.yaml - map/levels/level2.map.yaml - map/levels/level3.map.yaml - # - map/levels/lev01.map.json - # - map/levels/lev02.map.json - # - map/levels/lev03.map.json - # - map/levels/lev04.map.json - # - map/levels/lev05.map.json - # - map/levels/lev06.map.json - # - map/levels/lev07.map.json - # - map/levels/zyrafa01.map.json - # - map/levels/zyrafa02.map.json - # - map/levels/zyrafa03.map.json - # - map/levels/zyrafa04.map.json - # - map/levels/zyrafa05.map.json - # - map/levels/zyrafa06.map.json + - map/levels/level4.map.yaml +experimental_maps: + # - map/levels/lev01.map.json # Renamed to Level 1 + - map/levels/lev02.map.json + - map/levels/lev03.map.json + # - map/levels/lev04.map.json # Renamed to Level 4 + - map/levels/lev05.map.json + - map/levels/lev06.map.json + # - map/levels/lev07.map.json # Renamed to Level 3 + - map/levels/zyrafa01.map.json + - map/levels/zyrafa02.map.json + - map/levels/zyrafa03.map.json + - map/levels/zyrafa04.map.json + - map/levels/zyrafa05.map.json + # - map/levels/zyrafa06.map.json # Renamed to Level 2 scripts: - map/scripts/kill_out_of_bounds.ts diff --git a/assets/locales/en-US/map-select.ftl b/assets/locales/en-US/map-select.ftl index 01f32de818..3ed687f1c0 100644 --- a/assets/locales/en-US/map-select.ftl +++ b/assets/locales/en-US/map-select.ftl @@ -1,2 +1,5 @@ map-select-title = Map Select -waiting-for-map = Waiting for other player to select map... \ No newline at end of file +waiting-for-map = Waiting for other player to select map... + +default-maps = Default Maps +experimental-maps = Experimental Maps \ No newline at end of file diff --git a/assets/map/levels/level4.map.yaml b/assets/map/levels/level4.map.yaml new file mode 100644 index 0000000000..87e951e2ff --- /dev/null +++ b/assets/map/levels/level4.map.yaml @@ -0,0 +1,1299 @@ +name: Level 4 +background_layers: + - speed: 0.0 + image: ../resources/background_04.png + tile_size: + - 896.0 + - 480.0 + cols: 1 + rows: 1 + scale: 2.0 + z: -110.0 + transition_factor: 1.0 + position: + - 0.0 + - 360.0 + - speed: 0.74 + image: ../resources/background_03.png + tile_size: + - 896.0 + - 480.0 + cols: 1 + rows: 1 + scale: 2.0 + z: -109.0 + transition_factor: 1.0 + position: + - 0.0 + - 360.0 + - speed: 0.82 + image: ../resources/background_02.png + tile_size: + - 896.0 + - 480.0 + cols: 1 + rows: 1 + scale: 2.0 + z: -108.0 + transition_factor: 1.0 + position: + - 0.0 + - 360.0 + - speed: 100.0 + image: ../resources/background_01.png + tile_size: + - 896.0 + - 480.0 + cols: 1 + rows: 1 + scale: 2.0 + z: -107.0 + transition_factor: 1.0 + position: + - 0.0 + - 360.0 +background_color: 7EA8A6FF +grid_size: + - 35 + - 15 +tile_size: + - 32 + - 32 +layers: + - id: main layer + kind: !tile + tilemap: ../resources/default_tileset.png + has_collision: true + tiles: + - pos: + - 0 + - 14 + idx: 8 + jump_through: false + - pos: + - 1 + - 14 + idx: 9 + jump_through: false + - pos: + - 33 + - 14 + idx: 7 + jump_through: false + - pos: + - 34 + - 14 + idx: 8 + jump_through: false + - pos: + - 0 + - 13 + idx: 8 + jump_through: false + - pos: + - 1 + - 13 + idx: 9 + jump_through: false + - pos: + - 33 + - 13 + idx: 7 + jump_through: false + - pos: + - 34 + - 13 + idx: 8 + jump_through: false + - pos: + - 0 + - 12 + idx: 8 + jump_through: false + - pos: + - 1 + - 12 + idx: 9 + jump_through: false + - pos: + - 9 + - 12 + idx: 32 + jump_through: false + - pos: + - 10 + - 12 + idx: 22 + jump_through: false + - pos: + - 11 + - 12 + idx: 22 + jump_through: false + - pos: + - 12 + - 12 + idx: 23 + jump_through: false + - pos: + - 13 + - 12 + idx: 56 + jump_through: true + - pos: + - 14 + - 12 + idx: 58 + jump_through: true + - pos: + - 15 + - 12 + idx: 58 + jump_through: true + - pos: + - 16 + - 12 + idx: 58 + jump_through: true + - pos: + - 17 + - 12 + idx: 58 + jump_through: true + - pos: + - 18 + - 12 + idx: 58 + jump_through: true + - pos: + - 19 + - 12 + idx: 58 + jump_through: true + - pos: + - 20 + - 12 + idx: 58 + jump_through: true + - pos: + - 21 + - 12 + idx: 60 + jump_through: true + - pos: + - 22 + - 12 + idx: 21 + jump_through: false + - pos: + - 23 + - 12 + idx: 22 + jump_through: false + - pos: + - 24 + - 12 + idx: 22 + jump_through: false + - pos: + - 25 + - 12 + idx: 34 + jump_through: false + - pos: + - 33 + - 12 + idx: 7 + jump_through: false + - pos: + - 34 + - 12 + idx: 8 + jump_through: false + - pos: + - 0 + - 11 + idx: 8 + jump_through: false + - pos: + - 1 + - 11 + idx: 9 + jump_through: false + - pos: + - 9 + - 11 + idx: 17 + jump_through: false + - pos: + - 25 + - 11 + idx: 17 + jump_through: false + - pos: + - 33 + - 11 + idx: 7 + jump_through: false + - pos: + - 34 + - 11 + idx: 8 + jump_through: false + - pos: + - 0 + - 10 + idx: 8 + jump_through: false + - pos: + - 1 + - 10 + idx: 20 + jump_through: false + - pos: + - 33 + - 10 + idx: 13 + jump_through: false + - pos: + - 34 + - 10 + idx: 8 + jump_through: false + - pos: + - 0 + - 9 + idx: 8 + jump_through: false + - pos: + - 1 + - 9 + idx: 9 + jump_through: false + - pos: + - 2 + - 9 + idx: 58 + jump_through: true + - pos: + - 3 + - 9 + idx: 58 + jump_through: true + - pos: + - 4 + - 9 + idx: 60 + jump_through: true + - pos: + - 30 + - 9 + idx: 56 + jump_through: true + - pos: + - 31 + - 9 + idx: 58 + jump_through: true + - pos: + - 32 + - 9 + idx: 58 + jump_through: true + - pos: + - 33 + - 9 + idx: 7 + jump_through: false + - pos: + - 34 + - 9 + idx: 8 + jump_through: false + - pos: + - 0 + - 8 + idx: 8 + jump_through: false + - pos: + - 1 + - 8 + idx: 9 + jump_through: false + - pos: + - 33 + - 8 + idx: 7 + jump_through: false + - pos: + - 34 + - 8 + idx: 8 + jump_through: false + - pos: + - 0 + - 7 + idx: 8 + jump_through: false + - pos: + - 1 + - 7 + idx: 9 + jump_through: false + - pos: + - 14 + - 7 + idx: 0 + jump_through: false + - pos: + - 15 + - 7 + idx: 45 + jump_through: false + - pos: + - 16 + - 7 + idx: 58 + jump_through: true + - pos: + - 17 + - 7 + idx: 58 + jump_through: true + - pos: + - 18 + - 7 + idx: 58 + jump_through: true + - pos: + - 19 + - 7 + idx: 44 + jump_through: false + - pos: + - 20 + - 7 + idx: 2 + jump_through: false + - pos: + - 33 + - 7 + idx: 7 + jump_through: false + - pos: + - 34 + - 7 + idx: 8 + jump_through: false + - pos: + - 0 + - 6 + idx: 8 + jump_through: false + - pos: + - 1 + - 6 + idx: 20 + jump_through: false + - pos: + - 2 + - 6 + idx: 22 + jump_through: false + - pos: + - 3 + - 6 + idx: 22 + jump_through: false + - pos: + - 4 + - 6 + idx: 22 + jump_through: false + - pos: + - 5 + - 6 + idx: 22 + jump_through: false + - pos: + - 6 + - 6 + idx: 23 + jump_through: false + - pos: + - 13 + - 6 + idx: 0 + jump_through: false + - pos: + - 14 + - 6 + idx: 45 + jump_through: false + - pos: + - 15 + - 6 + idx: 16 + jump_through: false + - pos: + - 19 + - 6 + idx: 14 + jump_through: false + - pos: + - 20 + - 6 + idx: 44 + jump_through: false + - pos: + - 21 + - 6 + idx: 2 + jump_through: false + - pos: + - 28 + - 6 + idx: 21 + jump_through: false + - pos: + - 29 + - 6 + idx: 22 + jump_through: false + - pos: + - 30 + - 6 + idx: 22 + jump_through: false + - pos: + - 31 + - 6 + idx: 22 + jump_through: false + - pos: + - 32 + - 6 + idx: 22 + jump_through: false + - pos: + - 33 + - 6 + idx: 13 + jump_through: false + - pos: + - 34 + - 6 + idx: 8 + jump_through: false + - pos: + - 0 + - 5 + idx: 8 + jump_through: false + - pos: + - 1 + - 5 + idx: 9 + jump_through: false + - pos: + - 12 + - 5 + idx: 0 + jump_through: false + - pos: + - 13 + - 5 + idx: 45 + jump_through: false + - pos: + - 14 + - 5 + idx: 16 + jump_through: false + - pos: + - 20 + - 5 + idx: 14 + jump_through: false + - pos: + - 21 + - 5 + idx: 44 + jump_through: false + - pos: + - 22 + - 5 + idx: 2 + jump_through: false + - pos: + - 33 + - 5 + idx: 7 + jump_through: false + - pos: + - 34 + - 5 + idx: 8 + jump_through: false + - pos: + - 0 + - 4 + idx: 8 + jump_through: false + - pos: + - 1 + - 4 + idx: 9 + jump_through: false + - pos: + - 11 + - 4 + idx: 0 + jump_through: false + - pos: + - 12 + - 4 + idx: 45 + jump_through: false + - pos: + - 13 + - 4 + idx: 16 + jump_through: false + - pos: + - 21 + - 4 + idx: 14 + jump_through: false + - pos: + - 22 + - 4 + idx: 44 + jump_through: false + - pos: + - 23 + - 4 + idx: 2 + jump_through: false + - pos: + - 33 + - 4 + idx: 7 + jump_through: false + - pos: + - 34 + - 4 + idx: 8 + jump_through: false + - pos: + - 0 + - 3 + idx: 8 + jump_through: false + - pos: + - 1 + - 3 + idx: 9 + jump_through: false + - pos: + - 11 + - 3 + idx: 14 + jump_through: false + - pos: + - 12 + - 3 + idx: 16 + jump_through: false + - pos: + - 13 + - 3 + idx: 10 + jump_through: false + - pos: + - 21 + - 3 + idx: 10 + jump_through: false + - pos: + - 22 + - 3 + idx: 14 + jump_through: false + - pos: + - 23 + - 3 + idx: 16 + jump_through: false + - pos: + - 33 + - 3 + idx: 7 + jump_through: false + - pos: + - 34 + - 3 + idx: 8 + jump_through: false + - pos: + - 0 + - 2 + idx: 4 + jump_through: false + - pos: + - 1 + - 2 + idx: 37 + jump_through: false + - pos: + - 2 + - 2 + idx: 33 + jump_through: false + - pos: + - 3 + - 2 + idx: 22 + jump_through: false + - pos: + - 4 + - 2 + idx: 22 + jump_through: false + - pos: + - 5 + - 2 + idx: 22 + jump_through: false + - pos: + - 6 + - 2 + idx: 22 + jump_through: false + - pos: + - 7 + - 2 + idx: 22 + jump_through: false + - pos: + - 8 + - 2 + idx: 22 + jump_through: false + - pos: + - 9 + - 2 + idx: 22 + jump_through: false + - pos: + - 10 + - 2 + idx: 33 + jump_through: false + - pos: + - 11 + - 2 + idx: 22 + jump_through: false + - pos: + - 12 + - 2 + idx: 33 + jump_through: false + - pos: + - 13 + - 2 + idx: 22 + jump_through: false + - pos: + - 14 + - 2 + idx: 22 + jump_through: false + - pos: + - 15 + - 2 + idx: 22 + jump_through: false + - pos: + - 16 + - 2 + idx: 22 + jump_through: false + - pos: + - 17 + - 2 + idx: 33 + jump_through: false + - pos: + - 18 + - 2 + idx: 22 + jump_through: false + - pos: + - 19 + - 2 + idx: 22 + jump_through: false + - pos: + - 20 + - 2 + idx: 22 + jump_through: false + - pos: + - 21 + - 2 + idx: 22 + jump_through: false + - pos: + - 22 + - 2 + idx: 22 + jump_through: false + - pos: + - 23 + - 2 + idx: 22 + jump_through: false + - pos: + - 24 + - 2 + idx: 22 + jump_through: false + - pos: + - 25 + - 2 + idx: 33 + jump_through: false + - pos: + - 26 + - 2 + idx: 22 + jump_through: false + - pos: + - 27 + - 2 + idx: 22 + jump_through: false + - pos: + - 28 + - 2 + idx: 22 + jump_through: false + - pos: + - 29 + - 2 + idx: 22 + jump_through: false + - pos: + - 30 + - 2 + idx: 22 + jump_through: false + - pos: + - 31 + - 2 + idx: 22 + jump_through: false + - pos: + - 32 + - 2 + idx: 33 + jump_through: false + - pos: + - 33 + - 2 + idx: 38 + jump_through: false + - pos: + - 34 + - 2 + idx: 5 + jump_through: false + - pos: + - 0 + - 1 + idx: 11 + jump_through: false + - pos: + - 1 + - 1 + idx: 12 + jump_through: false + - pos: + - 2 + - 1 + idx: 3 + jump_through: false + - pos: + - 3 + - 1 + idx: 8 + jump_through: false + - pos: + - 4 + - 1 + idx: 8 + jump_through: false + - pos: + - 5 + - 1 + idx: 20 + jump_through: false + - pos: + - 6 + - 1 + idx: 13 + jump_through: false + - pos: + - 7 + - 1 + idx: 8 + jump_through: false + - pos: + - 8 + - 1 + idx: 8 + jump_through: false + - pos: + - 9 + - 1 + idx: 8 + jump_through: false + - pos: + - 10 + - 1 + idx: 3 + jump_through: false + - pos: + - 11 + - 1 + idx: 8 + jump_through: false + - pos: + - 12 + - 1 + idx: 27 + jump_through: false + - pos: + - 13 + - 1 + idx: 8 + jump_through: false + - pos: + - 14 + - 1 + idx: 8 + jump_through: false + - pos: + - 15 + - 1 + idx: 8 + jump_through: false + - pos: + - 16 + - 1 + idx: 8 + jump_through: false + - pos: + - 17 + - 1 + idx: 3 + jump_through: false + - pos: + - 18 + - 1 + idx: 8 + jump_through: false + - pos: + - 19 + - 1 + idx: 8 + jump_through: false + - pos: + - 20 + - 1 + idx: 8 + jump_through: false + - pos: + - 21 + - 1 + idx: 8 + jump_through: false + - pos: + - 22 + - 1 + idx: 8 + jump_through: false + - pos: + - 23 + - 1 + idx: 8 + jump_through: false + - pos: + - 24 + - 1 + idx: 8 + jump_through: false + - pos: + - 25 + - 1 + idx: 3 + jump_through: false + - pos: + - 26 + - 1 + idx: 8 + jump_through: false + - pos: + - 27 + - 1 + idx: 8 + jump_through: false + - pos: + - 28 + - 1 + idx: 8 + jump_through: false + - pos: + - 29 + - 1 + idx: 27 + jump_through: false + - pos: + - 30 + - 1 + idx: 8 + jump_through: false + - pos: + - 31 + - 1 + idx: 8 + jump_through: false + - pos: + - 32 + - 1 + idx: 3 + jump_through: false + - pos: + - 33 + - 1 + idx: 11 + jump_through: false + - pos: + - 34 + - 1 + idx: 12 + jump_through: false + - pos: + - 0 + - 0 + idx: 8 + jump_through: false + - pos: + - 1 + - 0 + idx: 8 + jump_through: false + - pos: + - 2 + - 0 + idx: 10 + jump_through: false + - pos: + - 3 + - 0 + idx: 8 + jump_through: false + - pos: + - 4 + - 0 + idx: 8 + jump_through: false + - pos: + - 5 + - 0 + idx: 8 + jump_through: false + - pos: + - 6 + - 0 + idx: 8 + jump_through: false + - pos: + - 7 + - 0 + idx: 8 + jump_through: false + - pos: + - 8 + - 0 + idx: 8 + jump_through: false + - pos: + - 9 + - 0 + idx: 8 + jump_through: false + - pos: + - 10 + - 0 + idx: 10 + jump_through: false + - pos: + - 11 + - 0 + idx: 8 + jump_through: false + - pos: + - 12 + - 0 + idx: 6 + jump_through: false + - pos: + - 13 + - 0 + idx: 8 + jump_through: false + - pos: + - 14 + - 0 + idx: 8 + jump_through: false + - pos: + - 15 + - 0 + idx: 8 + jump_through: false + - pos: + - 16 + - 0 + idx: 8 + jump_through: false + - pos: + - 17 + - 0 + idx: 10 + jump_through: false + - pos: + - 18 + - 0 + idx: 8 + jump_through: false + - pos: + - 19 + - 0 + idx: 8 + jump_through: false + - pos: + - 20 + - 0 + idx: 20 + jump_through: false + - pos: + - 21 + - 0 + idx: 13 + jump_through: false + - pos: + - 22 + - 0 + idx: 8 + jump_through: false + - pos: + - 23 + - 0 + idx: 8 + jump_through: false + - pos: + - 24 + - 0 + idx: 8 + jump_through: false + - pos: + - 25 + - 0 + idx: 10 + jump_through: false + - pos: + - 26 + - 0 + idx: 8 + jump_through: false + - pos: + - 27 + - 0 + idx: 8 + jump_through: false + - pos: + - 28 + - 0 + idx: 8 + jump_through: false + - pos: + - 29 + - 0 + idx: 6 + jump_through: false + - pos: + - 30 + - 0 + idx: 8 + jump_through: false + - pos: + - 31 + - 0 + idx: 8 + jump_through: false + - pos: + - 32 + - 0 + idx: 10 + jump_through: false + - pos: + - 33 + - 0 + idx: 8 + jump_through: false + - pos: + - 34 + - 0 + idx: 8 + jump_through: false + - id: decorations + kind: !element + elements: + - pos: + - 984.5713 + - 247.5 + element: ../elements/item/sniper_rifle/sniper_rifle.element.yaml + - pos: + - 107.4286 + - 225.5 + element: ../elements/item/blunderbass/blunderbass.element.yaml + - pos: + - 560.0 + - 271.5 + element: ../elements/environment/crab/crab.element.yaml + - pos: + - 480.0 + - 427.5 + element: ../elements/environment/crab/crab.element.yaml + - pos: + - 888.0 + - 139.5 + element: ../elements/environment/fish_school/fish_school.element.yaml + - pos: + - 88.0 + - 353.5 + element: ../elements/environment/fish_school/fish_school.element.yaml + - pos: + - 896.0 + - 121.5 + element: ../elements/decoration/seaweed/seaweed.element.yaml + - pos: + - 496.0 + - 121.5 + element: ../elements/decoration/anemones/anemones.element.yaml + - pos: + - 1000.0 + - 121.5 + element: ../elements/decoration/anemones/anemones.element.yaml + - pos: + - 288.0 + - 121.5 + element: ../elements/decoration/anemones/anemones.element.yaml + - pos: + - 112.0 + - 121.5 + element: ../elements/decoration/seaweed/seaweed.element.yaml + - pos: + - 736.3636 + - 441.5 + element: ../elements/decoration/seaweed/seaweed.element.yaml + - pos: + - 96.0 + - 345.5 + element: ../elements/decoration/seaweed/seaweed.element.yaml + - pos: + - 328.0 + - 441.5 + element: ../elements/decoration/anemones/anemones.element.yaml + - pos: + - 968.0 + - 257.5 + element: ../elements/decoration/anemones/anemones.element.yaml + - id: items + kind: !element + elements: + - pos: + - 120.40002 + - 129.5 + element: ../elements/item/crate/crate.element.yaml + - pos: + - 1024.0 + - 137.5 + element: ../elements/item/crate/crate.element.yaml + - pos: + - 111.40014 + - 337.5 + element: ../elements/item/crate/crate.element.yaml + - pos: + - 1043.9714 + - 329.5 + element: ../elements/item/crate/crate.element.yaml + - pos: + - 392.0 + - 433.5 + element: ../elements/item/crate/crate.element.yaml + - pos: + - 677.2236 + - 433.5 + element: ../elements/item/crate/crate.element.yaml + - pos: + - 616.0 + - 111.5 + element: ../elements/item/musket/musket.element.yaml + - pos: + - 808.0 + - 463.5 + element: ../elements/item/sword/sword.element.yaml + - pos: + - 536.1026 + - 441.5 + element: ../elements/item/sword/sword.element.yaml + - pos: + - 884.0 + - 145.5 + element: ../elements/item/sword/sword.element.yaml + - pos: + - 277.7143 + - 121.5 + element: ../elements/item/sword/sword.element.yaml + - pos: + - 800.0 + - 425.5 + element: ../elements/item/mines/mines.element.yaml + - pos: + - 564.9702 + - 105.5 + element: ../elements/environment/sproinger/sproinger.element.yaml + - id: spawners + kind: !element + elements: + - pos: + - 176.83333 + - 120.83334 + element: ../elements/environment/player_spawner/player_spawner.element.yaml + - pos: + - 947.0 + - 119.33334 + element: ../elements/environment/player_spawner/player_spawner.element.yaml + - pos: + - 137.42857 + - 346.7143 + element: ../elements/environment/player_spawner/player_spawner.element.yaml + - pos: + - 973.857 + - 347.85715 + element: ../elements/environment/player_spawner/player_spawner.element.yaml diff --git a/src/assets.rs b/src/assets.rs index 51e92fd30c..d6ba426732 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -175,12 +175,17 @@ impl AssetLoader for GameMetaLoader { } // Load map handles - for map_relative_path in &meta.maps { - let (path, handle) = get_relative_asset(load_context, self_path, map_relative_path); - - meta.map_handles - .push(AssetHandle::new(path.clone(), handle.typed())); - dependencies.push(path); + for (map_list, handle_list) in [ + (&meta.stable_maps, &mut meta.stable_map_handles), + (&meta.experimental_maps, &mut meta.experimental_map_handles), + ] { + for map_relative_path in map_list { + let (path, handle) = + get_relative_asset(load_context, self_path, map_relative_path); + + handle_list.push(AssetHandle::new(path.clone(), handle.typed())); + dependencies.push(path); + } } // Load UI fonts diff --git a/src/metadata.rs b/src/metadata.rs index 29b90b6695..069b67dcb7 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -34,9 +34,12 @@ pub struct GameMeta { pub players: Vec, #[serde(skip)] pub player_handles: Vec>, - pub maps: Vec, + pub stable_maps: Vec, #[serde(skip)] - pub map_handles: Vec>, + pub stable_map_handles: Vec>, + pub experimental_maps: Vec, + #[serde(skip)] + pub experimental_map_handles: Vec>, pub clear_color: ui::ColorMeta, pub camera_height: u32, pub translations: localization::TranslationsMeta, diff --git a/src/ui/editor.rs b/src/ui/editor.rs index 82cdfe7e88..40bde7d88e 100644 --- a/src/ui/editor.rs +++ b/src/ui/editor.rs @@ -820,15 +820,23 @@ fn map_open_dialog(ui: &mut egui::Ui, params: &mut EditorCentralPanel) { egui::ScrollArea::vertical().show(ui, |ui| { #[allow(clippy::unnecessary_to_owned)] // False alarm, necessary to avoid borrowing params - for (map_name, map_handle) in params.game.maps.to_vec().into_iter().zip( - params - .game - .map_handles - .iter() - .map(|x| x.clone_weak()) - .collect::>() - .into_iter(), - ) { + for (map_name, map_handle) in params + .game + .stable_maps + .to_vec() + .into_iter() + .chain(params.game.experimental_maps.to_vec().into_iter()) + .zip( + params + .game + .stable_map_handles + .iter() + .chain(params.game.experimental_map_handles.iter()) + .map(|x| x.clone_weak()) + .collect::>() + .into_iter(), + ) + { if ui.button(&map_name).clicked() { params.commands.spawn().insert(map_handle); params.session_manager.start_session(); diff --git a/src/ui/main_menu/map_select.rs b/src/ui/main_menu/map_select.rs index 5adca7f160..a1cb558766 100644 --- a/src/ui/main_menu/map_select.rs +++ b/src/ui/main_menu/map_select.rs @@ -56,7 +56,7 @@ impl<'w, 's> WidgetSystem for MapSelectMenu<'w, 's> { let available_size = ui.available_size(); let menu_width = params.game.main_menu.menu_width; let x_margin = (available_size.x - menu_width) / 2.0; - let outer_margin = egui::style::Margin::symmetric(x_margin, 0.0); + let outer_margin = egui::style::Margin::symmetric(x_margin, heading_text_style.size); if is_waiting { ui.themed_label( @@ -71,39 +71,51 @@ impl<'w, 's> WidgetSystem for MapSelectMenu<'w, 's> { ui.set_width(ui.available_width()); egui::ScrollArea::vertical().show(ui, |ui| { - // Clippy lint is a false alarm, necessary to avoid borrowing params - #[allow(clippy::unnecessary_to_owned)] - for map_handle in params - .game - .map_handles - .iter() - .map(|x| x.clone_weak()) - .collect::>() - .into_iter() - { - let map_meta = params.map_assets.get(&map_handle).unwrap(); - ui.add_space(ui.spacing().item_spacing.y); + for (section_title, map_handles) in [ + ( + params.localization.get("default-maps"), + ¶ms.game.stable_map_handles, + ), + ( + params.localization.get("experimental-maps"), + ¶ms.game.experimental_map_handles, + ), + ] { + ui.add_space(bigger_text_style.size / 2.0); + ui.themed_label(bigger_text_style, §ion_title); - if BorderedButton::themed(small_button_style, &map_meta.name) - .show(ui) - .clicked() + // Clippy lint is a false alarm, necessary to avoid borrowing params + #[allow(clippy::unnecessary_to_owned)] + for map_handle in map_handles + .iter() + .map(|x| x.clone_weak()) + .collect::>() + .into_iter() { - info!("Selected map, starting game"); - *params.menu_page = MenuPage::Home; - params.commands.spawn().insert(map_handle.clone_weak()); - params - .commands - .insert_resource(NextState(GameState::InGame)); - params - .commands - .insert_resource(NextState(InGameState::Playing)); - params.session_manager.start_session(); + let map_meta = params.map_assets.get(&map_handle).unwrap(); + ui.add_space(ui.spacing().item_spacing.y); - if let Some(client) = &mut params.client { - client.send_reliable( - MatchSetupMessage::SelectMap(map_handle), - TargetClient::All, - ); + if BorderedButton::themed(small_button_style, &map_meta.name) + .show(ui) + .clicked() + { + info!("Selected map, starting game"); + *params.menu_page = MenuPage::Home; + params.commands.spawn().insert(map_handle.clone_weak()); + params + .commands + .insert_resource(NextState(GameState::InGame)); + params + .commands + .insert_resource(NextState(InGameState::Playing)); + params.session_manager.start_session(); + + if let Some(client) = &mut params.client { + client.send_reliable( + MatchSetupMessage::SelectMap(map_handle), + TargetClient::All, + ); + } } } }