simplify the selection boxes and use existing checks

This commit is contained in:
Matthias Mailänder
2013-04-12 12:13:42 +02:00
parent 2cdeb112fe
commit c9180aaf86
2 changed files with 24 additions and 33 deletions

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
bool showWaiting = true;
bool showEmpty = true;
bool showStarted = true;
bool showIncompatible = false;
public string ProgressLabelText()
{
@@ -102,6 +103,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
showAlreadyStartedCheckbox.OnClick = () => { showStarted ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
}
var showIncompatibleCheckbox = panel.GetOrNull<CheckboxWidget>("INCOMPATIBLE_VERSION");
if (showIncompatibleCheckbox != null)
{
showIncompatibleCheckbox.IsChecked = () => showIncompatible;
showIncompatibleCheckbox.OnClick = () => { showIncompatible ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
}
ServerList.Query(games => RefreshServerList(panel, games));
}
@@ -199,6 +207,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if ((game.Players == 0) && !showEmpty)
return true;
if (!game.CompatibleVersion() && !showIncompatible)
return true;
return false;
}
@@ -270,8 +281,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
ping.IsVisible = () => game.CompatibleVersion();
}
// TODO: Display game.Location once https://github.com/OpenRA/OpenRAMasterServer/pull/12 is merged
if (!canJoin)
{
title.GetColor = () => Color.Gray;