1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 01:23:24 +08:00

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, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X, Height = 35,
Height = 30, Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }
Padding = 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osuTK;
using osu.Game.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class OverlayHeaderTabControl : OverlayTabControl<string> 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) protected override TabItem<string> CreateTabItem(string value) => new OverlayHeaderTabItem(value)
{ {
AccentColour = AccentColour, 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 private class OverlayHeaderTabItem : OverlayTabItem
{ {
public OverlayHeaderTabItem(string value) public OverlayHeaderTabItem(string value)
: base(value) : base(value)
{ {
Text.Text = 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; set => TabContainer.Padding = value;
} }
protected float BarHeight
{
set => bar.Height = value;
}
protected OverlayTabControl() protected OverlayTabControl()
{ {
TabContainer.Masking = false; TabContainer.Masking = false;
@ -63,8 +68,7 @@ namespace osu.Game.Overlays
protected class OverlayTabItem : TabItem<T> protected class OverlayTabItem : TabItem<T>
{ {
private readonly ExpandingBar bar; protected readonly ExpandingBar Bar;
protected readonly OsuSpriteText Text; protected readonly OsuSpriteText Text;
private Color4 accentColour; private Color4 accentColour;
@ -78,7 +82,7 @@ namespace osu.Game.Overlays
return; return;
accentColour = value; accentColour = value;
bar.Colour = value; Bar.Colour = value;
updateState(); updateState();
} }
@ -99,7 +103,7 @@ namespace osu.Game.Overlays
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Font = OsuFont.GetFont(), Font = OsuFont.GetFont(),
}, },
bar = new ExpandingBar Bar = new ExpandingBar
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
ExpandedSize = 7.5f, ExpandedSize = 7.5f,
@ -149,13 +153,13 @@ namespace osu.Game.Overlays
protected virtual void HoverAction() protected virtual void HoverAction()
{ {
bar.Expand(); Bar.Expand();
Text.FadeColour(Color4.White, 120, Easing.InQuad); Text.FadeColour(Color4.White, 120, Easing.InQuad);
} }
protected virtual void UnhoverAction() protected virtual void UnhoverAction()
{ {
bar.Collapse(); Bar.Collapse();
Text.FadeColour(AccentColour, 120, Easing.InQuad); Text.FadeColour(AccentColour, 120, Easing.InQuad);
} }
} }

View File

@ -30,8 +30,8 @@ namespace osu.Game.Overlays.Profile
User.ValueChanged += e => updateDisplay(e.NewValue); User.ValueChanged += e => updateDisplay(e.NewValue);
TabControl.AddItem("Info"); TabControl.AddItem("info");
TabControl.AddItem("Modding"); TabControl.AddItem("modding");
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
} }