1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 23:32:55 +08:00
osu-lazer/osu.Game/Collections/CollectionToggleMenuItem.cs
2022-07-27 18:45:33 +09:00

24 lines
807 B
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Collections
{
public class CollectionToggleMenuItem : ToggleMenuItem
{
public CollectionToggleMenuItem(RealmBeatmapCollection collection, IBeatmapInfo beatmap)
: base(collection.Name, MenuItemType.Standard, state =>
{
if (state)
collection.BeatmapMD5Hashes.Add(beatmap.MD5Hash);
else
collection.BeatmapMD5Hashes.Remove(beatmap.MD5Hash);
})
{
State.Value = collection.BeatmapMD5Hashes.Contains(beatmap.MD5Hash);
}
}
}