mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Tidy up UserAvatarNotification
implementation
This commit is contained in:
parent
e6103fea95
commit
aee8ba789c
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user