mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Renamespace
This commit is contained in:
@ -0,0 +1,65 @@
|
||||
// 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.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Users;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public class LevelProgressBar : CompositeDrawable, IHasTooltip
|
||||
{
|
||||
public readonly Bindable<User> User = new Bindable<User>();
|
||||
|
||||
public string TooltipText { get; }
|
||||
|
||||
private Bar levelProgressBar;
|
||||
private OsuSpriteText levelProgressText;
|
||||
|
||||
public LevelProgressBar()
|
||||
{
|
||||
TooltipText = "Progress to next level";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Child = levelProgressBar = new Bar
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BackgroundColour = Color4.Black,
|
||||
Direction = BarDirection.LeftToRight,
|
||||
AccentColour = colours.Yellow
|
||||
}
|
||||
},
|
||||
levelProgressText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold)
|
||||
}
|
||||
};
|
||||
|
||||
User.BindValueChanged(user => updateProgress(user.NewValue));
|
||||
}
|
||||
|
||||
private void updateProgress(User user)
|
||||
{
|
||||
levelProgressBar.Length = user?.Statistics?.Level.Progress / 100f ?? 0;
|
||||
levelProgressText.Text = user?.Statistics?.Level.Progress.ToString("0'%'");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user