2017-05-25 02:11:07 +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-06-05 21:04:35 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-05-25 02:11:07 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-06-07 21:15:43 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Graphics;
|
2017-05-25 02:11:07 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2017-06-05 21:07:57 +08:00
|
|
|
|
using osu.Game.Users.Profile;
|
2017-05-25 02:11:07 +08:00
|
|
|
|
|
2017-05-27 23:37:15 +08:00
|
|
|
|
namespace osu.Game.Users
|
2017-05-25 02:11:07 +08:00
|
|
|
|
{
|
2017-06-05 21:07:57 +08:00
|
|
|
|
public class UserProfile : FocusedOverlayContainer
|
2017-05-25 02:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly User user;
|
2017-06-05 21:07:57 +08:00
|
|
|
|
private ProfileSection lastSection;
|
2017-06-06 11:25:16 +08:00
|
|
|
|
|
|
|
|
|
public const float CONTENT_X_MARGIN = 50;
|
|
|
|
|
|
2017-06-05 21:07:57 +08:00
|
|
|
|
public UserProfile(User user)
|
2017-05-25 02:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
this.user = user;
|
2017-06-05 21:07:57 +08:00
|
|
|
|
var tab = new OsuTabControl<ProfileSection>();
|
|
|
|
|
var sections = new ProfileSection[] { };
|
2017-06-07 21:15:43 +08:00
|
|
|
|
|
|
|
|
|
Add(new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.Gray(0.2f)
|
|
|
|
|
});
|
|
|
|
|
|
2017-05-25 02:11:07 +08:00
|
|
|
|
var sectionsContainer = new SectionsContainer
|
|
|
|
|
{
|
2017-06-05 21:04:35 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-05-27 23:37:15 +08:00
|
|
|
|
ExpandableHeader = new UserPageHeader(user),
|
2017-05-25 02:11:07 +08:00
|
|
|
|
FixedHeader = tab,
|
|
|
|
|
Sections = sections
|
|
|
|
|
};
|
|
|
|
|
Add(sectionsContainer);
|
|
|
|
|
|
|
|
|
|
sectionsContainer.SelectedSection.ValueChanged += s =>
|
|
|
|
|
{
|
|
|
|
|
if (lastSection != s)
|
|
|
|
|
{
|
2017-06-05 21:07:57 +08:00
|
|
|
|
lastSection = s as ProfileSection;
|
2017-05-25 02:11:07 +08:00
|
|
|
|
tab.Current.Value = lastSection;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
tab.Current.ValueChanged += s =>
|
|
|
|
|
{
|
|
|
|
|
if (lastSection != s)
|
|
|
|
|
{
|
|
|
|
|
lastSection = s;
|
|
|
|
|
sectionsContainer.ScrollContainer.ScrollIntoView(lastSection);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|