1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +08:00

Add second UserPanel to visual test, center cover sprite

This commit is contained in:
DrabWeb 2017-05-22 03:27:08 -03:00
parent 7ce3b73ecd
commit a73cf92994
2 changed files with 32 additions and 13 deletions

View File

@ -5,6 +5,8 @@ using osu.Framework.Testing;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Users;
using osu.Framework.Graphics.Containers;
using OpenTK;
namespace osu.Desktop.VisualTests.Tests
{
@ -16,25 +18,39 @@ namespace osu.Desktop.VisualTests.Tests
{
base.Reset();
UserPanel p;
Add(p = new UserPanel(new User
{
Username = @"flyte",
Id = 3103765,
Country = new Country { FlagName = @"JP" },
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg"
})
UserPanel flyte;
UserPanel peppy;
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 300,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(10f),
Children = new[]
{
flyte = new UserPanel(new User
{
Username = @"flyte",
Id = 3103765,
Country = new Country { FlagName = @"JP" },
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg"
}),
peppy = new UserPanel(new User
{
Username = @"peppy",
Id = 2,
Country = new Country { FlagName = @"AU" },
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg"
}),
},
});
p.Status.Value = new UserStatusOnline();
flyte.Status.Value = new UserStatusOnline();
peppy.Status.Value = new UserStatusSoloGame();
AddStep(@"spectating", () => { p.Status.Value = new UserStatusSpectating(); });
AddStep(@"multiplaying", () => { p.Status.Value = new UserStatusMultiplayerGame(); });
AddStep(@"modding", () => { p.Status.Value = new UserStatusModding(); });
AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); });
AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); });
AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); });
}
}
}

View File

@ -34,6 +34,7 @@ namespace osu.Game.Users
{
this.user = user;
Width = 300;
Height = height;
Masking = true;
CornerRadius = 5;
@ -168,6 +169,8 @@ namespace osu.Game.Users
cover.Add(new AsyncLoadWrapper(new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get(user.CoverUrl),
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200),