mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Remove redundant multiple previews handling from PaginatedBeatmapContainer
This commit is contained in:
@ -1,14 +1,13 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System.Linq;
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using System.Linq;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||||
{
|
{
|
||||||
@ -18,10 +17,6 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
|
|
||||||
private readonly BeatmapSetType type;
|
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.")
|
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
||||||
: base(user, header, missing)
|
: base(user, header, missing)
|
||||||
{
|
{
|
||||||
@ -56,28 +51,10 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
|
|
||||||
var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
|
var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
|
||||||
ItemsContainer.Add(panel);
|
ItemsContainer.Add(panel);
|
||||||
|
|
||||||
panel.PreviewPlaying.ValueChanged += isPlaying =>
|
|
||||||
{
|
|
||||||
StopPlayingPreview();
|
|
||||||
|
|
||||||
if (isPlaying)
|
|
||||||
{
|
|
||||||
BeganPlayingPreview?.Invoke(this);
|
|
||||||
currentlyPlaying = panel;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Api.Queue(req);
|
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>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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.Online.API.Requests;
|
||||||
using osu.Game.Overlays.Profile.Sections.Beatmaps;
|
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.Unranked, User, "Pending Beatmaps"),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded 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();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user