1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 15:23:22 +08:00
osu-lazer/osu.Desktop.Tests/Visual/TestCasePlayer.cs

88 lines
2.6 KiB
C#
Raw Normal View History

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