mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Merge pull request #29428 from peppy/update-editor-menu-items-difficulty-change
Ensure the "Change Difficulty" menu uses up-to-date difficulty names
This commit is contained in:
commit
52c1858bbe
@ -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