2019-03-05 08:14:30 +00: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.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-06-12 17:42:52 +00:00
|
|
|
using osu.Game.Beatmaps;
|
2019-03-05 08:14:30 +00:00
|
|
|
using osu.Game.Overlays.Direct;
|
2019-06-12 17:42:52 +00:00
|
|
|
using osu.Game.Rulesets;
|
2019-06-27 04:48:57 +00:00
|
|
|
using osu.Game.Users;
|
2019-03-05 08:14:30 +00:00
|
|
|
using osuTK;
|
|
|
|
|
2019-03-24 16:02:36 +00:00
|
|
|
namespace osu.Game.Tests.Visual.Online
|
2019-03-05 08:14:30 +00:00
|
|
|
{
|
2019-05-14 19:37:25 +00:00
|
|
|
public class TestSceneDirectPanel : OsuTestScene
|
2019-03-05 08:14:30 +00:00
|
|
|
{
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
{
|
|
|
|
typeof(DirectGridPanel),
|
|
|
|
typeof(DirectListPanel),
|
|
|
|
typeof(IconPill)
|
|
|
|
};
|
|
|
|
|
2019-08-23 21:31:36 +00:00
|
|
|
private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo
|
2019-06-12 17:42:52 +00:00
|
|
|
{
|
2019-06-27 04:48:57 +00:00
|
|
|
OnlineBeatmapSetID = 123,
|
|
|
|
Metadata = new BeatmapMetadata
|
2019-06-12 17:42:52 +00:00
|
|
|
{
|
2019-06-27 04:48:57 +00:00
|
|
|
Title = "undownloadable beatmap",
|
|
|
|
Artist = "test",
|
|
|
|
Source = "more tests",
|
|
|
|
Author = new User
|
|
|
|
{
|
|
|
|
Username = "BanchoBot",
|
|
|
|
Id = 3,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
OnlineInfo = new BeatmapSetOnlineInfo
|
|
|
|
{
|
|
|
|
Availability = new BeatmapSetOnlineAvailability
|
|
|
|
{
|
|
|
|
DownloadDisabled = true,
|
|
|
|
},
|
|
|
|
Preview = @"https://b.ppy.sh/preview/12345.mp3",
|
|
|
|
PlayCount = 123,
|
|
|
|
FavouriteCount = 456,
|
|
|
|
BPM = 111,
|
|
|
|
HasVideo = true,
|
|
|
|
HasStoryboard = true,
|
|
|
|
Covers = new BeatmapSetOnlineCovers(),
|
|
|
|
},
|
|
|
|
Beatmaps = new List<BeatmapInfo>
|
|
|
|
{
|
|
|
|
new BeatmapInfo
|
|
|
|
{
|
2019-08-23 21:31:36 +00:00
|
|
|
Ruleset = Ruleset.Value,
|
2019-06-27 04:48:57 +00:00
|
|
|
Version = "Test",
|
|
|
|
StarDifficulty = 6.42,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-06-12 17:42:52 +00:00
|
|
|
|
2019-08-23 21:31:36 +00:00
|
|
|
private BeatmapSetInfo getManyDifficultiesBeatmapSet(RulesetStore rulesets)
|
2019-03-05 08:14:30 +00:00
|
|
|
{
|
2019-08-23 21:31:36 +00:00
|
|
|
var beatmaps = new List<BeatmapInfo>();
|
|
|
|
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
{
|
|
|
|
beatmaps.Add(new BeatmapInfo
|
|
|
|
{
|
|
|
|
Ruleset = rulesets.GetRuleset(i % 4),
|
|
|
|
StarDifficulty = 2 + i % 4 * 2,
|
|
|
|
BaseDifficulty = new BeatmapDifficulty
|
|
|
|
{
|
|
|
|
OverallDifficulty = 3.5f,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-06-12 17:42:52 +00:00
|
|
|
|
2019-08-23 21:31:36 +00:00
|
|
|
return new BeatmapSetInfo
|
|
|
|
{
|
|
|
|
OnlineBeatmapSetID = 1,
|
|
|
|
Metadata = new BeatmapMetadata
|
|
|
|
{
|
|
|
|
Title = "many difficulties beatmap",
|
|
|
|
Artist = "test",
|
|
|
|
Author = new User
|
|
|
|
{
|
|
|
|
Username = "BanchoBot",
|
|
|
|
Id = 3,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
OnlineInfo = new BeatmapSetOnlineInfo
|
|
|
|
{
|
|
|
|
HasVideo = true,
|
|
|
|
HasStoryboard = true,
|
|
|
|
Covers = new BeatmapSetOnlineCovers(),
|
|
|
|
},
|
|
|
|
Beatmaps = beatmaps,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(RulesetStore rulesets)
|
|
|
|
{
|
|
|
|
var normal = CreateWorkingBeatmap(Ruleset.Value).BeatmapSetInfo;
|
2019-06-12 17:42:52 +00:00
|
|
|
normal.OnlineInfo.HasVideo = true;
|
|
|
|
normal.OnlineInfo.HasStoryboard = true;
|
|
|
|
|
2019-08-23 21:31:36 +00:00
|
|
|
var undownloadable = getUndownloadableBeatmapSet();
|
|
|
|
var manyDifficulties = getManyDifficultiesBeatmapSet(rulesets);
|
2019-03-05 08:14:30 +00:00
|
|
|
|
2019-06-20 15:57:52 +00:00
|
|
|
Child = new BasicScrollContainer
|
2019-03-05 08:14:30 +00:00
|
|
|
{
|
2019-06-20 15:57:52 +00:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Child = new FillFlowContainer
|
2019-03-05 08:14:30 +00:00
|
|
|
{
|
2019-06-20 15:57:52 +00:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2019-08-23 21:31:36 +00:00
|
|
|
Direction = FillDirection.Full,
|
2019-06-20 15:57:52 +00:00
|
|
|
Padding = new MarginPadding(20),
|
2019-08-23 21:31:36 +00:00
|
|
|
Spacing = new Vector2(5, 20),
|
2019-06-20 15:57:52 +00:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new DirectGridPanel(normal),
|
2019-06-27 04:35:14 +00:00
|
|
|
new DirectGridPanel(undownloadable),
|
2019-08-23 21:31:36 +00:00
|
|
|
new DirectGridPanel(manyDifficulties),
|
|
|
|
new DirectListPanel(normal),
|
2019-06-27 04:35:14 +00:00
|
|
|
new DirectListPanel(undownloadable),
|
2019-08-23 21:31:36 +00:00
|
|
|
new DirectListPanel(manyDifficulties),
|
2019-06-20 15:57:52 +00:00
|
|
|
},
|
2019-06-12 17:42:52 +00:00
|
|
|
},
|
2019-03-05 08:14:30 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|