Skip to content

Commit a15d5b4

Browse files
committed
#327 Map search across all maps
1 parent 0a9f9d0 commit a15d5b4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

DXMainClient/DXGUI/Multiplayer/GameLobby/GameLobbyBase.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ private void AddPlayerExtraOptionForcedNotice(bool disabled, string type)
474474
string.Format("The game host has disabled {0}".L10N("UI:Main:HostDisableSection"), type) :
475475
string.Format("The game host has enabled {0}".L10N("UI:Main:HostEnableSection"), type));
476476

477-
private List<GameModeMap> GetSortedGameModeMaps()
477+
private List<GameModeMap> GetSortedGameModeMaps(bool getAll)
478478
{
479-
var gameModeMaps = gameModeMapFilter.GetGameModeMaps();
479+
var gameModeMaps = getAll ? GameModeMaps : gameModeMapFilter.GetGameModeMaps();
480480
switch ((SortDirection)UserINISettings.Instance.MapSortState.Value)
481481
{
482482
case SortDirection.Asc:
@@ -501,13 +501,14 @@ protected void ListMaps()
501501

502502
int mapIndex = -1;
503503
int skippedMapsCount = 0;
504+
bool isSearching = tbMapSearch.Text != tbMapSearch.Suggestion;
504505

505-
var isFavoriteMapsSelected = IsFavoriteMapsSelected();
506-
var maps = GetSortedGameModeMaps();
506+
bool isFavoriteMapsSelected = IsFavoriteMapsSelected();
507+
var gameModeMaps = GetSortedGameModeMaps(isSearching);
507508

508-
for (int i = 0; i < maps.Count; i++)
509+
for (int i = 0; i < gameModeMaps.Count; i++)
509510
{
510-
var gameModeMap = maps[i];
511+
var gameModeMap = gameModeMaps[i];
511512
if (tbMapSearch.Text != tbMapSearch.Suggestion)
512513
{
513514
if (!gameModeMap.Map.Name.ToUpper().Contains(tbMapSearch.Text.ToUpper()))
@@ -529,8 +530,8 @@ protected void ListMaps()
529530
rankItem.Texture = RankTextures[GetDefaultMapRankIndex(gameModeMap) + 1];
530531

531532
XNAListBoxItem mapNameItem = new XNAListBoxItem();
532-
var mapNameText = gameModeMap.Map.Name;
533-
if (isFavoriteMapsSelected)
533+
string mapNameText = gameModeMap.Map.Name;
534+
if (isFavoriteMapsSelected || isSearching)
534535
mapNameText += $" - {gameModeMap.GameMode.UIName}";
535536

536537
mapNameItem.Text = Renderer.GetSafeString(mapNameText, lbGameModeMapList.FontIndex);

0 commit comments

Comments
 (0)