1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00
osu-lazer/osu.Game/Overlays/Profile/ProfileHeader.cs
2023-04-02 20:24:13 -07:00

94 lines
3.2 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Overlays.Profile.Header;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile
{
public partial class ProfileHeader : TabControlOverlayHeader<LocalisableString>
{
public Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
private CentreHeaderContainer centreHeaderContainer;
private DetailHeaderContainer detailHeaderContainer;
public ProfileHeader()
{
ContentSidePadding = WaveOverlayContainer.HORIZONTAL_PADDING;
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
// todo: pending implementation.
// TabControl.AddItem(LayoutStrings.HeaderUsersModding);
// Haphazardly guaranteed by OverlayHeader constructor (see CreateBackground / CreateContent).
Debug.Assert(centreHeaderContainer != null);
Debug.Assert(detailHeaderContainer != null);
}
protected override Drawable CreateBackground() => Empty();
protected override Drawable CreateContent() => new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new TopHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
new BannerHeaderContainer
{
User = { BindTarget = User },
},
new BadgeHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
detailHeaderContainer = new DetailHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
centreHeaderContainer = new CentreHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
new BottomHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
}
};
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
protected override Drawable CreateTabControlContent() => new ProfileRulesetSelector
{
User = { BindTarget = User }
};
private partial class ProfileHeaderTitle : OverlayTitle
{
public ProfileHeaderTitle()
{
Title = PageTitleStrings.MainUsersControllerDefault;
IconTexture = "Icons/Hexacons/profile";
}
}
}
}