2020-10-15 16:48: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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Screens.Play;
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning
|
|
|
|
{
|
|
|
|
public class LegacyAccuracyCounter : PercentageCounter, IAccuracyCounter
|
|
|
|
{
|
|
|
|
private readonly ISkin skin;
|
|
|
|
|
|
|
|
public LegacyAccuracyCounter(ISkin skin)
|
|
|
|
{
|
2020-10-15 17:11:30 +08:00
|
|
|
Anchor = Anchor.TopRight;
|
2020-10-15 16:48:50 +08:00
|
|
|
Origin = Anchor.TopRight;
|
2020-10-15 17:11:30 +08:00
|
|
|
|
2020-10-15 16:48:50 +08:00
|
|
|
Scale = new Vector2(0.75f);
|
2020-10-15 17:24:28 +08:00
|
|
|
Margin = new MarginPadding(10);
|
2020-10-15 16:48:50 +08:00
|
|
|
|
|
|
|
this.skin = skin;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Resolved(canBeNull: true)]
|
|
|
|
private HUDOverlay hud { get; set; }
|
|
|
|
|
2020-10-16 16:38:21 +08:00
|
|
|
protected sealed override OsuSpriteText CreateSpriteText() => (OsuSpriteText)skin?.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText));
|
2020-10-15 16:48:50 +08:00
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
if (hud?.ScoreCounter.Drawable is LegacyScoreCounter score)
|
|
|
|
{
|
|
|
|
// for now align with the score counter. eventually this will be user customisable.
|
2020-10-15 17:11:30 +08:00
|
|
|
Y = Parent.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight).Y;
|
2020-10-15 16:48:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|