diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 0ccd12eddd..ccb7692111 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -155,7 +155,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic var mapButton = lobby.GetOrNull("CHANGEMAP_BUTTON"); if (mapButton != null) { - mapButton.IsDisabled = configurationDisabled; + mapButton.IsDisabled = () => gameStarting || panel == PanelType.Kick || panel == PanelType.ForceStart || + orderManager.LocalClient == null || orderManager.LocalClient.IsReady; mapButton.OnClick = () => { var onSelect = new Action(uid => @@ -173,7 +174,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { { "initialMap", Map.Uid }, { "onExit", DoNothing }, - { "onSelect", onSelect }, + { "onSelect", Game.IsHost ? onSelect : null }, { "filter", MapVisibility.Lobby }, }); }; diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index 9832270b50..26106fda5b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -36,7 +36,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic var approving = new Action(() => { Ui.CloseWindow(); onSelect(selectedUid); }); var canceling = new Action(() => { Ui.CloseWindow(); onExit(); }); - widget.Get("BUTTON_OK").OnClick = approving; + var okButton = widget.Get("BUTTON_OK"); + okButton.Disabled = this.onSelect == null; + okButton.OnClick = approving; widget.Get("BUTTON_CANCEL").OnClick = canceling; scrollpanel = widget.Get("MAP_LIST"); @@ -128,8 +130,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Access the minimap to trigger async generation of the minimap. preview.GetMinimap(); + Action dblClick = () => + { + if (onSelect != null) + { + Ui.CloseWindow(); + onSelect(preview.Uid); + } + }; + var item = ScrollItemWidget.Setup(preview.Uid, itemTemplate, () => selectedUid == preview.Uid, - () => selectedUid = preview.Uid, () => { Ui.CloseWindow(); onSelect(preview.Uid); }); + () => selectedUid = preview.Uid, dblClick); item.IsVisible = () => item.RenderBounds.IntersectsWith(scrollpanel.RenderBounds); var titleLabel = item.Get("TITLE");