Split collection toggle menu item to own class

This commit is contained in:
Salman Ahmed
2022-07-08 01:39:43 +03:00
parent b9acdcdbe2
commit a94fb62be3
2 changed files with 21 additions and 15 deletions

View File

@ -0,0 +1,20 @@
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Collections
{
public class CollectionToggleMenuItem : ToggleMenuItem
{
public CollectionToggleMenuItem(BeatmapCollection collection, IBeatmapInfo beatmap)
: base(collection.Name.Value, MenuItemType.Standard, s =>
{
if (s)
collection.BeatmapHashes.Add(beatmap.MD5Hash);
else
collection.BeatmapHashes.Remove(beatmap.MD5Hash);
})
{
State.Value = collection.BeatmapHashes.Contains(beatmap.MD5Hash);
}
}
}