mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Renamespace
This commit is contained in:
57
osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs
Normal file
57
osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs
Normal file
@ -0,0 +1,57 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public class LevelBadge : CompositeDrawable, IHasTooltip
|
||||
{
|
||||
public readonly Bindable<User> User = new Bindable<User>();
|
||||
|
||||
public string TooltipText { get; }
|
||||
|
||||
private OsuSpriteText levelText;
|
||||
|
||||
public LevelBadge()
|
||||
{
|
||||
TooltipText = "Level";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, TextureStore textures)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Texture = textures.Get("Profile/levelbadge"),
|
||||
Colour = colours.Yellow,
|
||||
},
|
||||
levelText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 20)
|
||||
}
|
||||
};
|
||||
|
||||
User.BindValueChanged(user => updateLevel(user.NewValue));
|
||||
}
|
||||
|
||||
private void updateLevel(User user)
|
||||
{
|
||||
levelText.Text = user?.Statistics?.Level.Current.ToString() ?? "0";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user