1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 07:27:25 +08:00
osu-lazer/osu.Game/Users/UserProfile.cs

54 lines
1.6 KiB
C#
Raw Normal View History

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;
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
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-05-25 02:11:07 +08:00
var sectionsContainer = new SectionsContainer
{
2017-06-05 21:04:35 +08:00
RelativeSizeAxes = Axes.Both,
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);
}
};
}
}
}