mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:53:23 +08: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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
iconColour = colours.CommunityUserGrayGreenLighter;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -65,8 +67,6 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
iconColour = colours.CommunityUserGrayGreenLighter;
|
|
||||||
|
|
||||||
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -21,8 +20,8 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
public class CentreHeaderContainer : CompositeDrawable
|
public class CentreHeaderContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
public Action<bool> DetailsVisibilityAction;
|
public readonly BindableBool DetailsVisible = new BindableBool(true);
|
||||||
private bool detailsVisible;
|
public readonly Bindable<User> User = new Bindable<User>();
|
||||||
|
|
||||||
private OsuSpriteText followerText;
|
private OsuSpriteText followerText;
|
||||||
private OsuSpriteText levelBadgeText;
|
private OsuSpriteText levelBadgeText;
|
||||||
@ -30,18 +29,20 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
private Bar levelProgressBar;
|
private Bar levelProgressBar;
|
||||||
private OsuSpriteText levelProgressText;
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, TextureStore textures)
|
private void load(OsuColour colours, TextureStore textures)
|
||||||
{
|
{
|
||||||
Container<Drawable> hiddenDetailContainer, expandedDetailContainer;
|
Container<Drawable> hiddenDetailContainer;
|
||||||
|
Container<Drawable> expandedDetailContainer;
|
||||||
SpriteIcon expandButtonIcon;
|
SpriteIcon expandButtonIcon;
|
||||||
ProfileHeaderButton detailsToggleButton;
|
|
||||||
Height = 60;
|
|
||||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -105,11 +106,12 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding { Vertical = 10 },
|
Padding = new MarginPadding { Vertical = 10 },
|
||||||
Width = UserProfileOverlay.CONTENT_X_MARGIN,
|
Width = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||||
Child = detailsToggleButton = new ExpandButton
|
Child = new ExpandButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Action = () => DetailsVisible.Toggle(),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
expandButtonIcon = new SpriteIcon
|
expandButtonIcon = new SpriteIcon
|
||||||
@ -210,14 +212,14 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
detailsToggleButton.Action = () =>
|
DetailsVisible.BindValueChanged(visible =>
|
||||||
{
|
{
|
||||||
detailsVisible = !detailsVisible;
|
expandButtonIcon.Icon = visible.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
||||||
expandButtonIcon.Icon = detailsVisible ? FontAwesome.Solid.ChevronDown : FontAwesome.Solid.ChevronUp;
|
hiddenDetailContainer.Alpha = visible.NewValue ? 1 : 0;
|
||||||
hiddenDetailContainer.Alpha = detailsVisible ? 1 : 0;
|
expandedDetailContainer.Alpha = visible.NewValue ? 0 : 1;
|
||||||
expandedDetailContainer.Alpha = detailsVisible ? 0 : 1;
|
}, true);
|
||||||
DetailsVisibilityAction(detailsVisible);
|
|
||||||
};
|
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay(User user)
|
private void updateDisplay(User user)
|
||||||
|
@ -13,7 +13,8 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
public class OverlinedInfoContainer : CompositeDrawable
|
public class OverlinedInfoContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly Circle line;
|
private readonly Circle line;
|
||||||
private readonly OsuSpriteText title, content;
|
private readonly OsuSpriteText title;
|
||||||
|
private readonly OsuSpriteText content;
|
||||||
|
|
||||||
public string Title
|
public string Title
|
||||||
{
|
{
|
||||||
|
@ -22,11 +22,11 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
|
|
||||||
public ProfileHeaderButton()
|
public ProfileHeaderButton()
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.X;
|
||||||
|
|
||||||
IdleColour = Color4.Black;
|
IdleColour = Color4.Black;
|
||||||
HoverColour = OsuColour.Gray(0.1f);
|
HoverColour = OsuColour.Gray(0.1f);
|
||||||
|
|
||||||
AutoSizeAxes = Axes.X;
|
|
||||||
|
|
||||||
base.Content.Add(new CircularContainer
|
base.Content.Add(new CircularContainer
|
||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
infoTabControl.AddItem("Info");
|
infoTabControl.AddItem("Info");
|
||||||
infoTabControl.AddItem("Modding");
|
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);
|
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user