Update design of OverlayHeaderTabControl

This commit is contained in:
Andrei Zavatski 2019-12-28 02:50:52 +03:00
parent 965b57dbb5
commit f2ff57d6b7
4 changed files with 35 additions and 11 deletions

View File

@ -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 }
}
}
},

View File

@ -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<string>
{
public OverlayHeaderTabControl()
{
BarHeight = 1;
RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.X;
}
protected override TabItem<string> 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;
}
}
}

View File

@ -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<T>
{
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);
}
}

View File

@ -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);
}