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