From 4b9b1df96be94010bdc8e82c4c3a95d5d1b5d920 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 16 Nov 2014 20:24:21 +0100 Subject: [PATCH] Add short game option to GUI --- .../ServerTraits/LobbySettingsNotification.cs | 3 + OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 9 +++ mods/cnc/chrome/lobby-dialogs.yaml | 17 ++++-- mods/ra/chrome/lobby-dialogs.yaml | 61 ++++++++++--------- 4 files changed, 57 insertions(+), 33 deletions(-) diff --git a/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs b/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs index d7e9c163e3..69c3249fe1 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs @@ -57,6 +57,9 @@ namespace OpenRA.Mods.Common.Server if (server.LobbyInfo.GlobalSettings.TechLevel != defaults.TechLevel) server.SendOrderTo(conn, "Message", "Tech Level: {0}".F(server.LobbyInfo.GlobalSettings.TechLevel)); + + if (server.LobbyInfo.GlobalSettings.ShortGame != defaults.ShortGame) + server.SendOrderTo(conn, "Message", "Short Game: {0}".F(server.LobbyInfo.GlobalSettings.ShortGame)); } } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 04dd852dbc..ffc9332412 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -352,6 +352,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic "fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances))); } + var shortGame = optionsBin.GetOrNull("SHORTGAME_CHECKBOX"); + if (shortGame != null) + { + shortGame.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.ShortGame; + shortGame.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.ShortGame.HasValue || configurationDisabled(); + shortGame.OnClick = () => orderManager.IssueOrder(Order.Command( + "shortgame {0}".F(!orderManager.LobbyInfo.GlobalSettings.ShortGame))); + } + var difficulty = optionsBin.GetOrNull("DIFFICULTY_DROPDOWNBUTTON"); if (difficulty != null) { diff --git a/mods/cnc/chrome/lobby-dialogs.yaml b/mods/cnc/chrome/lobby-dialogs.yaml index 9b8c476e8e..1feb87aae0 100644 --- a/mods/cnc/chrome/lobby-dialogs.yaml +++ b/mods/cnc/chrome/lobby-dialogs.yaml @@ -122,20 +122,27 @@ Background@LOBBY_OPTIONS_BIN: Font: Regular Text: Fog of War Checkbox@CRATES_CHECKBOX: - X: 160 + X: 140 Width: 230 Height: 20 Font: Regular - Text: Crates Appear + Text: Crates Checkbox@ALLYBUILDRADIUS_CHECKBOX: - X: 160 + X: 140 Y: 35 Width: 230 Height: 20 Font: Regular - Text: Build off Ally ConYards + Text: Build off Allies' ConYards + Checkbox@SHORTGAME_CHECKBOX: + X: 365 + Width: 230 + Height: 20 + Font: Regular + Text: Short Game Checkbox@ALLOWCHEATS_CHECKBOX: - X: 325 + X: 365 + Y: 35 Width: 230 Height: 20 Font: Regular diff --git a/mods/ra/chrome/lobby-dialogs.yaml b/mods/ra/chrome/lobby-dialogs.yaml index 296a801500..048cc72eb7 100644 --- a/mods/ra/chrome/lobby-dialogs.yaml +++ b/mods/ra/chrome/lobby-dialogs.yaml @@ -97,7 +97,7 @@ Background@LOBBY_OPTIONS_BIN: Children: Label@TITLE: X: 0 - Y: 30 + Y: 5 Width: PARENT_RIGHT Height: 25 Font: Bold @@ -105,89 +105,94 @@ Background@LOBBY_OPTIONS_BIN: Text: Map Options Container: X: 30 - Y: 70 + Y: 50 Width: PARENT_RIGHT-60 Height: PARENT_BOTTOM-75 Children: Checkbox@SHROUD_CHECKBOX: - Width: 230 + Width: 140 Height: 20 Text: Shroud Checkbox@FOG_CHECKBOX: - Y: 40 - Width: 230 + Y: 35 + Width: 140 Height: 20 Text: Fog of War + Checkbox@SHORTGAME_CHECKBOX: + X: 150 + Width: 140 + Height: 20 + Text: Short Game Checkbox@CRATES_CHECKBOX: - X: 125 - Width: 230 + X: 150 + Y: 35 + Width: 140 Height: 20 - Text: Crates Appear + Text: Crates Checkbox@ALLYBUILDRADIUS_CHECKBOX: - X: 125 - Y: 40 - Width: 230 + X: 290 + Width: 140 Height: 20 - Text: Build off Ally ConYards - Checkbox@ALLOWCHEATS_CHECKBOX: - X: 320 - Width: 230 - Height: 20 - Text: Debug Menu + Text: Build off Allies' ConYards Checkbox@FRAGILEALLIANCES_CHECKBOX: - X: 320 - Y: 40 - Width: 220 + X: 290 + Y: 35 + Width: 140 Height: 20 Text: Diplomacy Changes + Checkbox@ALLOWCHEATS_CHECKBOX: + Y: 70 + Width: 140 + Height: 20 + Text: Debug Menu Label@STARTINGCASH_DESC: - Y: 87 + Y: 110 Width: 80 Height: 25 Text: Starting Cash: Align: Right DropDownButton@STARTINGCASH_DROPDOWNBUTTON: X: 85 - Y: 87 + Y: 110 Width: 130 Height: 25 Font: Regular Text: $5000 Label@STARTINGUNITS_DESC: X: PARENT_RIGHT - WIDTH - 145 - Y: 87 + Y: 110 Width: 120 Height: 25 Text: Starting Units: Align: Right DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: X: PARENT_RIGHT - WIDTH - Y: 87 + Y: 110 Width: 140 Height: 25 Font: Regular Label@DIFFICULTY_DESC: X: PARENT_RIGHT - WIDTH - 145 - Y: 122 + Y: 150 Width: 120 Height: 25 Text: Mission Difficulty: Align: Right DropDownButton@DIFFICULTY_DROPDOWNBUTTON: X: PARENT_RIGHT - WIDTH - Y: 122 + Y: 150 Width: 140 Height: 25 Font: Regular DropDownButton@TECHLEVEL_DROPDOWNBUTTON: X: 85 - Y: 127 + Y: 150 Width: 130 Height: 25 Font: Regular Text: 10 Label@TECHLEVEL_DESC: - Y: 127 + Y: 150 Width: 80 Height: 25 Text: Tech Level: