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

View File

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