mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Handle multiple song previews playing in different beatmap categories on profile
This commit is contained in:
parent
81981acc68
commit
640be621ac
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -19,6 +20,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
private DirectPanel currentlyPlaying;
|
||||
|
||||
public event Action<DirectGridPanel> BeatmapAdded;
|
||||
|
||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
||||
: base(user, header, missing)
|
||||
{
|
||||
@ -63,6 +66,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
currentlyPlaying = panel;
|
||||
};
|
||||
BeatmapAdded?.Invoke(panel);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Direct;
|
||||
using osu.Game.Overlays.Profile.Sections.Beatmaps;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections
|
||||
@ -12,6 +14,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
|
||||
public override string Identifier => "beatmaps";
|
||||
|
||||
private DirectPanel currentlyPlaying;
|
||||
|
||||
public BeatmapsSection()
|
||||
{
|
||||
Children = new[]
|
||||
@ -21,6 +25,19 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
|
||||
};
|
||||
|
||||
foreach (var beatmapContainer in Children.OfType<PaginatedBeatmapContainer>())
|
||||
{
|
||||
beatmapContainer.BeatmapAdded += panel => panel.PreviewPlaying.ValueChanged += isPlaying =>
|
||||
{
|
||||
if (!isPlaying) return;
|
||||
|
||||
if (currentlyPlaying != null && currentlyPlaying != panel)
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
|
||||
currentlyPlaying = panel;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user