2020-06-02 22:38:50 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2020-06-18 21:11:03 +08:00
|
|
|
using System;
|
2020-06-02 22:38:50 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-06-18 21:11:03 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2020-06-15 20:48:59 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Statistics;
|
2020-06-18 21:11:03 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
2020-06-19 18:58:35 +08:00
|
|
|
using osu.Game.Scoring;
|
2020-06-02 22:38:50 +08:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Ranking
|
|
|
|
{
|
|
|
|
public class TestSceneTimingDistributionGraph : OsuTestScene
|
|
|
|
{
|
|
|
|
public TestSceneTimingDistributionGraph()
|
|
|
|
{
|
2020-06-12 21:48:43 +08:00
|
|
|
Children = new Drawable[]
|
2020-06-02 22:38:50 +08:00
|
|
|
{
|
2020-06-12 21:48:43 +08:00
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4Extensions.FromHex("#333")
|
|
|
|
},
|
2020-06-19 18:58:35 +08:00
|
|
|
new TimingDistributionGraph(new ScoreInfo { HitEvents = CreateDistributedHitEvents() })
|
2020-06-12 21:48:43 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Size = new Vector2(400, 130)
|
|
|
|
}
|
|
|
|
};
|
2020-06-02 22:38:50 +08:00
|
|
|
}
|
|
|
|
|
2020-06-18 21:11:03 +08:00
|
|
|
public static List<HitEvent> CreateDistributedHitEvents()
|
2020-06-02 22:38:50 +08:00
|
|
|
{
|
2020-06-18 21:11:03 +08:00
|
|
|
var hitEvents = new List<HitEvent>();
|
2020-06-02 22:38:50 +08:00
|
|
|
|
2020-06-18 21:11:03 +08:00
|
|
|
for (int i = 0; i < 50; i++)
|
2020-06-02 22:38:50 +08:00
|
|
|
{
|
2020-06-18 21:11:03 +08:00
|
|
|
int count = (int)(Math.Pow(25 - Math.Abs(i - 25), 2));
|
2020-06-02 22:38:50 +08:00
|
|
|
|
2020-06-18 21:11:03 +08:00
|
|
|
for (int j = 0; j < count; j++)
|
|
|
|
hitEvents.Add(new HitEvent(i - 25, HitResult.Perfect, new HitCircle(), new HitCircle(), null));
|
2020-06-02 22:38:50 +08:00
|
|
|
}
|
|
|
|
|
2020-06-18 21:11:03 +08:00
|
|
|
return hitEvents;
|
2020-06-02 22:38:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|