2016-10-19 09:00:35 +00:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2016-10-26 08:26:26 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-11-28 02:38:32 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-10-19 09:00:35 +00:00
|
|
|
|
using osu.Framework.GameModes.Testing;
|
|
|
|
|
using osu.Framework.MathUtils;
|
2016-10-26 08:26:26 +00:00
|
|
|
|
using osu.Framework.Timing;
|
2016-10-19 09:00:35 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2016-11-02 09:08:08 +00:00
|
|
|
|
using osu.Game.Beatmaps.Formats;
|
2016-10-26 08:26:26 +00:00
|
|
|
|
using OpenTK;
|
2016-11-17 12:29:35 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-11-28 02:38:32 +00:00
|
|
|
|
using osu.Game.Database;
|
|
|
|
|
using osu.Game.Modes;
|
2016-11-14 09:03:20 +00:00
|
|
|
|
using osu.Game.Modes.Objects;
|
2016-11-14 09:54:24 +00:00
|
|
|
|
using osu.Game.Modes.Osu.Objects;
|
2016-11-14 08:23:33 +00:00
|
|
|
|
using osu.Game.Screens.Play;
|
2016-11-17 12:29:35 +00:00
|
|
|
|
using OpenTK.Graphics;
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2016-10-26 08:26:26 +00:00
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
|
|
|
|
class TestCasePlayer : TestCase
|
|
|
|
|
{
|
2016-11-28 02:38:32 +00:00
|
|
|
|
private WorkingBeatmap beatmap;
|
2016-10-19 09:00:35 +00:00
|
|
|
|
public override string Name => @"Player";
|
|
|
|
|
|
|
|
|
|
public override string Description => @"Showing everything to play the game.";
|
|
|
|
|
|
2016-11-28 02:38:32 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(BeatmapDatabase db)
|
|
|
|
|
{
|
2017-01-24 07:01:49 +00:00
|
|
|
|
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
|
|
|
|
|
if (beatmapInfo != null)
|
|
|
|
|
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
2016-11-28 02:38:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-19 09:00:35 +00:00
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-01-24 08:12:31 +00:00
|
|
|
|
if (beatmap?.Track == null)
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2016-11-28 02:38:32 +00:00
|
|
|
|
var objects = new List<HitObject>();
|
|
|
|
|
|
|
|
|
|
int time = 1500;
|
|
|
|
|
for (int i = 0; i < 50; i++)
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2016-11-28 02:38:32 +00:00
|
|
|
|
objects.Add(new HitCircle()
|
|
|
|
|
{
|
|
|
|
|
StartTime = time,
|
|
|
|
|
Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512,
|
|
|
|
|
i % 4 < 2 ? 0 : 384),
|
|
|
|
|
NewCombo = i % 4 == 0
|
|
|
|
|
});
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2016-11-28 02:38:32 +00:00
|
|
|
|
time += 500;
|
|
|
|
|
}
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2016-11-28 02:38:32 +00:00
|
|
|
|
var decoder = new ConstructableBeatmapDecoder();
|
2016-11-02 09:08:08 +00:00
|
|
|
|
|
2016-11-28 02:38:32 +00:00
|
|
|
|
Beatmap b = new Beatmap
|
|
|
|
|
{
|
|
|
|
|
HitObjects = objects
|
|
|
|
|
};
|
2016-11-02 09:08:08 +00:00
|
|
|
|
|
2016-11-28 02:38:32 +00:00
|
|
|
|
decoder.Process(b);
|
|
|
|
|
|
|
|
|
|
beatmap = new WorkingBeatmap(b);
|
|
|
|
|
}
|
2016-11-02 09:08:08 +00:00
|
|
|
|
|
2016-11-17 12:29:35 +00:00
|
|
|
|
Add(new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Framework.Graphics.Axes.Both,
|
|
|
|
|
Colour = Color4.Gray,
|
|
|
|
|
});
|
|
|
|
|
|
2016-11-08 23:13:20 +00:00
|
|
|
|
Add(new Player
|
|
|
|
|
{
|
2016-11-28 02:38:32 +00:00
|
|
|
|
PreferredPlayMode = PlayMode.Osu,
|
|
|
|
|
Beatmap = beatmap
|
2016-11-08 23:13:20 +00:00
|
|
|
|
});
|
2016-10-19 09:00:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|