mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-21 16:04:40 +00:00
Fix an issue where hidden difficulties could end up in the difficulty list.
This commit is contained in:
parent
70975cdb59
commit
105aca4707
|
@ -367,11 +367,14 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all the difficulties in this song.
|
* List all the difficulties in this song.
|
||||||
|
*
|
||||||
* @param variationId Optionally filter by a single variation.
|
* @param variationId Optionally filter by a single variation.
|
||||||
* @param variationIds Optionally filter by multiple variations.
|
* @param variationIds Optionally filter by multiple variations.
|
||||||
|
* @param showHidden Include charts which are not accessible to the player.
|
||||||
|
*
|
||||||
* @return The list of difficulties.
|
* @return The list of difficulties.
|
||||||
*/
|
*/
|
||||||
public function listDifficulties(?variationId:String, ?variationIds:Array<String>):Array<String>
|
public function listDifficulties(?variationId:String, ?variationIds:Array<String>, showHidden:Bool = false):Array<String>
|
||||||
{
|
{
|
||||||
if (variationIds == null) variationIds = [];
|
if (variationIds == null) variationIds = [];
|
||||||
if (variationId != null) variationIds.push(variationId);
|
if (variationId != null) variationIds.push(variationId);
|
||||||
|
@ -387,6 +390,15 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
||||||
return difficulty.difficulty;
|
return difficulty.difficulty;
|
||||||
}).nonNull().unique();
|
}).nonNull().unique();
|
||||||
|
|
||||||
|
diffFiltered = diffFiltered.filter(function(diffId:String):Bool {
|
||||||
|
if (showHidden) return true;
|
||||||
|
for (targetVariation in variationIds)
|
||||||
|
{
|
||||||
|
if (isDifficultyVisible(diffId, targetVariation)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
diffFiltered.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST));
|
diffFiltered.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST));
|
||||||
|
|
||||||
return diffFiltered;
|
return diffFiltered;
|
||||||
|
@ -405,6 +417,13 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isDifficultyVisible(diffId:String, variationId:String):Bool
|
||||||
|
{
|
||||||
|
var variation = _metadata.get(variationId);
|
||||||
|
if (variation == null) return false;
|
||||||
|
return variation.playData.difficulties.contains(diffId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge the cached chart data for each difficulty of this song.
|
* Purge the cached chart data for each difficulty of this song.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue