2019-08-08 17:18:26 +08:00
|
|
|
|
// 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;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Online.Multiplayer;
|
|
|
|
|
using osu.Game.Screens.Multi.Match.Components;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.MathUtils;
|
2019-08-08 17:25:46 +08:00
|
|
|
|
using osu.Game.Audio;
|
|
|
|
|
using osu.Framework.Allocation;
|
2019-08-08 17:18:26 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Multiplayer
|
|
|
|
|
{
|
2019-08-08 17:25:46 +08:00
|
|
|
|
public class TestSceneMatchBeatmapPanel : MultiplayerTestScene, IPreviewTrackOwner
|
2019-08-08 17:18:26 +08:00
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(MatchBeatmapPanel)
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-08 17:25:46 +08:00
|
|
|
|
[Resolved]
|
2019-08-12 14:50:49 +08:00
|
|
|
|
private PreviewTrackManager previewTrackManager { get; set; }
|
2019-08-08 17:25:46 +08:00
|
|
|
|
|
2019-08-08 17:18:26 +08:00
|
|
|
|
public TestSceneMatchBeatmapPanel()
|
|
|
|
|
{
|
|
|
|
|
Add(new MatchBeatmapPanel
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
});
|
|
|
|
|
|
2019-08-08 17:25:46 +08:00
|
|
|
|
Room.Playlist.Add(new PlaylistItem { Beatmap = new BeatmapInfo { OnlineBeatmapID = 1763072 } });
|
|
|
|
|
Room.Playlist.Add(new PlaylistItem { Beatmap = new BeatmapInfo { OnlineBeatmapID = 2101557 } });
|
|
|
|
|
Room.Playlist.Add(new PlaylistItem { Beatmap = new BeatmapInfo { OnlineBeatmapID = 1973466 } });
|
|
|
|
|
Room.Playlist.Add(new PlaylistItem { Beatmap = new BeatmapInfo { OnlineBeatmapID = 2109801 } });
|
|
|
|
|
Room.Playlist.Add(new PlaylistItem { Beatmap = new BeatmapInfo { OnlineBeatmapID = 1922035 } });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
2019-08-08 17:18:26 +08:00
|
|
|
|
|
2019-08-08 17:25:46 +08:00
|
|
|
|
AddStep("Select random beatmap", () =>
|
|
|
|
|
{
|
|
|
|
|
Room.CurrentItem.Value = Room.Playlist[RNG.Next(Room.Playlist.Count)];
|
2019-08-12 14:50:49 +08:00
|
|
|
|
previewTrackManager.StopAnyPlaying(this);
|
2019-08-08 17:25:46 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
2019-08-08 17:18:26 +08:00
|
|
|
|
|
2019-08-08 17:25:46 +08:00
|
|
|
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
|
{
|
|
|
|
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
|
|
|
dependencies.CacheAs<IPreviewTrackOwner>(this);
|
|
|
|
|
return dependencies;
|
2019-08-08 17:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|