2017-05-26 11:52:01 +08:00
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
2017-05-26 13:00:38 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using OpenTK;
|
2017-05-26 11:52:01 +08:00
|
|
|
using OpenTK.Graphics;
|
2017-05-26 12:32:20 +08:00
|
|
|
using osu.Framework.Graphics;
|
2017-05-26 13:00:38 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-05-26 11:52:01 +08:00
|
|
|
using osu.Game.Graphics;
|
2017-05-26 13:44:09 +08:00
|
|
|
using osu.Game.Overlays.SearchableList;
|
2017-05-26 11:52:01 +08:00
|
|
|
using osu.Game.Overlays.Social;
|
2017-05-26 13:00:38 +08:00
|
|
|
using osu.Game.Users;
|
2017-05-26 11:52:01 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
{
|
2017-06-01 08:29:50 +08:00
|
|
|
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>
|
2017-05-26 11:52:01 +08:00
|
|
|
{
|
2017-05-26 13:00:38 +08:00
|
|
|
private readonly FillFlowContainer<UserPanel> panelFlow;
|
|
|
|
|
2017-05-26 13:16:56 +08:00
|
|
|
protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b");
|
|
|
|
protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51");
|
|
|
|
protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648");
|
|
|
|
|
2017-05-26 13:44:09 +08:00
|
|
|
protected override SearchableListHeader<SocialTab> CreateHeader() => new Header();
|
2017-06-01 08:29:50 +08:00
|
|
|
protected override SearchableListFilterControl<SocialSortCriteria, SortDirection> CreateFilterControl() => new FilterControl();
|
2017-05-26 13:16:56 +08:00
|
|
|
|
2017-05-26 13:00:38 +08:00
|
|
|
private IEnumerable<User> users;
|
|
|
|
public IEnumerable<User> Users
|
|
|
|
{
|
|
|
|
get { return users; }
|
|
|
|
set
|
|
|
|
{
|
2017-05-26 14:10:36 +08:00
|
|
|
if (users?.Equals(value) ?? false) return;
|
2017-05-26 13:00:38 +08:00
|
|
|
users = value;
|
|
|
|
|
|
|
|
panelFlow.Children = users.Select(u =>
|
|
|
|
{
|
|
|
|
var p = new UserPanel(u) { Width = 300 };
|
|
|
|
p.Status.BindTo(u.Status);
|
|
|
|
return p;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-26 12:32:20 +08:00
|
|
|
public SocialOverlay()
|
|
|
|
{
|
2017-05-28 05:35:46 +08:00
|
|
|
FirstWaveColour = OsuColour.FromHex(@"cb5fa0");
|
|
|
|
SecondWaveColour = OsuColour.FromHex(@"b04384");
|
|
|
|
ThirdWaveColour = OsuColour.FromHex(@"9b2b6e");
|
|
|
|
FourthWaveColour = OsuColour.FromHex(@"6d214d");
|
2017-05-26 13:55:25 +08:00
|
|
|
|
2017-05-26 17:05:05 +08:00
|
|
|
ScrollFlow.Children = new[]
|
2017-05-26 12:32:20 +08:00
|
|
|
{
|
2017-05-26 13:00:38 +08:00
|
|
|
panelFlow = new FillFlowContainer<UserPanel>
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-05-26 17:05:05 +08:00
|
|
|
Margin = new MarginPadding { Top = 20 },
|
2017-05-26 13:00:38 +08:00
|
|
|
Spacing = new Vector2(10f),
|
|
|
|
},
|
2017-05-26 12:32:20 +08:00
|
|
|
};
|
|
|
|
}
|
2017-05-26 11:52:01 +08:00
|
|
|
}
|
|
|
|
|
2017-05-26 12:32:20 +08:00
|
|
|
public enum SortDirection
|
2017-05-26 11:52:01 +08:00
|
|
|
{
|
2017-05-26 12:32:20 +08:00
|
|
|
Ascending,
|
|
|
|
Descending,
|
2017-05-26 11:52:01 +08:00
|
|
|
}
|
|
|
|
}
|