mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Merge pull request #7716 from EVAST9919/overlay-header-ruleset-selector
Add ability to create ruleset selector in OverlayHeader
This commit is contained in:
commit
76ba0b833e
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
addHeader("Orange OverlayHeader (no background)", new TestNoBackgroundHeader(), OverlayColourScheme.Orange);
|
||||
addHeader("Blue OverlayHeader", new TestNoControlHeader(), OverlayColourScheme.Blue);
|
||||
addHeader("Green TabControlOverlayHeader (string)", new TestStringTabControlHeader(), OverlayColourScheme.Green);
|
||||
addHeader("Green TabControlOverlayHeader (string) with ruleset selector", new TestStringTabControlHeader(), OverlayColourScheme.Green);
|
||||
addHeader("Pink TabControlOverlayHeader (enum)", new TestEnumTabControlHeader(), OverlayColourScheme.Pink);
|
||||
addHeader("Red BreadcrumbControlOverlayHeader (no background)", new TestBreadcrumbControlHeader(), OverlayColourScheme.Red);
|
||||
}
|
||||
@ -116,6 +116,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
protected override ScreenTitle CreateTitle() => new TestTitle();
|
||||
|
||||
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector();
|
||||
|
||||
public TestStringTabControlHeader()
|
||||
{
|
||||
TabControl.AddItem("tab1");
|
||||
|
@ -50,15 +50,30 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Gray,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||
Vertical = 10,
|
||||
},
|
||||
Children = new[]
|
||||
{
|
||||
title = CreateTitle().With(title =>
|
||||
{
|
||||
title.Margin = new MarginPadding
|
||||
title.Anchor = Anchor.CentreLeft;
|
||||
title.Origin = Anchor.CentreLeft;
|
||||
}),
|
||||
CreateTitleContent().With(content =>
|
||||
{
|
||||
Vertical = 10,
|
||||
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
||||
};
|
||||
content.Anchor = Anchor.CentreRight;
|
||||
content.Origin = Anchor.CentreRight;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -75,10 +90,16 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
protected virtual Drawable CreateContent() => Drawable.Empty();
|
||||
protected virtual Drawable CreateContent() => Empty();
|
||||
|
||||
[NotNull]
|
||||
protected virtual Drawable CreateBackground() => Drawable.Empty();
|
||||
protected virtual Drawable CreateBackground() => Empty();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="ScreenTitle"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
protected virtual Drawable CreateTitleContent() => Empty();
|
||||
|
||||
protected abstract ScreenTitle CreateTitle();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user