Baisc UserListCard implementation

This commit is contained in:
Andrei Zavatski 2020-03-04 08:53:14 +03:00
parent f425233527
commit 1b5222f396
2 changed files with 53 additions and 7 deletions

View File

@ -4,8 +4,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterfaceV2.Users; using osu.Game.Graphics.UserInterfaceV2.Users;
using osu.Game.Users; using osu.Game.Users;
using osuTK;
namespace osu.Game.Tests.Visual.UserInterface namespace osu.Game.Tests.Visual.UserInterface
{ {
@ -15,20 +17,45 @@ public class TestSceneUserCard : OsuTestScene
{ {
typeof(UserCard), typeof(UserCard),
typeof(UserGridCard), typeof(UserGridCard),
typeof(UserListCard)
}; };
public TestSceneUserCard() public TestSceneUserCard()
{ {
Add(new UserGridCard(new User Add(new FillFlowContainer
{
Username = @"flyte",
Id = 3103765,
Country = new Country { FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
})
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new UserGridCard(new User
{
Username = @"flyte",
Id = 3103765,
Country = new Country { FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
})
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new UserListCard(new User
{
Username = @"peppy",
Id = 2,
Country = new Country { FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
IsSupporter = true,
SupportLevel = 3,
})
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
}
}); });
} }
} }

View File

@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Users;
using osu.Framework.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2.Users
{
public class UserListCard : UserCard
{
public UserListCard(User user)
: base(user)
{
RelativeSizeAxes = Axes.X;
Height = 40;
CornerRadius = 6;
}
}
}