From f2ff57d6b7bad548b99c4cc780e95cac9b15b687 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 28 Dec 2019 02:50:52 +0300 Subject: [PATCH] Update design of OverlayHeaderTabControl --- osu.Game/Overlays/OverlayHeader.cs | 5 ++--- osu.Game/Overlays/OverlayHeaderTabControl.cs | 21 ++++++++++++++++++++ osu.Game/Overlays/OverlayTabControl.cs | 16 +++++++++------ osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs index 7a397d10c6..d406fc2b8a 100644 --- a/osu.Game/Overlays/OverlayHeader.cs +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -89,9 +89,8 @@ namespace osu.Game.Overlays { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 30, - Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, + Height = 35, + Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN } } } }, diff --git a/osu.Game/Overlays/OverlayHeaderTabControl.cs b/osu.Game/Overlays/OverlayHeaderTabControl.cs index 7d0cdad6d8..1ddface2b7 100644 --- a/osu.Game/Overlays/OverlayHeaderTabControl.cs +++ b/osu.Game/Overlays/OverlayHeaderTabControl.cs @@ -2,22 +2,43 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.UserInterface; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osuTK; +using osu.Game.Graphics; namespace osu.Game.Overlays { public class OverlayHeaderTabControl : OverlayTabControl { + public OverlayHeaderTabControl() + { + BarHeight = 1; + RelativeSizeAxes = Axes.None; + AutoSizeAxes = Axes.X; + } + protected override TabItem CreateTabItem(string value) => new OverlayHeaderTabItem(value) { AccentColour = AccentColour, }; + protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + }; + private class OverlayHeaderTabItem : OverlayTabItem { public OverlayHeaderTabItem(string value) : base(value) { Text.Text = value; + Text.Font = OsuFont.GetFont(size: 14); + Bar.ExpandedSize = 5; } } } diff --git a/osu.Game/Overlays/OverlayTabControl.cs b/osu.Game/Overlays/OverlayTabControl.cs index 4c396eabc1..812f8963c9 100644 --- a/osu.Game/Overlays/OverlayTabControl.cs +++ b/osu.Game/Overlays/OverlayTabControl.cs @@ -43,6 +43,11 @@ namespace osu.Game.Overlays set => TabContainer.Padding = value; } + protected float BarHeight + { + set => bar.Height = value; + } + protected OverlayTabControl() { TabContainer.Masking = false; @@ -63,8 +68,7 @@ namespace osu.Game.Overlays protected class OverlayTabItem : TabItem { - private readonly ExpandingBar bar; - + protected readonly ExpandingBar Bar; protected readonly OsuSpriteText Text; private Color4 accentColour; @@ -78,7 +82,7 @@ namespace osu.Game.Overlays return; accentColour = value; - bar.Colour = value; + Bar.Colour = value; updateState(); } @@ -99,7 +103,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomLeft, Font = OsuFont.GetFont(), }, - bar = new ExpandingBar + Bar = new ExpandingBar { Anchor = Anchor.BottomCentre, ExpandedSize = 7.5f, @@ -149,13 +153,13 @@ namespace osu.Game.Overlays protected virtual void HoverAction() { - bar.Expand(); + Bar.Expand(); Text.FadeColour(Color4.White, 120, Easing.InQuad); } protected virtual void UnhoverAction() { - bar.Collapse(); + Bar.Collapse(); Text.FadeColour(AccentColour, 120, Easing.InQuad); } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 4a792f7375..077941df6c 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -30,8 +30,8 @@ namespace osu.Game.Overlays.Profile User.ValueChanged += e => updateDisplay(e.NewValue); - TabControl.AddItem("Info"); - TabControl.AddItem("Modding"); + TabControl.AddItem("info"); + TabControl.AddItem("modding"); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); }