mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Split collection toggle menu item to own class
This commit is contained in:
20
osu.Game/Collections/CollectionToggleMenuItem.cs
Normal file
20
osu.Game/Collections/CollectionToggleMenuItem.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user