mirror of
https://github.com/ppy/osu
synced 2025-01-24 23:03:14 +00:00
Cleanup centre header container
This commit is contained in:
parent
9d5b81165e
commit
2caea38f8c
@ -35,6 +35,8 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
iconColour = colours.CommunityUserGrayGreenLighter;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -65,8 +67,6 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
}
|
||||
};
|
||||
|
||||
iconColour = colours.CommunityUserGrayGreenLighter;
|
||||
|
||||
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -21,8 +20,8 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
public class CentreHeaderContainer : CompositeDrawable
|
||||
{
|
||||
public Action<bool> DetailsVisibilityAction;
|
||||
private bool detailsVisible;
|
||||
public readonly BindableBool DetailsVisible = new BindableBool(true);
|
||||
public readonly Bindable<User> User = new Bindable<User>();
|
||||
|
||||
private OsuSpriteText followerText;
|
||||
private OsuSpriteText levelBadgeText;
|
||||
@ -30,18 +29,20 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
private Bar levelProgressBar;
|
||||
private OsuSpriteText levelProgressText;
|
||||
|
||||
private OverlinedInfoContainer hiddenDetailGlobal, hiddenDetailCountry;
|
||||
private OverlinedInfoContainer hiddenDetailGlobal;
|
||||
private OverlinedInfoContainer hiddenDetailCountry;
|
||||
|
||||
public readonly Bindable<User> User = new Bindable<User>();
|
||||
public CentreHeaderContainer()
|
||||
{
|
||||
Height = 60;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, TextureStore textures)
|
||||
{
|
||||
Container<Drawable> hiddenDetailContainer, expandedDetailContainer;
|
||||
Container<Drawable> hiddenDetailContainer;
|
||||
Container<Drawable> expandedDetailContainer;
|
||||
SpriteIcon expandButtonIcon;
|
||||
ProfileHeaderButton detailsToggleButton;
|
||||
Height = 60;
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -105,11 +106,12 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Vertical = 10 },
|
||||
Width = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||
Child = detailsToggleButton = new ExpandButton
|
||||
Child = new ExpandButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Action = () => DetailsVisible.Toggle(),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
expandButtonIcon = new SpriteIcon
|
||||
@ -210,14 +212,14 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
}
|
||||
};
|
||||
|
||||
detailsToggleButton.Action = () =>
|
||||
DetailsVisible.BindValueChanged(visible =>
|
||||
{
|
||||
detailsVisible = !detailsVisible;
|
||||
expandButtonIcon.Icon = detailsVisible ? FontAwesome.Solid.ChevronDown : FontAwesome.Solid.ChevronUp;
|
||||
hiddenDetailContainer.Alpha = detailsVisible ? 1 : 0;
|
||||
expandedDetailContainer.Alpha = detailsVisible ? 0 : 1;
|
||||
DetailsVisibilityAction(detailsVisible);
|
||||
};
|
||||
expandButtonIcon.Icon = visible.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
||||
hiddenDetailContainer.Alpha = visible.NewValue ? 1 : 0;
|
||||
expandedDetailContainer.Alpha = visible.NewValue ? 0 : 1;
|
||||
}, true);
|
||||
|
||||
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
||||
}
|
||||
|
||||
private void updateDisplay(User user)
|
||||
|
@ -13,7 +13,8 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
public class OverlinedInfoContainer : CompositeDrawable
|
||||
{
|
||||
private readonly Circle line;
|
||||
private readonly OsuSpriteText title, content;
|
||||
private readonly OsuSpriteText title;
|
||||
private readonly OsuSpriteText content;
|
||||
|
||||
public string Title
|
||||
{
|
||||
|
@ -22,11 +22,11 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
|
||||
public ProfileHeaderButton()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
|
||||
IdleColour = Color4.Black;
|
||||
HoverColour = OsuColour.Gray(0.1f);
|
||||
|
||||
AutoSizeAxes = Axes.X;
|
||||
|
||||
base.Content.Add(new CircularContainer
|
||||
{
|
||||
Masking = true,
|
||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Profile
|
||||
infoTabControl.AddItem("Info");
|
||||
infoTabControl.AddItem("Modding");
|
||||
|
||||
centreHeaderContainer.DetailsVisibilityAction = visible => detailHeaderContainer.Alpha = visible ? 0 : 1;
|
||||
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Alpha = visible.NewValue ? 1 : 0, true);
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user