2017-02-07 13:59:30 +09: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 18:06:36 +09:00
|
|
|
|
|
2017-08-04 15:37:31 +09:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Desktop.Tests.Beatmaps;
|
|
|
|
|
using osu.Framework.Allocation;
|
2016-09-25 13:59:38 +09:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-02-27 18:30:10 +09:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2016-09-02 20:30:27 +09:00
|
|
|
|
using osu.Framework.MathUtils;
|
2016-10-26 17:26:26 +09:00
|
|
|
|
using osu.Framework.Timing;
|
2016-09-02 18:27:38 +09:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-08-04 15:37:31 +09:00
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
using osu.Game.Rulesets;
|
2017-08-09 13:04:11 +09:00
|
|
|
|
using osu.Game.Rulesets.Catch;
|
2017-04-18 16:05:58 +09:00
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
2017-08-09 13:04:11 +09:00
|
|
|
|
using osu.Game.Rulesets.Mania;
|
2017-04-18 16:05:58 +09:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-08-09 13:04:11 +09:00
|
|
|
|
using osu.Game.Rulesets.Osu;
|
2017-04-18 16:05:58 +09:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
2017-08-09 13:04:11 +09:00
|
|
|
|
using osu.Game.Rulesets.Taiko;
|
2017-04-18 16:05:58 +09:00
|
|
|
|
using osu.Game.Rulesets.Taiko.UI;
|
2017-08-04 15:37:31 +09:00
|
|
|
|
using OpenTK;
|
2016-09-02 18:06:36 +09:00
|
|
|
|
|
2017-08-04 15:37:31 +09:00
|
|
|
|
namespace osu.Desktop.Tests.Visual
|
2016-09-02 18:06:36 +09:00
|
|
|
|
{
|
2017-08-04 15:37:31 +09:00
|
|
|
|
internal class TestCaseGamefield : OsuTestCase
|
2016-09-02 18:06:36 +09:00
|
|
|
|
{
|
2017-07-27 16:56:41 +09:00
|
|
|
|
private RulesetStore rulesets;
|
2017-04-17 19:44:03 +09:00
|
|
|
|
|
2016-09-25 13:59:38 +09:00
|
|
|
|
public override string Description => @"Showing hitobjects and what not.";
|
|
|
|
|
|
2017-04-17 19:44:03 +09:00
|
|
|
|
[BackgroundDependencyLoader]
|
2017-07-27 16:56:41 +09:00
|
|
|
|
private void load(RulesetStore rulesets)
|
2017-04-17 19:44:03 +09:00
|
|
|
|
{
|
|
|
|
|
this.rulesets = rulesets;
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-07 15:05:55 +03:00
|
|
|
|
protected override void LoadComplete()
|
2016-09-02 18:06:36 +09:00
|
|
|
|
{
|
2017-07-07 15:05:55 +03:00
|
|
|
|
base.LoadComplete();
|
2016-09-25 13:59:38 +09:00
|
|
|
|
|
2016-09-26 15:07:29 +09:00
|
|
|
|
List<HitObject> objects = new List<HitObject>();
|
2016-09-02 20:30:27 +09:00
|
|
|
|
|
2016-09-25 13:59:38 +09:00
|
|
|
|
int time = 500;
|
2016-09-02 20:30:27 +09:00
|
|
|
|
for (int i = 0; i < 100; i++)
|
2016-09-02 18:27:38 +09:00
|
|
|
|
{
|
2017-03-07 10:59:19 +09:00
|
|
|
|
objects.Add(new HitCircle
|
2016-09-02 19:25:13 +09:00
|
|
|
|
{
|
2016-09-02 20:30:27 +09:00
|
|
|
|
StartTime = time,
|
2017-04-18 12:19:39 +09:00
|
|
|
|
Position = new Vector2(RNG.Next(0, (int)OsuPlayfield.BASE_SIZE.X), RNG.Next(0, (int)OsuPlayfield.BASE_SIZE.Y)),
|
2016-12-11 10:11:22 +01:00
|
|
|
|
Scale = RNG.NextSingle(0.5f, 1.0f),
|
2016-09-02 20:30:27 +09:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
time += RNG.Next(50, 500);
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-23 13:55:18 +09:00
|
|
|
|
var controlPointInfo = new ControlPointInfo();
|
2017-05-23 15:20:32 +09:00
|
|
|
|
controlPointInfo.TimingPoints.Add(new TimingControlPoint
|
2017-05-11 20:04:45 +09:00
|
|
|
|
{
|
|
|
|
|
BeatLength = 200
|
|
|
|
|
});
|
|
|
|
|
|
2017-03-12 18:03:13 +09:00
|
|
|
|
WorkingBeatmap beatmap = new TestWorkingBeatmap(new Beatmap
|
2016-09-02 20:30:27 +09:00
|
|
|
|
{
|
2017-03-12 18:03:13 +09:00
|
|
|
|
HitObjects = objects,
|
|
|
|
|
BeatmapInfo = new BeatmapInfo
|
|
|
|
|
{
|
2017-03-16 23:18:02 +09:00
|
|
|
|
Difficulty = new BeatmapDifficulty(),
|
2017-04-17 19:44:03 +09:00
|
|
|
|
Ruleset = rulesets.Query<RulesetInfo>().First(),
|
2017-03-12 18:03:13 +09:00
|
|
|
|
Metadata = new BeatmapMetadata
|
|
|
|
|
{
|
|
|
|
|
Artist = @"Unknown",
|
|
|
|
|
Title = @"Sample Beatmap",
|
|
|
|
|
Author = @"peppy",
|
2017-05-11 20:04:45 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
2017-05-23 13:55:18 +09:00
|
|
|
|
ControlPointInfo = controlPointInfo
|
2017-03-12 18:03:13 +09:00
|
|
|
|
});
|
2016-09-02 18:27:38 +09:00
|
|
|
|
|
2017-07-11 16:58:06 +03:00
|
|
|
|
AddRange(new Drawable[]
|
2016-09-02 20:30:27 +09:00
|
|
|
|
{
|
2017-02-27 18:30:10 +09:00
|
|
|
|
new Container
|
2016-09-21 13:25:23 +09:00
|
|
|
|
{
|
2017-02-27 18:30:10 +09:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
//ensure we are at offset 0
|
|
|
|
|
Clock = new FramedClock(),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-08-09 13:28:29 +09:00
|
|
|
|
new OsuRulesetContainer(new OsuRuleset(new RulesetInfo()), beatmap, false)
|
2017-02-27 18:30:10 +09:00
|
|
|
|
{
|
|
|
|
|
Scale = new Vector2(0.5f),
|
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Origin = Anchor.TopLeft
|
|
|
|
|
},
|
2017-08-09 13:28:29 +09:00
|
|
|
|
new TaikoRulesetContainer(new TaikoRuleset(new RulesetInfo()),beatmap, false)
|
2017-02-27 18:30:10 +09:00
|
|
|
|
{
|
|
|
|
|
Scale = new Vector2(0.5f),
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight
|
|
|
|
|
},
|
2017-08-09 13:28:29 +09:00
|
|
|
|
new CatchRulesetContainer(new CatchRuleset(new RulesetInfo()),beatmap, false)
|
2017-02-27 18:30:10 +09:00
|
|
|
|
{
|
|
|
|
|
Scale = new Vector2(0.5f),
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft
|
|
|
|
|
},
|
2017-08-09 13:28:29 +09:00
|
|
|
|
new ManiaRulesetContainer(new ManiaRuleset(new RulesetInfo()),beatmap, false)
|
2017-02-27 18:30:10 +09:00
|
|
|
|
{
|
|
|
|
|
Scale = new Vector2(0.5f),
|
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
|
Origin = Anchor.BottomRight
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-21 13:25:23 +09:00
|
|
|
|
}
|
2016-09-25 13:59:38 +09:00
|
|
|
|
});
|
|
|
|
|
}
|
2016-09-02 18:06:36 +09:00
|
|
|
|
}
|
|
|
|
|
}
|