osu/osu.Game/Collections/CollectionToggleMenuItem.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
802 B
C#
Raw Normal View History

2022-07-07 22:59:27 +00:00
// 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(BeatmapCollection collection, IBeatmapInfo beatmap)
2022-07-27 06:59:36 +00:00
: base(collection.Name, MenuItemType.Standard, state =>
{
2022-07-15 04:44:56 +00:00
if (state)
2022-07-27 06:59:36 +00:00
collection.BeatmapMD5Hashes.Add(beatmap.MD5Hash);
else
2022-07-27 06:59:36 +00:00
collection.BeatmapMD5Hashes.Remove(beatmap.MD5Hash);
})
{
2022-07-27 06:59:36 +00:00
State.Value = collection.BeatmapMD5Hashes.Contains(beatmap.MD5Hash);
}
}
}