mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-22 23:57:50 -05:00
Merge branch 'ninjamuffin99/funk-269' into rewrite/master
This commit is contained in:
commit
cb773ed137
1 changed files with 13 additions and 0 deletions
|
@ -804,6 +804,13 @@ class FreeplayState extends MusicBeatSubState
|
||||||
*/
|
*/
|
||||||
public function sortSongs(songsToFilter:Array<FreeplaySongData>, songFilter:SongFilter):Array<FreeplaySongData>
|
public function sortSongs(songsToFilter:Array<FreeplaySongData>, songFilter:SongFilter):Array<FreeplaySongData>
|
||||||
{
|
{
|
||||||
|
var filterAlphabetically = function(a:FreeplaySongData, b:FreeplaySongData):Int {
|
||||||
|
if (a?.songName.toLowerCase() < b?.songName.toLowerCase()) return -1;
|
||||||
|
else if (a?.songName.toLowerCase() > b?.songName.toLowerCase()) return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
switch (songFilter.filterType)
|
switch (songFilter.filterType)
|
||||||
{
|
{
|
||||||
case REGEXP:
|
case REGEXP:
|
||||||
|
@ -818,6 +825,8 @@ class FreeplayState extends MusicBeatSubState
|
||||||
return filterRegexp.match(str.songName);
|
return filterRegexp.match(str.songName);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
songsToFilter.sort(filterAlphabetically);
|
||||||
|
|
||||||
case STARTSWITH:
|
case STARTSWITH:
|
||||||
// extra note: this is essentially a "search"
|
// extra note: this is essentially a "search"
|
||||||
|
|
||||||
|
@ -832,9 +841,13 @@ class FreeplayState extends MusicBeatSubState
|
||||||
if (str == null) return true; // Random
|
if (str == null) return true; // Random
|
||||||
return str.isFav;
|
return str.isFav;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
songsToFilter.sort(filterAlphabetically);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// return all on default
|
// return all on default
|
||||||
}
|
}
|
||||||
|
|
||||||
return songsToFilter;
|
return songsToFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue