mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Add test
This commit is contained in:
parent
4f6dd15869
commit
b31a3fbabb
@ -0,0 +1,49 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableAccuracyCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
private IEnumerable<SkinnableAccuracyCounter> accuracyCounters => CreatedDrawables.OfType<SkinnableAccuracyCounter>();
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create combo counters", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
var accuracyCounter = new SkinnableAccuracyCounter();
|
||||||
|
|
||||||
|
accuracyCounter.Current.Value = 1;
|
||||||
|
|
||||||
|
return accuracyCounter;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangingAccuracy()
|
||||||
|
{
|
||||||
|
AddStep(@"Reset all", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in accuracyCounters)
|
||||||
|
s.Current.Value = 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep(@"Hit! :D", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in accuracyCounters)
|
||||||
|
s.Current.Value -= 0.023f;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
public DefaultAccuracyCounter()
|
public DefaultAccuracyCounter()
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopRight;
|
Origin = Anchor.TopRight;
|
||||||
|
Anchor = Anchor.TopRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
@ -34,6 +35,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
if (hud?.ScoreCounter.Drawable is DefaultScoreCounter score)
|
if (hud?.ScoreCounter.Drawable is DefaultScoreCounter score)
|
||||||
{
|
{
|
||||||
// for now align with the score counter. eventually this will be user customisable.
|
// for now align with the score counter. eventually this will be user customisable.
|
||||||
|
Anchor = Anchor.TopLeft;
|
||||||
Position = Parent.ToLocalSpace(score.ScreenSpaceDrawQuad.TopLeft) + offset;
|
Position = Parent.ToLocalSpace(score.ScreenSpaceDrawQuad.TopLeft) + offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,9 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public LegacyAccuracyCounter(ISkin skin)
|
public LegacyAccuracyCounter(ISkin skin)
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.TopRight;
|
||||||
Origin = Anchor.TopRight;
|
Origin = Anchor.TopRight;
|
||||||
|
|
||||||
Scale = new Vector2(0.75f);
|
Scale = new Vector2(0.75f);
|
||||||
|
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
@ -40,7 +42,7 @@ namespace osu.Game.Skinning
|
|||||||
if (hud?.ScoreCounter.Drawable is LegacyScoreCounter score)
|
if (hud?.ScoreCounter.Drawable is LegacyScoreCounter score)
|
||||||
{
|
{
|
||||||
// for now align with the score counter. eventually this will be user customisable.
|
// for now align with the score counter. eventually this will be user customisable.
|
||||||
Position = Parent.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight);
|
Y = Parent.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight).Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user