1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 10:47:24 +08:00
osu-lazer/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs

82 lines
2.1 KiB
C#
Raw Normal View History

//Copyright (c) 2007-2016 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.Framework.GameModes.Testing;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
2016-11-02 17:08:08 +08:00
using osu.Game.Beatmaps.Formats;
using OpenTK;
2016-11-05 06:18:08 +08:00
using osu.Framework;
2016-11-09 07:13:20 +08:00
using osu.Framework.Allocation;
2016-11-17 20:29:35 +08:00
using osu.Framework.Graphics.Sprites;
2016-11-14 17:03:20 +08:00
using osu.Game.Modes.Objects;
2016-11-14 17:54:24 +08:00
using osu.Game.Modes.Osu.Objects;
2016-11-14 16:23:33 +08:00
using osu.Game.Screens.Play;
2016-11-17 20:29:35 +08:00
using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
class TestCasePlayer : TestCase
{
public override string Name => @"Player";
public override string Description => @"Showing everything to play the game.";
FramedClock localClock;
protected override IFrameBasedClock Clock => localClock;
public override void Reset()
{
base.Reset();
//ensure we are at offset 0
localClock = new FramedClock();
var objects = new List<HitObject>();
int time = 1500;
for (int i = 0; i < 50; i++)
{
2016-11-16 15:16:45 +08:00
objects.Add(new HitCircle()
{
StartTime = time,
2016-11-17 20:29:35 +08:00
Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512,
i % 4 < 2 ? 0 : 384),
2016-11-02 17:38:17 +08:00
NewCombo = i % 4 == 0
});
time += 500;
}
2016-11-02 17:08:08 +08:00
var decoder = new ConstructableBeatmapDecoder();
Beatmap b = new Beatmap
{
HitObjects = objects
};
decoder.Process(b);
2016-11-17 20:29:35 +08:00
Add(new Box
{
RelativeSizeAxes = Framework.Graphics.Axes.Both,
Colour = Color4.Gray,
});
2016-11-09 07:13:20 +08:00
Add(new Player
{
Beatmap = new WorkingBeatmap(b)
});
}
protected override void Update()
{
base.Update();
localClock.ProcessFrame();
}
}
}