mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Update layout of every overlay using OverlayHeader
This commit is contained in:
parent
647c83e6c8
commit
a1c91af095
@ -47,6 +47,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
TabControl.AccentColour = colours.Violet;
|
||||
TitleBackgroundColour = colours.GreyVioletDarker;
|
||||
ControlBackgroundColour = colours.GreyVioletDark;
|
||||
}
|
||||
|
||||
private ChangelogHeaderTitle title;
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
@ -37,9 +36,11 @@ namespace osu.Game.Overlays.News
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
TabControl.AccentColour = colour.Violet;
|
||||
TabControl.AccentColour = colours.Violet;
|
||||
TitleBackgroundColour = colours.GreyVioletDarker;
|
||||
ControlBackgroundColour = colours.GreyVioletDark;
|
||||
}
|
||||
|
||||
private void showPost(ValueChangedEvent<string> e)
|
||||
|
@ -3,7 +3,9 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -11,58 +13,93 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
protected readonly OverlayHeaderTabControl TabControl;
|
||||
|
||||
private const float cover_height = 150;
|
||||
private const float cover_info_height = 75;
|
||||
private readonly Box titleBackground;
|
||||
private readonly Box controlBackground;
|
||||
private readonly Container background;
|
||||
|
||||
protected Color4 TitleBackgroundColour
|
||||
{
|
||||
set => titleBackground.Colour = value;
|
||||
}
|
||||
|
||||
protected Color4 ControlBackgroundColour
|
||||
{
|
||||
set => controlBackground.Colour = value;
|
||||
}
|
||||
|
||||
protected float BackgroundHeight
|
||||
{
|
||||
set => background.Height = value;
|
||||
}
|
||||
|
||||
protected OverlayHeader()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
AddRange(new[]
|
||||
FillFlowContainer flow;
|
||||
|
||||
Add(flow = new FillFlowContainer
|
||||
{
|
||||
new Container
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = cover_height,
|
||||
Masking = true,
|
||||
Child = CreateBackground()
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
||||
Y = cover_height,
|
||||
Height = cover_info_height,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Depth = -float.MaxValue,
|
||||
Children = new Drawable[]
|
||||
background = new Container
|
||||
{
|
||||
CreateTitle().With(t => t.X = -ScreenTitle.ICON_WIDTH),
|
||||
TabControl = new OverlayHeaderTabControl
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 80,
|
||||
Masking = true,
|
||||
Child = CreateBackground()
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = cover_info_height - 30,
|
||||
Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN },
|
||||
Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }
|
||||
titleBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Gray,
|
||||
},
|
||||
CreateTitle().With(title =>
|
||||
{
|
||||
title.Margin = new MarginPadding
|
||||
{
|
||||
Vertical = 5,
|
||||
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
||||
};
|
||||
})
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
controlBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Gray,
|
||||
},
|
||||
TabControl = new OverlayHeaderTabControl
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 30,
|
||||
Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (CreateContent != null)
|
||||
{
|
||||
Add(new Container
|
||||
{
|
||||
Margin = new MarginPadding { Top = cover_height },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = CreateContent
|
||||
});
|
||||
};
|
||||
flow.Add(CreateContent);
|
||||
}
|
||||
|
||||
protected abstract Drawable CreateBackground();
|
||||
|
@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
public ProfileHeader()
|
||||
{
|
||||
BackgroundHeight = 150;
|
||||
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
|
||||
TabControl.AddItem("Info");
|
||||
@ -38,6 +40,8 @@ namespace osu.Game.Overlays.Profile
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
TabControl.AccentColour = colours.Seafoam;
|
||||
TitleBackgroundColour = colours.GreySeafoamDarker;
|
||||
ControlBackgroundColour = colours.GreySeafoam;
|
||||
}
|
||||
|
||||
protected override Drawable CreateBackground() =>
|
||||
@ -103,6 +107,7 @@ namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
Title = "Player";
|
||||
Section = "Info";
|
||||
X = -ICON_WIDTH;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
Loading…
Reference in New Issue
Block a user