fixed search handling
This commit is contained in:
1 parent
e8179fc41b
commit
3b77b4dfde
5 files changed
+41
-31
No files matched your search
@@ -152,7 +152,7 @@ namespace Vocaluxe.PartyModes
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = false;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.ShowDuetSongs = false;
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
@@ -398,7 +398,7 @@ namespace Vocaluxe.PartyModes
|
||||
public override void SetSearchString(string SearchString, bool Visible)
|
||||
{
|
||||
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = Visible;
|
||||
_ScreenSongOptions.Sorting.SearchActive = Visible;
|
||||
}
|
||||
|
||||
public override int GetMaxPlayer()
|
||||
|
||||
+10
-2
@@ -62,7 +62,7 @@ namespace Vocaluxe.Base
|
||||
get { return _SearchFilter; }
|
||||
set
|
||||
{
|
||||
if (value.Length > 0)
|
||||
if (value != String.Empty)
|
||||
{
|
||||
_Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs);
|
||||
}
|
||||
@@ -406,7 +406,15 @@ namespace Vocaluxe.Base
|
||||
_SongList.Add(song);
|
||||
else
|
||||
{
|
||||
if (song.Title.ToUpper().Contains(_SearchFilter.ToUpper()) || song.Artist.ToUpper().Contains(_SearchFilter.ToUpper()))
|
||||
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
|
||||
string[] searchStrings = _SearchFilter.ToUpper().Split(new char[]{' '});
|
||||
bool contains = searchStrings != null;
|
||||
|
||||
foreach (string str in searchStrings)
|
||||
{
|
||||
contains &= search.Contains(str);
|
||||
}
|
||||
if (contains)
|
||||
_SongList.Add(song);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
_sso = CParty.GetSongSelectionOptions();
|
||||
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.ShowDuetSongs);
|
||||
_SearchActive = _sso.Sorting.SearchStringVisible;
|
||||
_SearchActive = _sso.Sorting.SearchActive;
|
||||
_SearchText = _sso.Sorting.SearchString;
|
||||
|
||||
CGame.EnterNormalGame();
|
||||
@@ -744,8 +744,6 @@ namespace Vocaluxe.Screens
|
||||
base.OnClose();
|
||||
CBackgroundMusic.Disabled = false;
|
||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
||||
|
||||
CParty.SetSearchString(_SearchText, _SearchActive);
|
||||
}
|
||||
|
||||
public override void ApplyVolume()
|
||||
@@ -794,7 +792,7 @@ namespace Vocaluxe.Screens
|
||||
if (_sso.Selection.PartyMode)
|
||||
{
|
||||
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.ShowDuetSongs);
|
||||
_SearchActive = _sso.Sorting.SearchStringVisible;
|
||||
_SearchActive = _sso.Sorting.SearchActive;
|
||||
_SearchText = _sso.Sorting.SearchString;
|
||||
|
||||
ClosePlaylist();
|
||||
@@ -1078,31 +1076,31 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void ApplyNewSearchFilter(string NewFilterString)
|
||||
{
|
||||
int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
|
||||
int id = -1;
|
||||
if (song > -1 && song < CSongs.NumVisibleSongs)
|
||||
{
|
||||
id = CSongs.VisibleSongs[song].ID;
|
||||
}
|
||||
|
||||
CParty.SetSearchString(NewFilterString, _SearchActive);
|
||||
_sso = CParty.GetSongSelectionOptions();
|
||||
|
||||
bool refresh = false;
|
||||
_SearchText = NewFilterString;
|
||||
CSongs.SearchFilter = _SearchText;
|
||||
|
||||
if (NewFilterString != String.Empty)
|
||||
CSongs.Category = 0;
|
||||
else
|
||||
CSongs.Category = -1;
|
||||
|
||||
if (id > -1)
|
||||
int SongIndex = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
|
||||
int SongID = -1;
|
||||
if (SongIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > SongIndex)
|
||||
{
|
||||
if (CSongs.NumVisibleSongs > 0)
|
||||
{
|
||||
if (id != CSongs.VisibleSongs[0].ID)
|
||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
||||
}
|
||||
SongID = CSongs.VisibleSongs[SongIndex].ID;
|
||||
}
|
||||
|
||||
if (CSongs.NumVisibleSongs == 0)
|
||||
if (NewFilterString == String.Empty && _sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
CSongs.Category = -1;
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, NewFilterString, _sso.Sorting.ShowDuetSongs);
|
||||
|
||||
if (SongID == -1 || CSongs.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= SongIndex || CSongs.VisibleSongs[SongIndex].ID != SongID)
|
||||
refresh = true;
|
||||
|
||||
if (refresh)
|
||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
||||
|
||||
SongMenus[htSongMenus(SongMenu)].OnShow();
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Vocaluxe.PartyModes
|
||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = false;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.ShowDuetSongs = true;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace Vocaluxe.PartyModes
|
||||
{
|
||||
_ScreenSongOptions.Sorting.SongSorting = _Base.Config.GetSongSorting();
|
||||
_ScreenSongOptions.Sorting.Tabs = _Base.Config.GetTabs();
|
||||
|
||||
if (_ScreenSongOptions.Sorting.SearchActive)
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = _Base.Config.GetIgnoreArticles();
|
||||
|
||||
return _ScreenSongOptions;
|
||||
@@ -35,7 +39,7 @@ namespace Vocaluxe.PartyModes
|
||||
public override void SetSearchString(string SearchString, bool Visible)
|
||||
{
|
||||
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = Visible;
|
||||
_ScreenSongOptions.Sorting.SearchActive = Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace Vocaluxe.PartyModes
|
||||
public EOffOn Tabs;
|
||||
public EOffOn IgnoreArticles;
|
||||
public string SearchString;
|
||||
public bool SearchStringVisible;
|
||||
public bool SearchActive;
|
||||
public bool ShowDuetSongs;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user