2017-02-07 04:59:30 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2016-10-26 08:26:26 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-08-04 06:37:31 +00:00
|
|
|
|
using osu.Desktop.Tests.Beatmaps;
|
2016-11-28 02:38:32 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2017-08-04 06:37:31 +00:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2016-10-19 09:00:35 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-08-04 06:37:31 +00:00
|
|
|
|
using osu.Game.Rulesets;
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2017-08-04 06:37:31 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
2016-11-14 08:23:33 +00:00
|
|
|
|
using osu.Game.Screens.Play;
|
2017-08-04 06:37:31 +00:00
|
|
|
|
using OpenTK;
|
2016-11-17 12:29:35 +00:00
|
|
|
|
using OpenTK.Graphics;
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2017-08-04 06:37:31 +00:00
|
|
|
|
namespace osu.Desktop.Tests.Visual
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2017-08-04 06:37:31 +00:00
|
|
|
|
internal class TestCasePlayer : OsuTestCase
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2017-03-02 07:08:37 +00:00
|
|
|
|
protected Player Player;
|
2017-07-27 07:56:41 +00:00
|
|
|
|
private RulesetStore rulesets;
|
2017-03-02 07:08:37 +00:00
|
|
|
|
|
2016-10-19 09:00:35 +00:00
|
|
|
|
public override string Description => @"Showing everything to play the game.";
|
|
|
|
|
|
2016-11-28 02:38:32 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
2017-07-27 07:56:41 +00:00
|
|
|
|
private void load(RulesetStore rulesets)
|
2016-11-28 02:38:32 +00:00
|
|
|
|
{
|
2017-04-17 10:44:03 +00:00
|
|
|
|
this.rulesets = rulesets;
|
2016-11-28 02:38:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-07 12:05:55 +00:00
|
|
|
|
protected override void LoadComplete()
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2017-07-07 12:05:55 +00:00
|
|
|
|
base.LoadComplete();
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2017-07-07 12:05:55 +00:00
|
|
|
|
var objects = new List<HitObject>();
|
2017-03-02 07:08:37 +00:00
|
|
|
|
|
2017-07-07 12:05:55 +00:00
|
|
|
|
int time = 1500;
|
|
|
|
|
for (int i = 0; i < 50; i++)
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2017-07-07 12:05:55 +00:00
|
|
|
|
objects.Add(new HitCircle
|
2016-10-19 09:00:35 +00:00
|
|
|
|
{
|
2017-07-07 12:05:55 +00:00
|
|
|
|
StartTime = time,
|
|
|
|
|
Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X,
|
|
|
|
|
i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y),
|
|
|
|
|
NewCombo = i % 4 == 0
|
|
|
|
|
});
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2017-07-07 12:05:55 +00:00
|
|
|
|
time += 500;
|
|
|
|
|
}
|
2016-10-19 09:00:35 +00:00
|
|
|
|
|
2017-07-07 12:05:55 +00:00
|
|
|
|
Beatmap b = new Beatmap
|
|
|
|
|
{
|
|
|
|
|
HitObjects = objects,
|
|
|
|
|
BeatmapInfo = new BeatmapInfo
|
2016-11-28 02:38:32 +00:00
|
|
|
|
{
|
2017-07-07 12:05:55 +00:00
|
|
|
|
Difficulty = new BeatmapDifficulty(),
|
|
|
|
|
Ruleset = rulesets.Query<RulesetInfo>().First(),
|
|
|
|
|
Metadata = new BeatmapMetadata
|
2017-02-22 14:27:29 +00:00
|
|
|
|
{
|
2017-07-07 12:05:55 +00:00
|
|
|
|
Artist = @"Unknown",
|
|
|
|
|
Title = @"Sample Beatmap",
|
|
|
|
|
Author = @"peppy",
|
2017-02-22 14:27:29 +00:00
|
|
|
|
}
|
2017-07-07 12:05:55 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2016-11-02 09:08:08 +00:00
|
|
|
|
|
2017-07-08 09:17:47 +00:00
|
|
|
|
WorkingBeatmap beatmap = new TestWorkingBeatmap(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,
|
2017-02-18 06:54:26 +00:00
|
|
|
|
Colour = Color4.Black,
|
2016-11-17 12:29:35 +00:00
|
|
|
|
});
|
|
|
|
|
|
2017-04-11 10:38:03 +00:00
|
|
|
|
Add(Player = CreatePlayer(beatmap));
|
2017-03-02 07:08:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual Player CreatePlayer(WorkingBeatmap beatmap)
|
|
|
|
|
{
|
|
|
|
|
return new Player
|
2017-02-22 12:43:29 +00:00
|
|
|
|
{
|
2017-07-19 04:32:16 +00:00
|
|
|
|
InitialBeatmap = beatmap
|
2017-03-02 07:08:37 +00:00
|
|
|
|
};
|
2016-10-19 09:00:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|