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 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<MapPreview>)(() => 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<ButtonWidget>("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<DropDownButtonWidget>("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<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.IsDisabled = OptionsTabDisabled;
optionsTab.OnClick = () => panel = PanelType.Options;
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.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
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.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
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
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:
X: 15
Y: 254
Width: 162
Width: 182
Height: 25
Text: Slot Admin
Container@SKIRMISH_TABS:
Visible: False
Children:
Button@PLAYERS_TAB:
X: 182
X: 202
Y: 248
Width: 135
Width: 129
Height: 31
Text: Players
Button@OPTIONS_TAB:
X: 322
X: 336
Y: 248
Width: 135
Width: 128
Height: 31
Text: Options
Button@MUSIC_TAB:
X: 462
X: 469
Y: 248
Width: 135
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

View File

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

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

View File

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

View File

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

View File

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