Skip to content

Commit

Permalink
#327 Map search across all maps
Browse files Browse the repository at this point in the history
  • Loading branch information
devo1929 committed Apr 21, 2022
1 parent 0a9f9d0 commit 72061ec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions DXMainClient/DXGUI/Multiplayer/GameLobby/GameLobbyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ private void AddPlayerExtraOptionForcedNotice(bool disabled, string type)
string.Format("The game host has disabled {0}".L10N("UI:Main:HostDisableSection"), type) :
string.Format("The game host has enabled {0}".L10N("UI:Main:HostEnableSection"), type));

private List<GameModeMap> GetSortedGameModeMaps()
private List<GameModeMap> GetSortedGameModeMaps(bool getAll)
{
var gameModeMaps = gameModeMapFilter.GetGameModeMaps();
var gameModeMaps = getAll ? GameModeMaps : gameModeMapFilter.GetGameModeMaps();
switch ((SortDirection)UserINISettings.Instance.MapSortState.Value)
{
case SortDirection.Asc:
Expand All @@ -501,13 +501,13 @@ protected void ListMaps()

int mapIndex = -1;
int skippedMapsCount = 0;
bool isSearching = tbMapSearch.Text != tbMapSearch.Suggestion;
bool showGameModeName = isSearching || IsFavoriteMapsSelected();
var gameModeMaps = GetSortedGameModeMaps(isSearching);

var isFavoriteMapsSelected = IsFavoriteMapsSelected();
var maps = GetSortedGameModeMaps();

for (int i = 0; i < maps.Count; i++)
for (int i = 0; i < gameModeMaps.Count; i++)
{
var gameModeMap = maps[i];
var gameModeMap = gameModeMaps[i];
if (tbMapSearch.Text != tbMapSearch.Suggestion)
{
if (!gameModeMap.Map.Name.ToUpper().Contains(tbMapSearch.Text.ToUpper()))
Expand All @@ -529,8 +529,8 @@ protected void ListMaps()
rankItem.Texture = RankTextures[GetDefaultMapRankIndex(gameModeMap) + 1];

XNAListBoxItem mapNameItem = new XNAListBoxItem();
var mapNameText = gameModeMap.Map.Name;
if (isFavoriteMapsSelected)
string mapNameText = gameModeMap.Map.Name;
if (showGameModeName)
mapNameText += $" - {gameModeMap.GameMode.UIName}";

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

0 comments on commit 72061ec

Please sign in to comment.