Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#327 Map search across all maps #328

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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