mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:33:21 +08:00
General improvements to testcase
This commit is contained in:
parent
2b79ad879f
commit
b968040963
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -12,27 +14,36 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public class TestCaseScrollingHitObjects : OsuTestCase
|
public class TestCaseScrollingHitObjects : OsuTestCase
|
||||||
{
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Playfield) };
|
||||||
|
|
||||||
|
private List<TestPlayfield> playfields = new List<TestPlayfield>();
|
||||||
|
|
||||||
public TestCaseScrollingHitObjects()
|
public TestCaseScrollingHitObjects()
|
||||||
{
|
{
|
||||||
AddStep("Vertically-scrolling", () => createPlayfield(Direction.Vertical));
|
playfields.Add(new TestPlayfield(Direction.Vertical));
|
||||||
AddStep("Horizontally-scrolling", () => createPlayfield(Direction.Horizontal));
|
playfields.Add(new TestPlayfield(Direction.Horizontal));
|
||||||
|
|
||||||
AddStep("Add hitobject", addHitObject);
|
AddRange(playfields);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestPlayfield playfield;
|
protected override void LoadComplete()
|
||||||
private void createPlayfield(Direction scrollingDirection)
|
|
||||||
{
|
{
|
||||||
if (playfield != null)
|
base.LoadComplete();
|
||||||
Remove(playfield);
|
|
||||||
Add(playfield = new TestPlayfield(scrollingDirection));
|
for (int i = 0; i <= 5000; i += 1000)
|
||||||
|
addHitObject(Time.Current + i);
|
||||||
|
|
||||||
|
Scheduler.AddDelayed(() => addHitObject(Time.Current + 5000), 1000, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addHitObject()
|
private void addHitObject(double time)
|
||||||
{
|
{
|
||||||
playfield.Add(new TestDrawableHitObject(new HitObject { StartTime = Time.Current + 5000 })
|
playfields.ForEach(p =>
|
||||||
{
|
{
|
||||||
Anchor = playfield.ScrollingDirection == Direction.Horizontal ? Anchor.CentreRight : Anchor.BottomCentre
|
p.Add(new TestDrawableHitObject(new HitObject { StartTime = time })
|
||||||
|
{
|
||||||
|
Anchor = p.ScrollingDirection == Direction.Horizontal ? Anchor.CentreRight : Anchor.BottomCentre
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user