1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 05:22:48 +08:00
Files
osu-lazer/osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/MatchmakingSelectPanelRandom.cs
T
maarvin 8b778e8106 Split quickplay beatmap & "random" panel into separate classes (V2) (#35701)
* Load all beatmaps in bulk for SubScreenBeatmapSelect

* Fix tests no longer working due to drawable changes

* Remove test that no longer makes sense

* Split matchmaking panel into subclasses for each panel type

* Adjust tests to match new structure

* Add `ConfigureAwait`

* Display loading spinner while beatmaps are being fetched

* Fix test failure

* Load playlist items directly in `LoadComplete`

* Convert `MatchmakingSelectPanel` card content classes into nested classes

* Wait for panels to be loaded before operating on them

* Add ConfigureAwait()

---------

Co-authored-by: Dan Balasescu <smoogipoo@smgi.me>
2025-11-17 14:11:07 +09:00

61 lines
1.7 KiB
C#

// 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 System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
{
public partial class MatchmakingSelectPanelRandom : MatchmakingSelectPanel
{
public MatchmakingSelectPanelRandom(MultiplayerPlaylistItem item)
: base(item)
{
}
private CardContent content = null!;
private readonly List<APIUser> users = new List<APIUser>();
[BackgroundDependencyLoader]
private void load()
{
Add(content = new CardContentRandom());
}
public void RevealBeatmap(APIBeatmap beatmap, Mod[] mods)
{
content.Expire();
var flashLayer = new Box { RelativeSizeAxes = Axes.Both };
AddRange(new Drawable[]
{
content = new CardContentBeatmap(beatmap, mods),
flashLayer,
});
foreach (var user in users)
content.SelectionOverlay.AddUser(user);
flashLayer.FadeOutFromOne(1000, Easing.In);
}
public override void AddUser(APIUser user)
{
users.Add(user);
content.SelectionOverlay.AddUser(user);
}
public override void RemoveUser(APIUser user)
{
users.Remove(user);
content.SelectionOverlay.RemoveUser(user.Id);
}
}
}