2022-09-18 03:09:34 +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.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Configuration;
|
2023-03-06 07:10:42 +08:00
|
|
|
using osu.Game.Localisation.SkinComponents;
|
2022-09-18 03:09:34 +08:00
|
|
|
using osu.Game.Skinning;
|
|
|
|
using osu.Game.Users.Drawables;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play.HUD
|
|
|
|
{
|
2023-03-06 07:09:02 +08:00
|
|
|
public partial class PlayerAvatar : CompositeDrawable, ISerialisableDrawable
|
2022-09-18 03:09:34 +08:00
|
|
|
{
|
2023-03-06 07:10:42 +08:00
|
|
|
[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.CornerRadius), nameof(SkinnableComponentStrings.CornerRadiusDescription))]
|
2022-09-18 06:04:56 +08:00
|
|
|
public new BindableFloat CornerRadius { get; set; } = new BindableFloat
|
2022-09-18 03:09:34 +08:00
|
|
|
{
|
|
|
|
MinValue = 0,
|
2023-03-06 18:27:59 +08:00
|
|
|
MaxValue = 64,
|
2022-09-18 03:09:34 +08:00
|
|
|
Precision = 0.01f
|
|
|
|
};
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private GameplayState gameplayState { get; set; } = null!;
|
|
|
|
|
|
|
|
private readonly UpdateableAvatar avatar;
|
|
|
|
|
2023-03-06 07:09:02 +08:00
|
|
|
public PlayerAvatar()
|
2022-09-18 03:09:34 +08:00
|
|
|
{
|
|
|
|
Size = new Vector2(128f);
|
|
|
|
InternalChild = avatar = new UpdateableAvatar(isInteractive: false)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Masking = true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
avatar.User = gameplayState.Score.ScoreInfo.User;
|
2023-03-07 04:06:56 +08:00
|
|
|
CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue, true);
|
2022-09-18 03:09:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool UsesFixedAnchor { get; set; }
|
|
|
|
}
|
|
|
|
}
|