From 48f3d8f3c003f1818a5e779fe3355f6874ccb79c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 20 Mar 2014 22:46:27 +1300 Subject: [PATCH 1/2] Make the TD menu button positions consistent. Fixes #4735. --- mods/cnc/chrome/assetbrowser.yaml | 1 - mods/cnc/chrome/credits.yaml | 1 - mods/cnc/chrome/lobby.yaml | 3 +-- mods/cnc/chrome/settings.yaml | 24 ++++++++++++------------ 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/mods/cnc/chrome/assetbrowser.yaml b/mods/cnc/chrome/assetbrowser.yaml index aa5711f79c..6cce12007f 100644 --- a/mods/cnc/chrome/assetbrowser.yaml +++ b/mods/cnc/chrome/assetbrowser.yaml @@ -186,7 +186,6 @@ Container@ASSETBROWSER_PANEL: Align:Left Button@CLOSE_BUTTON: Key:escape - X:PARENT_RIGHT-140 Y:434 Width:140 Height:35 diff --git a/mods/cnc/chrome/credits.yaml b/mods/cnc/chrome/credits.yaml index eb1e6eae5b..4dd40d3393 100644 --- a/mods/cnc/chrome/credits.yaml +++ b/mods/cnc/chrome/credits.yaml @@ -28,7 +28,6 @@ Container@CREDITS_PANEL: Height:16 VAlign:Top Button@BACK_BUTTON: - X:PARENT_RIGHT-140 Y:399 Width:140 Height:35 diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index f31a7b2452..41859af2b4 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -156,14 +156,13 @@ Container@SERVER_LOBBY: Align:Right Text:Chat: Button@DISCONNECT_BUTTON: - X:600 Y:499 Width:140 Height:35 Text:Leave Game Key: escape Button@MUSIC_BUTTON: - X:450 + X:150 Y:499 Width:140 Height:35 diff --git a/mods/cnc/chrome/settings.yaml b/mods/cnc/chrome/settings.yaml index 3f48ed3ae2..88e94c1b06 100644 --- a/mods/cnc/chrome/settings.yaml +++ b/mods/cnc/chrome/settings.yaml @@ -33,18 +33,6 @@ Container@SETTINGS_PANEL: Width:140 Height:35 Text:Advanced - Button@RESET_BUTTON: - Y:343 - Width:140 - Height:35 - Text:Reset - Button@BACK_BUTTON: - Key:escape - X:PARENT_RIGHT-WIDTH - Y:343 - Width:140 - Height:35 - Text:Back Background@bg: Y:34 Width:590 @@ -454,3 +442,15 @@ Container@SETTINGS_PANEL: Height:20 Font:Regular Text:Check Sync around Unsynced Code + Button@BACK_BUTTON: + Key:escape + Y:343 + Width:140 + Height:35 + Text:Back + Button@RESET_BUTTON: + X:150 + Y:343 + Width:140 + Height:35 + Text:Reset \ No newline at end of file From 8535e8d2578e77c9f69dd55c1d40f050a501d22c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 20 Mar 2014 22:53:19 +1300 Subject: [PATCH 2/2] Add settings tab to TD lobby. Partially fixes #4770. --- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 19 +++++++++++++++---- mods/cnc/chrome/lobby.yaml | 8 +++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index e72f2272bd..0c42be7d1b 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Linq; +using OpenRA.Graphics; using OpenRA.Network; using OpenRA.Traits; using OpenRA.Widgets; @@ -20,6 +21,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class LobbyLogic { + static readonly Action DoNothing = () => { }; + readonly Action onStart; readonly Action onExit; readonly OrderManager orderManager; @@ -86,7 +89,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic } [ObjectCreator.UseCtor] - internal LobbyLogic(Widget widget, World world, OrderManager orderManager, + internal LobbyLogic(Widget widget, World world, WorldRenderer worldRenderer, OrderManager orderManager, Action onExit, Action onStart, bool skirmishMode) { lobby = widget; @@ -164,7 +167,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() { { "initialMap", preview.Uid }, - { "onExit", () => { } }, + { "onExit", DoNothing }, { "onSelect", onSelect } }); }; @@ -469,9 +472,17 @@ namespace OpenRA.Mods.RA.Widgets.Logic var musicButton = lobby.GetOrNull("MUSIC_BUTTON"); if (musicButton != null) - musicButton.OnClick = () => Ui.OpenWindow("MUSIC_PANEL", - new WidgetArgs { { "onExit", () => { } } }); + musicButton.OnClick = () => Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs { { "onExit", DoNothing } }); + var settingsButton = lobby.GetOrNull("SETTINGS_BUTTON"); + if (settingsButton != null) + { + settingsButton.OnClick = () => Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs + { + { "onExit", DoNothing }, + { "worldRenderer", worldRenderer } + }); + } // Add a bot on the first lobbyinfo update if (this.skirmishMode) Game.LobbyInfoChanged += WidgetUtils.Once(() => diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index 41859af2b4..1ce1394529 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -161,10 +161,16 @@ Container@SERVER_LOBBY: Height:35 Text:Leave Game Key: escape - Button@MUSIC_BUTTON: + Button@SETTINGS_BUTTON: X:150 Y:499 Width:140 Height:35 + Text:Settings + Button@MUSIC_BUTTON: + X:300 + Y:499 + Width:140 + Height:35 Text:Music TooltipContainer@TOOLTIP_CONTAINER: