diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 8319f2d033..97afc4fde5 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -144,6 +144,19 @@ namespace OpenRA.Mods.RA.Widgets.Logic }; mapButton.IsVisible = () => mapButton.Visible && Game.IsHost; + var randomMapButton = lobby.Get("RANDOMMAP_BUTTON"); + randomMapButton.OnClick = () => + { + if (Game.modData.AvailableMaps.Any()) + { + var mapUid = Game.modData.AvailableMaps.Random(Game.CosmeticRandom).Key; + orderManager.IssueOrder(Order.Command("map " + mapUid)); + Game.Settings.Server.Map = mapUid; + Game.Settings.Save(); + } + }; + randomMapButton.IsVisible = () => mapButton.Visible && Game.IsHost; + var disconnectButton = lobby.Get("DISCONNECT_BUTTON"); disconnectButton.OnClick = () => { CloseWindow(); onExit(); }; diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index a57f11c6d8..60ab28fe8e 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -364,13 +364,6 @@ Background@SERVER_LOBBY: Text:Ready Align:Left Font:Bold - Button@CHANGEMAP_BUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-269 - Width:120 - Height:25 - Text:Change Map - Font:Bold ScrollPanel@CHAT_DISPLAY: X:20 Y:PARENT_BOTTOM - 289 @@ -412,6 +405,40 @@ Background@SERVER_LOBBY: Y:PARENT_BOTTOM - 49 Width:550 Height:25 + Button@CHANGEMAP_BUTTON: + X:PARENT_RIGHT-154 + Y:PARENT_BOTTOM-289 + Width:120 + Height:25 + Text:Change Map + Font:Bold + Button@RANDOMMAP_BUTTON: + X:PARENT_RIGHT-154 + Y:PARENT_BOTTOM-259 + Width:120 + Height:25 + Text:Random Map + Font:Bold + DropDownButton@DIFFICULTY_DROPDOWNBUTTON: + X:PARENT_RIGHT-154 + Y:PARENT_BOTTOM-229 + Width:120 + Height:25 + Font:Bold + Visible:false + Checkbox@ALLOWCHEATS_CHECKBOX: + X: PARENT_RIGHT-154 + Y: PARENT_BOTTOM-179 + Width: 80 + Height: 20 + Text: Allow Cheats + Button@DISCONNECT_BUTTON: + X:PARENT_RIGHT-154 + Y:PARENT_BOTTOM-129 + Width:120 + Height:25 + Text:Disconnect + Font:Bold Button@START_GAME_BUTTON: X:PARENT_RIGHT-154 Y:PARENT_BOTTOM-49 @@ -419,26 +446,6 @@ Background@SERVER_LOBBY: Height:25 Text:Start Game Font:Bold - Button@DISCONNECT_BUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-189+25 - Width:120 - Height:25 - Text:Disconnect - Font:Bold - DropDownButton@DIFFICULTY_DROPDOWNBUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-219+25 - Width:120 - Height:25 - Font:Bold - Visible:false - Checkbox@ALLOWCHEATS_CHECKBOX: - X: PARENT_RIGHT-154 - Y: PARENT_BOTTOM-229 - Width: 80 - Height: 20 - Text: Allow Cheats Background@COLOR_CHOOSER: Logic:ColorPickerLogic Background:dialog2