1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 23:47:25 +08:00
osu-lazer/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs

45 lines
1.2 KiB
C#
Raw Normal View History

2023-08-06 20:43:09 +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;
2023-08-07 09:50:24 +08:00
using osu.Framework.Graphics.Containers;
2023-08-06 20:43:09 +08:00
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.Scoring;
2023-08-07 09:50:24 +08:00
using osu.Game.Skinning;
2023-08-06 20:43:09 +08:00
using osuTK;
namespace osu.Game.Screens.Play.HUD
{
2023-08-07 09:50:24 +08:00
public partial class DefaultRankDisplay : Container, ISerialisableDrawable
2023-08-06 20:43:09 +08:00
{
[Resolved]
private ScoreProcessor scoreProcessor { get; set; } = null!;
2023-08-07 11:16:51 +08:00
2023-08-07 09:50:24 +08:00
public bool UsesFixedAnchor { get; set; }
2023-08-06 20:43:09 +08:00
2023-08-07 09:50:24 +08:00
private readonly UpdateableRank rank;
2023-08-06 20:43:09 +08:00
public DefaultRankDisplay()
{
Size = new Vector2(70, 35);
2023-08-07 11:16:51 +08:00
InternalChildren = new Drawable[]
{
rank = new UpdateableRank(Scoring.ScoreRank.X)
{
2023-08-06 20:43:09 +08:00
RelativeSizeAxes = Axes.Both
},
2023-08-07 11:16:51 +08:00
};
2023-08-06 20:43:09 +08:00
}
protected override void LoadComplete()
{
base.LoadComplete();
rank.Rank = scoreProcessor.Rank.Value;
scoreProcessor.Rank.BindValueChanged(v => rank.Rank = v.NewValue);
}
}
}