mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Convert realm data propagation to more correctly use Live<T>
wip
This commit is contained in:
@ -2,22 +2,26 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Collections
|
||||
{
|
||||
public class CollectionToggleMenuItem : ToggleMenuItem
|
||||
{
|
||||
public CollectionToggleMenuItem(BeatmapCollection collection, IBeatmapInfo beatmap)
|
||||
: base(collection.Name, MenuItemType.Standard, state =>
|
||||
public CollectionToggleMenuItem(Live<BeatmapCollection> collection, IBeatmapInfo beatmap)
|
||||
: base(collection.PerformRead(c => c.Name), MenuItemType.Standard, state =>
|
||||
{
|
||||
if (state)
|
||||
collection.BeatmapMD5Hashes.Add(beatmap.MD5Hash);
|
||||
else
|
||||
collection.BeatmapMD5Hashes.Remove(beatmap.MD5Hash);
|
||||
collection.PerformWrite(c =>
|
||||
{
|
||||
if (state)
|
||||
c.BeatmapMD5Hashes.Add(beatmap.MD5Hash);
|
||||
else
|
||||
c.BeatmapMD5Hashes.Remove(beatmap.MD5Hash);
|
||||
});
|
||||
})
|
||||
{
|
||||
State.Value = collection.BeatmapMD5Hashes.Contains(beatmap.MD5Hash);
|
||||
State.Value = collection.PerformRead(c => c.BeatmapMD5Hashes.Contains(beatmap.MD5Hash));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user