mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:02:55 +08:00
Remove redundant multiple previews handling from PaginatedBeatmapContainer
This commit is contained in:
parent
eda9f83836
commit
56c1c2beca
@ -1,14 +1,13 @@
|
||||
// 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 System.Linq;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Direct;
|
||||
using osu.Game.Users;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
{
|
||||
@ -18,10 +17,6 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
private readonly BeatmapSetType type;
|
||||
|
||||
private DirectPanel currentlyPlaying;
|
||||
|
||||
public event Action<PaginatedBeatmapContainer> BeganPlayingPreview;
|
||||
|
||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
||||
: base(user, header, missing)
|
||||
{
|
||||
@ -56,28 +51,10 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
|
||||
ItemsContainer.Add(panel);
|
||||
|
||||
panel.PreviewPlaying.ValueChanged += isPlaying =>
|
||||
{
|
||||
StopPlayingPreview();
|
||||
|
||||
if (isPlaying)
|
||||
{
|
||||
BeganPlayingPreview?.Invoke(this);
|
||||
currentlyPlaying = panel;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Api.Queue(req);
|
||||
}
|
||||
|
||||
public void StopPlayingPreview()
|
||||
{
|
||||
if (currentlyPlaying == null) return;
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
currentlyPlaying = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Profile.Sections.Beatmaps;
|
||||
|
||||
@ -22,15 +21,6 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
|
||||
};
|
||||
|
||||
foreach (var paginatedBeatmapContainer in Children.OfType<PaginatedBeatmapContainer>())
|
||||
{
|
||||
paginatedBeatmapContainer.BeganPlayingPreview += _ =>
|
||||
{
|
||||
foreach (var bc in Children.OfType<PaginatedBeatmapContainer>())
|
||||
bc.StopPlayingPreview();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user