mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 11:12:55 +08:00
Ensure the "Change Difficulty" menu uses up-to-date difficulty names
Closes https://github.com/ppy/osu/issues/29391.
This commit is contained in:
parent
4b279ecaa8
commit
b5f615882f
@ -1286,10 +1286,23 @@ namespace osu.Game.Screens.Edit
|
||||
foreach (var beatmap in rulesetBeatmaps)
|
||||
{
|
||||
bool isCurrentDifficulty = playableBeatmap.BeatmapInfo.Equals(beatmap);
|
||||
difficultyItems.Add(new DifficultyMenuItem(beatmap, isCurrentDifficulty, SwitchToDifficulty));
|
||||
var difficultyMenuItem = new DifficultyMenuItem(beatmap, isCurrentDifficulty, SwitchToDifficulty);
|
||||
difficultyItems.Add(difficultyMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure difficulty names are updated when modified in the editor.
|
||||
// Maybe we could trigger less often but this seems to work well enough.
|
||||
editorBeatmap.SaveStateTriggered += () =>
|
||||
{
|
||||
foreach (var beatmapInfo in Beatmap.Value.BeatmapSetInfo.Beatmaps)
|
||||
{
|
||||
var menuItem = difficultyItems.OfType<DifficultyMenuItem>().FirstOrDefault(i => i.BeatmapInfo.Equals(beatmapInfo));
|
||||
if (menuItem != null)
|
||||
menuItem.Text.Value = string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? "(unnamed)" : beatmapInfo.DifficultyName;
|
||||
}
|
||||
};
|
||||
|
||||
return new EditorMenuItem(EditorStrings.ChangeDifficulty) { Items = difficultyItems };
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user