diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 15719f3ed7..0c751d610e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly World shellmapWorld; readonly WebServices services; - enum PanelType { Players, Options, Music, Kick, ForceStart } + enum PanelType { Players, Options, Music, Servers, Kick, ForceStart } PanelType panel = PanelType.Players; readonly Widget lobby; @@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (name != null) name.GetText = () => orderManager.LobbyInfo.GlobalSettings.ServerName; - Ui.LoadWidget("MAP_PREVIEW", lobby.Get("MAP_PREVIEW_ROOT"), new WidgetArgs + var mapContainer = Ui.LoadWidget("MAP_PREVIEW", lobby.Get("MAP_PREVIEW_ROOT"), new WidgetArgs { { "orderManager", orderManager }, { "getMap", (Func)(() => map) }, @@ -130,6 +130,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { "showUnoccupiedSpawnpoints", true }, }); + mapContainer.IsVisible = () => panel != PanelType.Servers; + UpdateCurrentMap(); var playerBin = Ui.LoadWidget("LOBBY_PLAYER_BIN", lobby.Get("TOP_PANELS_ROOT"), new WidgetArgs()); @@ -157,6 +159,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var mapButton = lobby.GetOrNull("CHANGEMAP_BUTTON"); if (mapButton != null) { + mapButton.IsVisible = () => panel != PanelType.Servers; mapButton.IsDisabled = () => gameStarting || panel == PanelType.Kick || panel == PanelType.ForceStart || orderManager.LocalClient == null || orderManager.LocalClient.IsReady; mapButton.OnClick = () => @@ -186,6 +189,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var slotsButton = lobby.GetOrNull("SLOTS_DROPDOWNBUTTON"); if (slotsButton != null) { + slotsButton.IsVisible = () => panel != PanelType.Servers; slotsButton.IsDisabled = () => configurationDisabled() || panel != PanelType.Players || (orderManager.LobbyInfo.Slots.Values.All(s => !s.AllowBots) && orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) == 0); @@ -294,22 +298,45 @@ namespace OpenRA.Mods.Common.Widgets.Logic }); musicBin.IsVisible = () => panel == PanelType.Music; - var optionsTab = lobby.Get("OPTIONS_TAB"); + if (!skirmishMode) + { + Action doNothingWithServer = _ => { }; + + var serversBin = Ui.LoadWidget("LOBBY_SERVERS_BIN", lobby.Get("TOP_PANELS_ROOT"), new WidgetArgs + { + { "onJoin", doNothingWithServer }, + }); + + serversBin.IsVisible = () => panel == PanelType.Servers; + } + + var tabContainer = skirmishMode ? lobby.Get("SKIRMISH_TABS") : lobby.Get("MULTIPLAYER_TABS"); + tabContainer.IsVisible = () => true; + + var optionsTab = tabContainer.Get("OPTIONS_TAB"); optionsTab.IsHighlighted = () => panel == PanelType.Options; optionsTab.IsDisabled = OptionsTabDisabled; optionsTab.OnClick = () => panel = PanelType.Options; optionsTab.GetText = () => !map.RulesLoaded ? "Loading..." : optionsTab.Text; - var playersTab = lobby.Get("PLAYERS_TAB"); + var playersTab = tabContainer.Get("PLAYERS_TAB"); playersTab.IsHighlighted = () => panel == PanelType.Players; playersTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart; playersTab.OnClick = () => panel = PanelType.Players; - var musicTab = lobby.Get("MUSIC_TAB"); + var musicTab = tabContainer.Get("MUSIC_TAB"); musicTab.IsHighlighted = () => panel == PanelType.Music; musicTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart; musicTab.OnClick = () => panel = PanelType.Music; + var serversTab = tabContainer.GetOrNull("SERVERS_TAB"); + if (serversTab != null) + { + serversTab.IsHighlighted = () => panel == PanelType.Servers; + serversTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart; + serversTab.OnClick = () => panel = PanelType.Servers; + } + // Force start panel Action startGame = () => { diff --git a/mods/cnc/chrome/lobby-servers.yaml b/mods/cnc/chrome/lobby-servers.yaml new file mode 100644 index 0000000000..c4f3cf9d22 --- /dev/null +++ b/mods/cnc/chrome/lobby-servers.yaml @@ -0,0 +1,189 @@ +Container@LOBBY_SERVERS_BIN: + Logic: ServerListLogic + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: + Container@LABEL_CONTAINER: + Y: 0 - 25 + Width: PARENT_RIGHT + Children: + Label@NAME: + X: 5 + Width: 255 + Height: 25 + Text: Server + Align: Center + Font: Bold + Label@PLAYERS: + X: 290 + Width: 85 + Height: 25 + Text: Players + Font: Bold + Label@LOCATION: + X: 380 + Width: 110 + Height: 25 + Text: Location + Font: Bold + Label@STATUS: + X: 495 + Width: 50 + Height: 25 + Text: Status + Font: Bold + LogicTicker@NOTICE_WATCHER: + Container@NOTICE_CONTAINER: + Width: 582 + Height: 19 + Children: + Background@bg: + Width: PARENT_RIGHT + Height: 20 + Background: panel-black + Children: + Label@OUTDATED_VERSION_LABEL: + X: 5 + Width: PARENT_RIGHT-10 + Height: 18 + Align: Center + Text: You are running an outdated version of OpenRA. Download the latest version from www.openra.net + Font: TinyBold + Label@UNKNOWN_VERSION_LABEL: + X: 5 + Width: PARENT_RIGHT-10 + Height: 18 + Align: Center + Text: You are running an unrecognized version of OpenRA. Download the latest version from www.openra.net + Font: TinyBold + Label@PLAYTEST_AVAILABLE_LABEL: + X: 5 + Width: PARENT_RIGHT-10 + Height: 18 + Align: Center + Text: A preview of the next OpenRA release is available for testing. Download the playtest from www.openra.net + Font: TinyBold + ScrollPanel@SERVER_LIST: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: + ScrollItem@HEADER_TEMPLATE: + Width: PARENT_RIGHT - 27 + Height: 20 + X: 2 + Visible: false + Children: + Label@LABEL: + Y: 0 - 1 + Font: TinyBold + Width: PARENT_RIGHT + Height: 20 + Align: Center + ScrollItem@SERVER_TEMPLATE: + Width: PARENT_RIGHT - 27 + Height: 25 + X: 2 + EnableChildMouseOver: True + Children: + Label@TITLE: + X: 5 + Width: 255 + Height: 25 + Image@PASSWORD_PROTECTED: + X: 272 + Y: 6 + Width: 8 + Height: 10 + ImageCollection: lobby-bits + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + TooltipText: Requires Password + LabelWithTooltip@PLAYERS: + X: 290 + Width: 85 + Height: 25 + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + Label@LOCATION: + X: 380 + Width: 110 + Height: 25 + Label@STATUS: + X: 495 + Width: 50 + Height: 25 + Label@PROGRESS_LABEL: + Y: (PARENT_BOTTOM - HEIGHT) / 2 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Align: Center + Visible: false + DropDownButton@FILTERS_DROPDOWNBUTTON: + Y: PARENT_BOTTOM + 5 + Width: 151 + Height: 25 + Text: Filter Games + Font: Bold + Button@RELOAD_BUTTON: + X: 156 + Y: PARENT_BOTTOM + 5 + Width: 26 + Height: 25 + Children: + Image@IMAGE_RELOAD: + X: 5 + Y: 5 + Width: 16 + Height: 16 + ImageCollection: reload-icon + ImageName: enabled + IgnoreMouseOver: True + Children: + LogicTicker@ANIMATION: + Container@SELECTED_SERVER: + X: PARENT_RIGHT + 14 + Width: 174 + Height: 280 + Children: + Background@MAP_BG: + Width: PARENT_RIGHT + Height: 174 + Background: panel-gray + Children: + MapPreview@SELECTED_MAP_PREVIEW: + X: 1 + Y: 1 + Width: PARENT_RIGHT - 2 + Height: PARENT_BOTTOM - 2 + TooltipContainer: TOOLTIP_CONTAINER + Label@SELECTED_MAP: + Y: 172 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Align: Center + Label@SELECTED_IP: + Y: 187 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Label@SELECTED_STATUS: + Y: 203 + Width: PARENT_RIGHT + Height: 25 + Font: TinyBold + Align: Center + Label@SELECTED_MOD_VERSION: + Y: 216 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Label@SELECTED_PLAYERS: + Y: 229 + Width: PARENT_RIGHT + Height: 25 + Font: TinyBold + Align: Center diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index d1c62350a0..1248eb65d7 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -25,27 +25,57 @@ Container@SERVER_LOBBY: DropDownButton@SLOTS_DROPDOWNBUTTON: X: 15 Y: 254 - Width: 162 + Width: 182 Height: 25 Text: Slot Admin - Button@PLAYERS_TAB: - X: 182 - Y: 248 - Width: 135 - Height: 31 - Text: Players - Button@OPTIONS_TAB: - X: 322 - Y: 248 - Width: 135 - Height: 31 - Text: Options - Button@MUSIC_TAB: - X: 462 - Y: 248 - Width: 135 - Height: 31 - Text: Music + Container@SKIRMISH_TABS: + Visible: False + Children: + Button@PLAYERS_TAB: + X: 202 + Y: 248 + Width: 129 + Height: 31 + Text: Players + Button@OPTIONS_TAB: + X: 336 + Y: 248 + Width: 128 + Height: 31 + Text: Options + Button@MUSIC_TAB: + X: 469 + Y: 248 + Width: 128 + Height: 31 + Text: Music + Container@MULTIPLAYER_TABS: + Visible: False + Children: + Button@PLAYERS_TAB: + X: 202 + Y: 248 + Width: 95 + Height: 31 + Text: Players + Button@OPTIONS_TAB: + X: 302 + Y: 248 + Width: 95 + Height: 31 + Text: Options + Button@MUSIC_TAB: + X: 402 + Y: 248 + Width: 95 + Height: 31 + Text: Music + Button@SERVERS_TAB: + X: 502 + Y: 248 + Width: 95 + Height: 31 + Text: Servers Button@CHANGEMAP_BUTTON: X: PARENT_RIGHT - WIDTH - 15 Y: 254 diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 9b5c4d407d..a98541388a 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -98,6 +98,7 @@ ChromeLayout: cnc|chrome/lobby-players.yaml cnc|chrome/lobby-options.yaml cnc|chrome/lobby-music.yaml + cnc|chrome/lobby-servers.yaml cnc|chrome/lobby-kickdialogs.yaml cnc|chrome/connection.yaml cnc|chrome/color-picker.yaml diff --git a/mods/common/chrome/lobby-servers.yaml b/mods/common/chrome/lobby-servers.yaml new file mode 100644 index 0000000000..ea3e272c7f --- /dev/null +++ b/mods/common/chrome/lobby-servers.yaml @@ -0,0 +1,186 @@ +Container@LOBBY_SERVERS_BIN: + Logic: ServerListLogic + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: + Container@LABEL_CONTAINER: + Y: 0 - 25 + Width: PARENT_RIGHT + Children: + Label@NAME: + X: 5 + Width: 255 + Height: 25 + Text: Server + Align: Center + Font: Bold + Label@PLAYERS: + X: 290 + Width: 85 + Height: 25 + Text: Players + Font: Bold + Label@LOCATION: + X: 380 + Width: 110 + Height: 25 + Text: Location + Font: Bold + Label@STATUS: + X: 495 + Width: 50 + Height: 25 + Text: Status + Font: Bold + LogicTicker@NOTICE_WATCHER: + Background@NOTICE_CONTAINER: + Width: 583 + Height: 20 + Background: dialog2 + Children: + Label@OUTDATED_VERSION_LABEL: + X: 5 + Width: PARENT_RIGHT-10 + Height: 18 + Align: Center + Text: You are running an outdated version of OpenRA. Download the latest version from www.openra.net + Font: TinyBold + Label@UNKNOWN_VERSION_LABEL: + X: 5 + Width: PARENT_RIGHT-10 + Height: 18 + Align: Center + Text: You are running an unrecognized version of OpenRA. Download the latest version from www.openra.net + Font: TinyBold + Label@PLAYTEST_AVAILABLE_LABEL: + X: 5 + Width: PARENT_RIGHT-10 + Height: 18 + Align: Center + Text: A preview of the next OpenRA release is available for testing. Download the playtest from www.openra.net + Font: TinyBold + ScrollPanel@SERVER_LIST: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: + ScrollItem@HEADER_TEMPLATE: + X: 2 + Width: PARENT_RIGHT - 27 + Height: 20 + BaseName: scrollheader + Visible: false + Children: + Label@LABEL: + Y: 0 - 1 + Font: TinyBold + Width: PARENT_RIGHT + Height: 20 + Align: Center + ScrollItem@SERVER_TEMPLATE: + X: 2 + Width: PARENT_RIGHT - 27 + Height: 25 + EnableChildMouseOver: True + Children: + Label@TITLE: + X: 5 + Width: 255 + Height: 25 + Image@PASSWORD_PROTECTED: + X: 272 + Y: 6 + Width: 10 + Height: 12 + ImageCollection: lobby-bits + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + TooltipText: Requires Password + LabelWithTooltip@PLAYERS: + X: 290 + Width: 85 + Height: 25 + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + Label@LOCATION: + X: 380 + Width: 110 + Height: 25 + Label@STATUS: + X: 495 + Width: 50 + Height: 25 + Label@PROGRESS_LABEL: + Y: (PARENT_BOTTOM - HEIGHT) / 2 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Align: Center + Visible: false + DropDownButton@FILTERS_DROPDOWNBUTTON: + Y: PARENT_BOTTOM + 5 + Width: 147 + Height: 25 + Text: Filter Games + Font: Bold + Button@RELOAD_BUTTON: + X: 152 + Y: PARENT_BOTTOM + 5 + Width: 26 + Height: 25 + Children: + Image@IMAGE_RELOAD: + X: 5 + Y: 5 + Width: 16 + Height: 16 + ImageCollection: reload-icon + ImageName: enabled + IgnoreMouseOver: True + Children: + LogicTicker@ANIMATION: + Container@SELECTED_SERVER: + X: PARENT_RIGHT + 11 + Width: 174 + Height: 280 + Children: + Background@MAP_BG: + Width: PARENT_RIGHT + Height: 174 + Background: dialog3 + Children: + MapPreview@SELECTED_MAP_PREVIEW: + X: 1 + Y: 1 + Width: PARENT_RIGHT - 2 + Height: PARENT_BOTTOM - 2 + TooltipContainer: TOOLTIP_CONTAINER + Label@SELECTED_MAP: + Y: 172 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Align: Center + Label@SELECTED_IP: + Y: 187 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Label@SELECTED_STATUS: + Y: 203 + Width: PARENT_RIGHT + Height: 25 + Font: TinyBold + Align: Center + Label@SELECTED_MOD_VERSION: + Y: 216 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Label@SELECTED_PLAYERS: + Y: 229 + Width: PARENT_RIGHT + Height: 25 + Font: TinyBold + Align: Center diff --git a/mods/common/chrome/lobby.yaml b/mods/common/chrome/lobby.yaml index c55a85d862..3ecda1f4e9 100644 --- a/mods/common/chrome/lobby.yaml +++ b/mods/common/chrome/lobby.yaml @@ -20,31 +20,65 @@ Background@SERVER_LOBBY: DropDownButton@SLOTS_DROPDOWNBUTTON: X: 20 Y: 291 - Width: 200 + Width: 178 Height: 25 Font: Bold Text: Slot Admin - Button@PLAYERS_TAB: - X: 225 - Y: 285 - Width: 126 - Height: 31 - Font: Bold - Text: Players - Button@OPTIONS_TAB: - X: 351 - Y: 285 - Width: 126 - Height: 31 - Font: Bold - Text: Options - Button@MUSIC_TAB: - X: 477 - Y: 285 - Width: 126 - Height: 31 - Font: Bold - Text: Music + Container@SKIRMISH_TABS: + Visible: False + Children: + Button@PLAYERS_TAB: + X: 203 + Y: 285 + Width: 134 + Height: 31 + Font: Bold + Text: Players + Button@OPTIONS_TAB: + X: 337 + Y: 285 + Width: 133 + Height: 31 + Font: Bold + Text: Options + Button@MUSIC_TAB: + X: 470 + Y: 285 + Width: 133 + Height: 31 + Font: Bold + Text: Music + Container@MULTIPLAYER_TABS: + Visible: False + Children: + Button@PLAYERS_TAB: + X: 203 + Y: 285 + Width: 100 + Height: 31 + Font: Bold + Text: Players + Button@OPTIONS_TAB: + X: 303 + Y: 285 + Width: 100 + Height: 31 + Font: Bold + Text: Options + Button@MUSIC_TAB: + X: 403 + Y: 285 + Width: 100 + Height: 31 + Font: Bold + Text: Music + Button@SERVERS_TAB: + X: 503 + Y: 285 + Width: 100 + Height: 31 + Font: Bold + Text: Servers Container@TOP_PANELS_ROOT: X: 20 Y: 67 diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 6a026281ce..fb8f9faa83 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -87,6 +87,7 @@ ChromeLayout: d2k|chrome/lobby-players.yaml common|chrome/lobby-options.yaml common|chrome/lobby-music.yaml + common|chrome/lobby-servers.yaml common|chrome/lobby-kickdialogs.yaml common|chrome/color-picker.yaml common|chrome/map-chooser.yaml diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index c15a179caf..0f5db0112a 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -102,6 +102,7 @@ ChromeLayout: common|chrome/lobby-players.yaml common|chrome/lobby-options.yaml common|chrome/lobby-music.yaml + common|chrome/lobby-servers.yaml common|chrome/lobby-kickdialogs.yaml common|chrome/color-picker.yaml common|chrome/map-chooser.yaml diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index a1de169280..38ed1405b4 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -150,6 +150,7 @@ ChromeLayout: common|chrome/lobby-players.yaml common|chrome/lobby-options.yaml common|chrome/lobby-music.yaml + common|chrome/lobby-servers.yaml common|chrome/lobby-kickdialogs.yaml ts|chrome/color-picker.yaml common|chrome/map-chooser.yaml