1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 02:29:53 +08:00
Files
osu-lazer/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
T

43 lines
1.2 KiB
C#

// 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.Localisation;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users.Drawables;
namespace osu.Game.Overlays.Notifications
{
public abstract partial class UserAvatarNotification : SimpleNotification
{
private readonly APIUser? user;
protected DrawableAvatar Avatar { get; private set; } = null!;
protected UserAvatarNotification(APIUser? user, LocalisableString text = default)
{
this.user = user;
Icon = default;
Text = text;
}
[BackgroundDependencyLoader]
private void load()
{
if (user != null)
{
IconContent.Masking = true;
IconContent.CornerRadius = CORNER_RADIUS;
IconContent.ChangeChildDepth(IconDrawable, float.MinValue);
LoadComponentAsync(Avatar = new DrawableAvatar(user)
{
FillMode = FillMode.Fill,
}, IconContent.Add);
}
}
}
}