1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 13:37:51 +08:00

Adjust background presentation for UserListCard

This commit is contained in:
Andrei Zavatski 2020-03-04 09:10:51 +03:00
parent 1b5222f396
commit b7d34b399d
3 changed files with 41 additions and 12 deletions

View File

@ -3,9 +3,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterfaceV2.Users; using osu.Game.Graphics.UserInterfaceV2.Users;
using osu.Game.Overlays;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -20,6 +22,9 @@ namespace osu.Game.Tests.Visual.UserInterface
typeof(UserListCard) typeof(UserListCard)
}; };
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
public TestSceneUserCard() public TestSceneUserCard()
{ {
Add(new FillFlowContainer Add(new FillFlowContainer

View File

@ -13,17 +13,17 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterfaceV2.Users namespace osu.Game.Graphics.UserInterfaceV2.Users
{ {
public abstract class UserCard : OsuHoverContainer, IHasContextMenu public abstract class UserCard : OsuHoverContainer, IHasContextMenu
{ {
[Resolved(canBeNull:true)] public User User { get; }
private UserProfileOverlay profileOverlay { get; set; }
protected override IEnumerable<Drawable> EffectTargets => null; protected override IEnumerable<Drawable> EffectTargets => null;
public User User { get; } protected DelayedLoadUnloadWrapper Background;
public UserCard(User user) public UserCard(User user)
{ {
@ -33,23 +33,36 @@ namespace osu.Game.Graphics.UserInterfaceV2.Users
User = user; User = user;
} }
[Resolved(canBeNull: true)]
private UserProfileOverlay profileOverlay { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours, OverlayColourProvider colourProvider)
{ {
Action = () => profileOverlay?.ShowUser(User); Action = () => profileOverlay?.ShowUser(User);
Masking = true; Masking = true;
BorderColour = colours.GreyVioletLighter; BorderColour = colours.GreyVioletLighter;
Add(new DelayedLoadUnloadWrapper(() => new UserCoverBackground AddRange(new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, new Box
Anchor = Anchor.Centre, {
Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both,
User = User, Colour = colourProvider.Background5
}, 300, 5000) },
{ Background = new DelayedLoadUnloadWrapper(() => new UserCoverBackground
RelativeSizeAxes = Axes.Both, {
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
User = User,
}, 300, 5000)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both,
}
}); });
} }

View File

@ -3,6 +3,10 @@
using osu.Game.Users; using osu.Game.Users;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Framework.Extensions.Color4Extensions;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2.Users namespace osu.Game.Graphics.UserInterfaceV2.Users
{ {
@ -15,5 +19,12 @@ namespace osu.Game.Graphics.UserInterfaceV2.Users
Height = 40; Height = 40;
CornerRadius = 6; CornerRadius = 6;
} }
[BackgroundDependencyLoader]
private void load()
{
Background.Width = 0.5f;
Background.Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(1), Color4.White);
}
} }
} }