Refresh lobby server list when switching to the Servers tab.

This commit is contained in:
Paul Chote
2018-01-03 21:00:44 +00:00
committed by Oliver Brakmann
parent 3f37f02e84
commit 9a7c6ba34e
2 changed files with 11 additions and 2 deletions

View File

@@ -298,6 +298,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
});
musicBin.IsVisible = () => panel == PanelType.Music;
ServerListLogic serverListLogic = null;
if (!skirmishMode)
{
Action<GameServer> doNothingWithServer = _ => { };
@@ -307,6 +308,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ "onJoin", doNothingWithServer },
});
serverListLogic = serversBin.LogicObjects.Select(l => l as ServerListLogic).FirstOrDefault(l => l != null);
serversBin.IsVisible = () => panel == PanelType.Servers;
}
@@ -334,7 +336,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
serversTab.IsHighlighted = () => panel == PanelType.Servers;
serversTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
serversTab.OnClick = () => panel = PanelType.Servers;
serversTab.OnClick = () =>
{
// Refresh the list when switching to the servers tab
if (serverListLogic != null && panel != PanelType.Servers)
serverListLogic.RefreshServerList();
panel = PanelType.Servers;
};
}
// Force start panel

View File

@@ -306,7 +306,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
game.Spectators > 0 ? ", {0} Spectator{1}".F(game.Spectators, game.Spectators != 1 ? "s" : "") : "");
}
void RefreshServerList()
public void RefreshServerList()
{
// Query in progress
if (currentQuery != null)