mirror of
https://github.com/ppy/osu.git
synced 2025-02-01 22:03:01 +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 PopInSampleName => "UI/notification-default";
|
||||||
public virtual string PopOutSampleName => "UI/overlay-pop-out";
|
public virtual string PopOutSampleName => "UI/overlay-pop-out";
|
||||||
|
|
||||||
|
protected const float CORNER_RADIUS = 6;
|
||||||
|
|
||||||
protected NotificationLight Light;
|
protected NotificationLight Light;
|
||||||
|
|
||||||
protected Container IconContent;
|
protected Container IconContent;
|
||||||
@ -128,7 +130,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
}.WithChild(MainContent = new Container
|
}.WithChild(MainContent = new Container
|
||||||
{
|
{
|
||||||
CornerRadius = 6,
|
CornerRadius = CORNER_RADIUS,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
@ -39,39 +39,34 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
Text = text;
|
Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DrawableAvatar? avatar;
|
|
||||||
|
|
||||||
protected override IconUsage CloseButtonIcon => FontAwesome.Solid.Times;
|
protected override IconUsage CloseButtonIcon => FontAwesome.Solid.Times;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
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))
|
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14, weight: FontWeight.Medium))
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Text = text
|
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