1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 15:17:44 +08:00
osu-lazer/osu.Game/Skinning/LegacyRankDisplay.cs

64 lines
1.9 KiB
C#
Raw Normal View History

2023-08-07 09:50:44 +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.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Scoring;
using osuTK;
2023-08-07 09:50:44 +08:00
namespace osu.Game.Skinning
{
public partial class LegacyRankDisplay : CompositeDrawable, ISerialisableDrawable
{
public bool UsesFixedAnchor { get; set; }
[Resolved]
private ScoreProcessor scoreProcessor { get; set; } = null!;
[Resolved]
private ISkinSource source { get; set; } = null!;
private readonly Sprite rank;
public LegacyRankDisplay()
{
AutoSizeAxes = Axes.Both;
AddInternal(rank = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
2023-08-07 09:50:44 +08:00
}
protected override void LoadComplete()
{
scoreProcessor.Rank.BindValueChanged(v =>
{
var texture = source.GetTexture($"ranking-{v.NewValue}-small");
rank.Texture = texture;
if (texture != null)
{
var transientRank = new Sprite
{
Texture = texture,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BypassAutoSizeAxes = Axes.Both,
};
AddInternal(transientRank);
2024-06-07 17:04:16 +08:00
transientRank.FadeOutFromOne(500, Easing.Out)
.ScaleTo(new Vector2(1.625f), 500, Easing.Out)
.Expire();
}
}, true);
FinishTransforms(true);
2023-08-07 09:50:44 +08:00
}
}
}