Add a view-only server list tab to the multiplayer lobby.

This commit is contained in:
Paul Chote
2017-12-29 11:44:26 +00:00
committed by abcdefg30
parent 235b16d4b3
commit 7fba6a2155
9 changed files with 516 additions and 46 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly World shellmapWorld; readonly World shellmapWorld;
readonly WebServices services; readonly WebServices services;
enum PanelType { Players, Options, Music, Kick, ForceStart } enum PanelType { Players, Options, Music, Servers, Kick, ForceStart }
PanelType panel = PanelType.Players; PanelType panel = PanelType.Players;
readonly Widget lobby; readonly Widget lobby;
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (name != null) if (name != null)
name.GetText = () => orderManager.LobbyInfo.GlobalSettings.ServerName; 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 }, { "orderManager", orderManager },
{ "getMap", (Func<MapPreview>)(() => map) }, { "getMap", (Func<MapPreview>)(() => map) },
@@ -130,6 +130,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ "showUnoccupiedSpawnpoints", true }, { "showUnoccupiedSpawnpoints", true },
}); });
mapContainer.IsVisible = () => panel != PanelType.Servers;
UpdateCurrentMap(); UpdateCurrentMap();
var playerBin = Ui.LoadWidget("LOBBY_PLAYER_BIN", lobby.Get("TOP_PANELS_ROOT"), new WidgetArgs()); 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<ButtonWidget>("CHANGEMAP_BUTTON"); var mapButton = lobby.GetOrNull<ButtonWidget>("CHANGEMAP_BUTTON");
if (mapButton != null) if (mapButton != null)
{ {
mapButton.IsVisible = () => panel != PanelType.Servers;
mapButton.IsDisabled = () => gameStarting || panel == PanelType.Kick || panel == PanelType.ForceStart || mapButton.IsDisabled = () => gameStarting || panel == PanelType.Kick || panel == PanelType.ForceStart ||
orderManager.LocalClient == null || orderManager.LocalClient.IsReady; orderManager.LocalClient == null || orderManager.LocalClient.IsReady;
mapButton.OnClick = () => mapButton.OnClick = () =>
@@ -186,6 +189,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var slotsButton = lobby.GetOrNull<DropDownButtonWidget>("SLOTS_DROPDOWNBUTTON"); var slotsButton = lobby.GetOrNull<DropDownButtonWidget>("SLOTS_DROPDOWNBUTTON");
if (slotsButton != null) if (slotsButton != null)
{ {
slotsButton.IsVisible = () => panel != PanelType.Servers;
slotsButton.IsDisabled = () => configurationDisabled() || panel != PanelType.Players || slotsButton.IsDisabled = () => configurationDisabled() || panel != PanelType.Players ||
(orderManager.LobbyInfo.Slots.Values.All(s => !s.AllowBots) && (orderManager.LobbyInfo.Slots.Values.All(s => !s.AllowBots) &&
orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) == 0); 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; musicBin.IsVisible = () => panel == PanelType.Music;
var optionsTab = lobby.Get<ButtonWidget>("OPTIONS_TAB"); if (!skirmishMode)
{
Action<GameServer> 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<ButtonWidget>("OPTIONS_TAB");
optionsTab.IsHighlighted = () => panel == PanelType.Options; optionsTab.IsHighlighted = () => panel == PanelType.Options;
optionsTab.IsDisabled = OptionsTabDisabled; optionsTab.IsDisabled = OptionsTabDisabled;
optionsTab.OnClick = () => panel = PanelType.Options; optionsTab.OnClick = () => panel = PanelType.Options;
optionsTab.GetText = () => !map.RulesLoaded ? "Loading..." : optionsTab.Text; optionsTab.GetText = () => !map.RulesLoaded ? "Loading..." : optionsTab.Text;
var playersTab = lobby.Get<ButtonWidget>("PLAYERS_TAB"); var playersTab = tabContainer.Get<ButtonWidget>("PLAYERS_TAB");
playersTab.IsHighlighted = () => panel == PanelType.Players; playersTab.IsHighlighted = () => panel == PanelType.Players;
playersTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart; playersTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
playersTab.OnClick = () => panel = PanelType.Players; playersTab.OnClick = () => panel = PanelType.Players;
var musicTab = lobby.Get<ButtonWidget>("MUSIC_TAB"); var musicTab = tabContainer.Get<ButtonWidget>("MUSIC_TAB");
musicTab.IsHighlighted = () => panel == PanelType.Music; musicTab.IsHighlighted = () => panel == PanelType.Music;
musicTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart; musicTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
musicTab.OnClick = () => panel = PanelType.Music; musicTab.OnClick = () => panel = PanelType.Music;
var serversTab = tabContainer.GetOrNull<ButtonWidget>("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 // Force start panel
Action startGame = () => Action startGame = () =>
{ {

View File

@@ -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

View File

@@ -25,27 +25,57 @@ Container@SERVER_LOBBY:
DropDownButton@SLOTS_DROPDOWNBUTTON: DropDownButton@SLOTS_DROPDOWNBUTTON:
X: 15 X: 15
Y: 254 Y: 254
Width: 162 Width: 182
Height: 25 Height: 25
Text: Slot Admin Text: Slot Admin
Button@PLAYERS_TAB: Container@SKIRMISH_TABS:
X: 182 Visible: False
Y: 248 Children:
Width: 135 Button@PLAYERS_TAB:
Height: 31 X: 202
Text: Players Y: 248
Button@OPTIONS_TAB: Width: 129
X: 322 Height: 31
Y: 248 Text: Players
Width: 135 Button@OPTIONS_TAB:
Height: 31 X: 336
Text: Options Y: 248
Button@MUSIC_TAB: Width: 128
X: 462 Height: 31
Y: 248 Text: Options
Width: 135 Button@MUSIC_TAB:
Height: 31 X: 469
Text: Music 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: Button@CHANGEMAP_BUTTON:
X: PARENT_RIGHT - WIDTH - 15 X: PARENT_RIGHT - WIDTH - 15
Y: 254 Y: 254

View File

@@ -98,6 +98,7 @@ ChromeLayout:
cnc|chrome/lobby-players.yaml cnc|chrome/lobby-players.yaml
cnc|chrome/lobby-options.yaml cnc|chrome/lobby-options.yaml
cnc|chrome/lobby-music.yaml cnc|chrome/lobby-music.yaml
cnc|chrome/lobby-servers.yaml
cnc|chrome/lobby-kickdialogs.yaml cnc|chrome/lobby-kickdialogs.yaml
cnc|chrome/connection.yaml cnc|chrome/connection.yaml
cnc|chrome/color-picker.yaml cnc|chrome/color-picker.yaml

View File

@@ -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

View File

@@ -20,31 +20,65 @@ Background@SERVER_LOBBY:
DropDownButton@SLOTS_DROPDOWNBUTTON: DropDownButton@SLOTS_DROPDOWNBUTTON:
X: 20 X: 20
Y: 291 Y: 291
Width: 200 Width: 178
Height: 25 Height: 25
Font: Bold Font: Bold
Text: Slot Admin Text: Slot Admin
Button@PLAYERS_TAB: Container@SKIRMISH_TABS:
X: 225 Visible: False
Y: 285 Children:
Width: 126 Button@PLAYERS_TAB:
Height: 31 X: 203
Font: Bold Y: 285
Text: Players Width: 134
Button@OPTIONS_TAB: Height: 31
X: 351 Font: Bold
Y: 285 Text: Players
Width: 126 Button@OPTIONS_TAB:
Height: 31 X: 337
Font: Bold Y: 285
Text: Options Width: 133
Button@MUSIC_TAB: Height: 31
X: 477 Font: Bold
Y: 285 Text: Options
Width: 126 Button@MUSIC_TAB:
Height: 31 X: 470
Font: Bold Y: 285
Text: Music 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: Container@TOP_PANELS_ROOT:
X: 20 X: 20
Y: 67 Y: 67

View File

@@ -87,6 +87,7 @@ ChromeLayout:
d2k|chrome/lobby-players.yaml d2k|chrome/lobby-players.yaml
common|chrome/lobby-options.yaml common|chrome/lobby-options.yaml
common|chrome/lobby-music.yaml common|chrome/lobby-music.yaml
common|chrome/lobby-servers.yaml
common|chrome/lobby-kickdialogs.yaml common|chrome/lobby-kickdialogs.yaml
common|chrome/color-picker.yaml common|chrome/color-picker.yaml
common|chrome/map-chooser.yaml common|chrome/map-chooser.yaml

View File

@@ -102,6 +102,7 @@ ChromeLayout:
common|chrome/lobby-players.yaml common|chrome/lobby-players.yaml
common|chrome/lobby-options.yaml common|chrome/lobby-options.yaml
common|chrome/lobby-music.yaml common|chrome/lobby-music.yaml
common|chrome/lobby-servers.yaml
common|chrome/lobby-kickdialogs.yaml common|chrome/lobby-kickdialogs.yaml
common|chrome/color-picker.yaml common|chrome/color-picker.yaml
common|chrome/map-chooser.yaml common|chrome/map-chooser.yaml

View File

@@ -150,6 +150,7 @@ ChromeLayout:
common|chrome/lobby-players.yaml common|chrome/lobby-players.yaml
common|chrome/lobby-options.yaml common|chrome/lobby-options.yaml
common|chrome/lobby-music.yaml common|chrome/lobby-music.yaml
common|chrome/lobby-servers.yaml
common|chrome/lobby-kickdialogs.yaml common|chrome/lobby-kickdialogs.yaml
ts|chrome/color-picker.yaml ts|chrome/color-picker.yaml
common|chrome/map-chooser.yaml common|chrome/map-chooser.yaml