Skip to content

Commit

Permalink
fix difficulty order
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratismal committed Apr 21, 2021
1 parent 72fdc26 commit 8d5abe0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion CustomBeats/CustomBeatsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ void LoadSongs()
{
songs = new List<string>();
beatmaps = new List<BeatmapInfo>();
string[] defaultDifficulties = new[]
{
"Beginner",
"Easy",
"Normal",
"Hard",
"UNBEATABLE",
"Trailer",
"Tutorial"
};
difficulties = new List<string>();

string customSongDir = $"{Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'))}/CustomBeats/Songs/";
Expand All @@ -77,7 +87,7 @@ void LoadSongs()
asset.name = beatmapName;
var difficultyMatch = Regex.Match(content, "Version: *(.+?)\r?\n");
string difficulty = difficultyMatch.Groups[1].Value;
if (!difficulties.Contains(difficulty))
if (!defaultDifficulties.Contains(difficulty) && !difficulties.Contains(difficulty))
{
difficulties.Add(difficulty);
}
Expand All @@ -100,6 +110,12 @@ void LoadSongs()
}
}

var allDifficulties = defaultDifficulties.Concat(difficulties).ToList();
beatmaps.Sort(delegate(BeatmapInfo x, BeatmapInfo y)
{
return allDifficulties.IndexOf(x.difficulty) - allDifficulties.IndexOf(y.difficulty);
});

dirty = true;
}

Expand Down
4 changes: 2 additions & 2 deletions CustomBeats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

0 comments on commit 8d5abe0

Please sign in to comment.