mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 05:22:54 +08:00
Adjust appearance of section navigation
This commit is contained in:
parent
49e08c06a6
commit
3f81f173fb
@ -12,7 +12,9 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
@ -171,46 +173,72 @@ namespace osu.Game.Overlays
|
|||||||
loadingLayer.Hide();
|
loadingLayer.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class ProfileSectionTabControl : OverlayTabControl<ProfileSection>
|
private partial class ProfileSectionTabControl : OsuTabControl<ProfileSection>
|
||||||
{
|
{
|
||||||
private const float bar_height = 2;
|
|
||||||
|
|
||||||
public ProfileSectionTabControl()
|
public ProfileSectionTabControl()
|
||||||
{
|
{
|
||||||
TabContainer.RelativeSizeAxes &= ~Axes.X;
|
Height = 40;
|
||||||
TabContainer.AutoSizeAxes |= Axes.X;
|
Padding = new MarginPadding { Horizontal = CONTENT_X_MARGIN };
|
||||||
TabContainer.Anchor |= Anchor.x1;
|
TabContainer.Spacing = new Vector2(20);
|
||||||
TabContainer.Origin |= Anchor.x1;
|
|
||||||
|
|
||||||
Height = 36 + bar_height;
|
|
||||||
BarHeight = bar_height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileSectionTabItem(value)
|
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileSectionTabItem(value);
|
||||||
{
|
|
||||||
AccentColour = AccentColour,
|
|
||||||
};
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
|
||||||
AccentColour = colourProvider.Highlight1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => true;
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e) => true;
|
protected override bool OnHover(HoverEvent e) => true;
|
||||||
|
|
||||||
private partial class ProfileSectionTabItem : OverlayTabItem
|
private partial class ProfileSectionTabItem : TabItem<ProfileSection>
|
||||||
{
|
{
|
||||||
|
private OsuSpriteText text = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
public ProfileSectionTabItem(ProfileSection value)
|
public ProfileSectionTabItem(ProfileSection value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
Text.Text = value.Title;
|
}
|
||||||
Text.Font = Text.Font.With(size: 16);
|
|
||||||
Text.Margin = new MarginPadding { Bottom = 10 + bar_height };
|
[BackgroundDependencyLoader]
|
||||||
Bar.ExpandedSize = 10;
|
private void load()
|
||||||
Bar.Margin = new MarginPadding { Bottom = bar_height };
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Anchor = Anchor.CentreLeft;
|
||||||
|
Origin = Anchor.CentreLeft;
|
||||||
|
|
||||||
|
InternalChild = text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = Value.Title
|
||||||
|
};
|
||||||
|
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnActivated() => updateState();
|
||||||
|
|
||||||
|
protected override void OnDeactivated() => updateState();
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e) => updateState();
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
text.Font = OsuFont.Default.With(size: 14, weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
|
||||||
|
|
||||||
|
Colour4 textColour;
|
||||||
|
|
||||||
|
if (IsHovered)
|
||||||
|
textColour = colourProvider.Light1;
|
||||||
|
else
|
||||||
|
textColour = Active.Value ? colourProvider.Content1 : colourProvider.Light2;
|
||||||
|
|
||||||
|
text.FadeColour(textColour, 300, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user