1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 23:42:54 +08:00
osu-lazer/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs

100 lines
3.3 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
2016-09-02 17:06:36 +08:00
using OpenTK;
using osu.Framework.Graphics;
2017-02-27 17:30:10 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.MathUtils;
2017-03-28 20:03:34 +08:00
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Database;
2016-11-14 17:54:24 +08:00
using osu.Game.Modes.Catch.UI;
using osu.Game.Modes.Mania.UI;
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;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.Taiko.UI;
using System.Collections.Generic;
using osu.Desktop.VisualTests.Beatmaps;
2016-09-02 17:06:36 +08:00
namespace osu.Desktop.VisualTests.Tests
2016-09-02 17:06:36 +08:00
{
2017-03-07 09:59:19 +08:00
internal class TestCaseGamefield : TestCase
2016-09-02 17:06:36 +08:00
{
public override string Description => @"Showing hitobjects and what not.";
public override void Reset()
2016-09-02 17:06:36 +08:00
{
base.Reset();
2016-09-26 14:07:29 +08:00
List<HitObject> objects = new List<HitObject>();
int time = 500;
for (int i = 0; i < 100; i++)
{
2017-03-07 09:59:19 +08:00
objects.Add(new HitCircle
2016-09-02 18:25:13 +08:00
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)),
Scale = RNG.NextSingle(0.5f, 1.0f),
});
time += RNG.Next(50, 500);
}
WorkingBeatmap beatmap = new TestWorkingBeatmap(new Beatmap
{
HitObjects = objects,
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata
{
Artist = @"Unknown",
Title = @"Sample Beatmap",
Author = @"peppy",
}
}
});
Add(new Drawable[]
{
2017-02-27 17:30:10 +08:00
new Container
2016-09-21 12:25:23 +08:00
{
2017-02-27 17:30:10 +08:00
RelativeSizeAxes = Axes.Both,
//ensure we are at offset 0
Clock = new FramedClock(),
Children = new Drawable[]
{
new OsuHitRenderer(beatmap)
2017-02-27 17:30:10 +08:00
{
Scale = new Vector2(0.5f),
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft
},
new TaikoHitRenderer(beatmap)
2017-02-27 17:30:10 +08:00
{
Scale = new Vector2(0.5f),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
new CatchHitRenderer(beatmap)
2017-02-27 17:30:10 +08:00
{
Scale = new Vector2(0.5f),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new ManiaHitRenderer(beatmap)
2017-02-27 17:30:10 +08:00
{
Scale = new Vector2(0.5f),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight
}
}
2016-09-21 12:25:23 +08:00
}
});
}
2016-09-02 17:06:36 +08:00
}
}