mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:43:22 +08:00
Add displaying users
This commit is contained in:
parent
5c0d0cb7e7
commit
e19a4f5e6f
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
@ -14,7 +15,68 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
SocialOverlay s = new SocialOverlay();
|
||||
SocialOverlay s = new SocialOverlay
|
||||
{
|
||||
Users = new[]
|
||||
{
|
||||
new User
|
||||
{
|
||||
Username = @"flyte",
|
||||
Id = 3103765,
|
||||
Country = new Country { FlagName = @"JP" },
|
||||
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg",
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"Cookiezi",
|
||||
Id = 124493,
|
||||
Country = new Country { FlagName = @"KR" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg",
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"Angelism",
|
||||
Id = 1777162,
|
||||
Country = new Country { FlagName = @"KR" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"Rafis",
|
||||
Id = 2558286,
|
||||
Country = new Country { FlagName = @"PL" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c5.jpg",
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"hvick225",
|
||||
Id = 50265,
|
||||
Country = new Country { FlagName = @"TW" },
|
||||
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/50265/cb79df0d6ddd04b57d057623417aa55c505810d8e73b1a96d6e665e0e18e5770.jpeg",
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"peppy",
|
||||
Id = 2,
|
||||
Country = new Country { FlagName = @"AU" },
|
||||
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/615362d26dc37cc4d46e61a08a2537e7cdf0e0e00f40574b18bf90156ad0280f.jpeg"
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"filsdelama",
|
||||
Id = 2831793,
|
||||
Country = new Country { FlagName = @"FR" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg"
|
||||
},
|
||||
new User
|
||||
{
|
||||
Username = @"_index",
|
||||
Id = 652457,
|
||||
Country = new Country { FlagName = @"RU" },
|
||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c7.jpg"
|
||||
},
|
||||
},
|
||||
};
|
||||
Add(s);
|
||||
|
||||
AddStep(@"toggle", s.ToggleVisibility);
|
||||
|
@ -1,12 +1,17 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Browse;
|
||||
using osu.Game.Overlays.Social;
|
||||
using osu.Game.Users;
|
||||
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
|
||||
@ -14,6 +19,26 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
public class SocialOverlay : BrowseOverlay<SocialTab, SocialSortCriteria>
|
||||
{
|
||||
private readonly FillFlowContainer<UserPanel> panelFlow;
|
||||
|
||||
private IEnumerable<User> users;
|
||||
public IEnumerable<User> Users
|
||||
{
|
||||
get { return users; }
|
||||
set
|
||||
{
|
||||
if (users == value) return;
|
||||
users = value;
|
||||
|
||||
panelFlow.Children = users.Select(u =>
|
||||
{
|
||||
var p = new UserPanel(u) { Width = 300 };
|
||||
p.Status.BindTo(u.Status);
|
||||
return p;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b");
|
||||
protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51");
|
||||
protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648");
|
||||
@ -23,7 +48,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
public SocialOverlay()
|
||||
{
|
||||
ScrollFlow.Children = new[]
|
||||
ScrollFlow.Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
@ -39,6 +64,12 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
},
|
||||
},
|
||||
panelFlow = new FillFlowContainer<UserPanel>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(10f),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user