made filters and ping button optional
This commit is contained in:
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
bool showWaiting = true;
|
bool showWaiting = true;
|
||||||
bool showEmpty = true;
|
bool showEmpty = true;
|
||||||
bool showStarted = false;
|
bool showStarted = true;
|
||||||
bool showCompatibleVersionsOnly = false;
|
bool showCompatibleVersionsOnly = false;
|
||||||
bool showThisModOnly = false;
|
bool showThisModOnly = false;
|
||||||
|
|
||||||
@@ -59,10 +59,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
refreshButton.IsDisabled = () => searchStatus == SearchStatus.Fetching;
|
refreshButton.IsDisabled = () => searchStatus == SearchStatus.Fetching;
|
||||||
refreshButton.OnClick = () => ServerList.Query(games => RefreshServerList(panel, games));
|
refreshButton.OnClick = () => ServerList.Query(games => RefreshServerList(panel, games));
|
||||||
|
|
||||||
var pingButton = panel.Get<ButtonWidget>("PING_BUTTON");
|
var pingButton = panel.GetOrNull<ButtonWidget>("PING_BUTTON");
|
||||||
pingButton.IsDisabled = () => searchStatus == SearchStatus.Pinging ||
|
if (pingButton != null)
|
||||||
searchStatus == SearchStatus.Fetching || searchStatus == SearchStatus.Failed;
|
{
|
||||||
pingButton.OnClick = () => ServerList.Query(games => PingServerList(panel, games));
|
pingButton.IsDisabled = () => searchStatus == SearchStatus.Pinging ||
|
||||||
|
searchStatus == SearchStatus.Fetching || searchStatus == SearchStatus.Failed;
|
||||||
|
pingButton.OnClick = () => ServerList.Query(games => PingServerList(panel, games));
|
||||||
|
}
|
||||||
|
|
||||||
var join = panel.Get<ButtonWidget>("JOIN_BUTTON");
|
var join = panel.Get<ButtonWidget>("JOIN_BUTTON");
|
||||||
join.IsDisabled = () => currentServer == null || !currentServer.CanJoin();
|
join.IsDisabled = () => currentServer == null || !currentServer.CanJoin();
|
||||||
@@ -79,25 +82,40 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
progressText.IsVisible = () => searchStatus != SearchStatus.Hidden;
|
progressText.IsVisible = () => searchStatus != SearchStatus.Hidden;
|
||||||
progressText.GetText = ProgressLabelText;
|
progressText.GetText = ProgressLabelText;
|
||||||
|
|
||||||
var showWaitingCheckbox = panel.Get<CheckboxWidget>("WAITING_FOR_PLAYERS");
|
var showWaitingCheckbox = panel.GetOrNull<CheckboxWidget>("WAITING_FOR_PLAYERS");
|
||||||
showWaitingCheckbox.IsChecked = () => showWaiting;
|
if (showWaitingCheckbox != null)
|
||||||
showWaitingCheckbox.OnClick = () => { showWaiting ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
{
|
||||||
|
showWaitingCheckbox.IsChecked = () => showWaiting;
|
||||||
|
showWaitingCheckbox.OnClick = () => { showWaiting ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
||||||
|
}
|
||||||
|
|
||||||
var showEmptyCheckbox = panel.Get<CheckboxWidget>("EMPTY");
|
var showEmptyCheckbox = panel.GetOrNull<CheckboxWidget>("EMPTY");
|
||||||
showEmptyCheckbox.IsChecked = () => showEmpty;
|
if (showEmptyCheckbox != null)
|
||||||
showEmptyCheckbox.OnClick = () => { showEmpty ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
{
|
||||||
|
showEmptyCheckbox.IsChecked = () => showEmpty;
|
||||||
|
showEmptyCheckbox.OnClick = () => { showEmpty ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
||||||
|
}
|
||||||
|
|
||||||
var showAlreadyStartedCheckbox = panel.Get<CheckboxWidget>("ALREADY_STARTED");
|
var showAlreadyStartedCheckbox = panel.GetOrNull<CheckboxWidget>("ALREADY_STARTED");
|
||||||
showAlreadyStartedCheckbox.IsChecked = () => showStarted;
|
if (showAlreadyStartedCheckbox != null)
|
||||||
showAlreadyStartedCheckbox.OnClick = () => { showStarted ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
{
|
||||||
|
showAlreadyStartedCheckbox.IsChecked = () => showStarted;
|
||||||
|
showAlreadyStartedCheckbox.OnClick = () => { showStarted ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
||||||
|
}
|
||||||
|
|
||||||
var showCompatibleVersionsOnlyCheckbox = panel.Get<CheckboxWidget>("COMPATIBLE_VERSION");
|
var showCompatibleVersionsOnlyCheckbox = panel.GetOrNull<CheckboxWidget>("COMPATIBLE_VERSION");
|
||||||
showCompatibleVersionsOnlyCheckbox.IsChecked = () => showCompatibleVersionsOnly;
|
if (showCompatibleVersionsOnlyCheckbox != null)
|
||||||
showCompatibleVersionsOnlyCheckbox.OnClick = () => { showCompatibleVersionsOnly ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
{
|
||||||
|
showCompatibleVersionsOnlyCheckbox.IsChecked = () => showCompatibleVersionsOnly;
|
||||||
|
showCompatibleVersionsOnlyCheckbox.OnClick = () => { showCompatibleVersionsOnly ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
||||||
|
}
|
||||||
|
|
||||||
var showThisModOnlyCheckbox = panel.Get<CheckboxWidget>("THIS_MOD");
|
var showThisModOnlyCheckbox = panel.GetOrNull<CheckboxWidget>("THIS_MOD");
|
||||||
showThisModOnlyCheckbox.IsChecked = () => showThisModOnly;
|
if (showThisModOnlyCheckbox != null)
|
||||||
showThisModOnlyCheckbox.OnClick = () => { showThisModOnly ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
{
|
||||||
|
showThisModOnlyCheckbox.IsChecked = () => showThisModOnly;
|
||||||
|
showThisModOnlyCheckbox.OnClick = () => { showThisModOnly ^= true; ServerList.Query(games => RefreshServerList(panel, games)); };
|
||||||
|
}
|
||||||
|
|
||||||
ServerList.Query(games => RefreshServerList(panel, games));
|
ServerList.Query(games => RefreshServerList(panel, games));
|
||||||
}
|
}
|
||||||
@@ -262,9 +280,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
version.GetText = () => GenerateModsLabel(game);
|
version.GetText = () => GenerateModsLabel(game);
|
||||||
version.IsVisible = () => !game.CompatibleVersion();
|
version.IsVisible = () => !game.CompatibleVersion();
|
||||||
|
|
||||||
var ping = item.Get<LabelWidget>("PING");
|
var ping = item.GetOrNull<LabelWidget>("PING");
|
||||||
ping.GetText = () => GetPing(game);
|
if (ping != null)
|
||||||
ping.IsVisible = () => game.CompatibleVersion();
|
{
|
||||||
|
ping.GetText = () => GetPing(game);
|
||||||
|
ping.IsVisible = () => game.CompatibleVersion();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Display game.Location once https://github.com/OpenRA/OpenRAMasterServer/pull/12 is merged
|
// TODO: Display game.Location once https://github.com/OpenRA/OpenRAMasterServer/pull/12 is merged
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user