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