1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Tidy up UserAvatarNotification implementation

This commit is contained in:
Dean Herbert 2023-10-12 16:02:19 +09:00
parent e6103fea95
commit aee8ba789c
No known key found for this signature in database
2 changed files with 20 additions and 23 deletions

View File

@ -53,6 +53,8 @@ namespace osu.Game.Overlays.Notifications
public virtual string PopInSampleName => "UI/notification-default";
public virtual string PopOutSampleName => "UI/overlay-pop-out";
protected const float CORNER_RADIUS = 6;
protected NotificationLight Light;
protected Container IconContent;
@ -128,7 +130,7 @@ namespace osu.Game.Overlays.Notifications
AutoSizeAxes = Axes.Y,
}.WithChild(MainContent = new Container
{
CornerRadius = 6,
CornerRadius = CORNER_RADIUS,
Masking = true,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,

View File

@ -39,39 +39,34 @@ namespace osu.Game.Overlays.Notifications
Text = text;
}
private DrawableAvatar? avatar;
protected override IconUsage CloseButtonIcon => FontAwesome.Solid.Times;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IconContent.Masking = true;
// Workaround for the corner radius on parent's mask breaking if we add masking to IconContent
IconContent.CornerRadius = 6;
IconContent.AddRange(new Drawable[]
{
new Box()
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
});
avatar = new DrawableAvatar(user)
{
FillMode = FillMode.Fill,
};
LoadComponentAsync(avatar, IconContent.Add);
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14, weight: FontWeight.Medium))
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Text = text
});
IconContent.Masking = true;
IconContent.CornerRadius = CORNER_RADIUS;
IconContent.AddRange(new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
});
LoadComponentAsync(new DrawableAvatar(user)
{
FillMode = FillMode.Fill,
}, IconContent.Add);
}
}
}