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;

View File

@@ -3,7 +3,7 @@ Background@JOINSERVER_BG:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:540
Height:535
Height:505
Children:
Label@JOINSERVER_LABEL_TITLE:
X:0
@@ -23,48 +23,30 @@ Background@JOINSERVER_BG:
Checkbox@WAITING_FOR_PLAYERS:
X:80
Y:50
Width:170
Width:100
Height:20
Text:Waiting For Players
Text:Waiting
Checkbox@EMPTY:
X:250
X:180
Y:50
Width:100
Height:20
Text:Empty
Checkbox@ALREADY_STARTED:
X:350
X:280
Y:50
Width:100
Height:20
Text:Already Started
DropDownButton@VERSIONS:
X:20
Y:80
Width:150
Height:25
Font:Bold
Text:All Versions
Disabled: yes
DropDownButton@MODS:
X:190
Y:80
Width:150
Height:25
Font:Bold
Text:All Mods
Disabled: yes
DropDownButton@MAPS:
X:360
Y:80
Width:150
Height:25
Font:Bold
Text:All Maps
Disabled: yes
Text:Started
Checkbox@INCOMPATIBLE_VERSION:
X:380
Y:50
Width:100
Height:20
Text:Incompatible
ScrollPanel@SERVER_LIST:
X:20
Y:110
Y:80
Width:500
Height:355
Children: