1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 04:52:57 +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.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterfaceV2.Users;
using osu.Game.Overlays;
using osu.Game.Users;
using osuTK;
@ -20,6 +22,9 @@ namespace osu.Game.Tests.Visual.UserInterface
typeof(UserListCard)
};
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
public TestSceneUserCard()
{
Add(new FillFlowContainer

View File

@ -13,17 +13,17 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System.Collections.Generic;
using osu.Framework.Input.Events;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterfaceV2.Users
{
public abstract class UserCard : OsuHoverContainer, IHasContextMenu
{
[Resolved(canBeNull:true)]
private UserProfileOverlay profileOverlay { get; set; }
public User User { get; }
protected override IEnumerable<Drawable> EffectTargets => null;
public User User { get; }
protected DelayedLoadUnloadWrapper Background;
public UserCard(User user)
{
@ -33,23 +33,36 @@ namespace osu.Game.Graphics.UserInterfaceV2.Users
User = user;
}
[Resolved(canBeNull: true)]
private UserProfileOverlay profileOverlay { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
Action = () => profileOverlay?.ShowUser(User);
Masking = true;
BorderColour = colours.GreyVioletLighter;
Add(new DelayedLoadUnloadWrapper(() => new UserCoverBackground
AddRange(new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
User = User,
}, 300, 5000)
{
RelativeSizeAxes = Axes.Both,
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5
},
Background = new DelayedLoadUnloadWrapper(() => new UserCoverBackground
{
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.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
{
@ -15,5 +19,12 @@ namespace osu.Game.Graphics.UserInterfaceV2.Users
Height = 40;
CornerRadius = 6;
}
[BackgroundDependencyLoader]
private void load()
{
Background.Width = 0.5f;
Background.Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(1), Color4.White);
}
}
}