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("Orange OverlayHeader (no background)", new TestNoBackgroundHeader(), OverlayColourScheme.Orange);
|
||||||
addHeader("Blue OverlayHeader", new TestNoControlHeader(), OverlayColourScheme.Blue);
|
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("Pink TabControlOverlayHeader (enum)", new TestEnumTabControlHeader(), OverlayColourScheme.Pink);
|
||||||
addHeader("Red BreadcrumbControlOverlayHeader (no background)", new TestBreadcrumbControlHeader(), OverlayColourScheme.Red);
|
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 ScreenTitle CreateTitle() => new TestTitle();
|
||||||
|
|
||||||
|
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector();
|
||||||
|
|
||||||
public TestStringTabControlHeader()
|
public TestStringTabControlHeader()
|
||||||
{
|
{
|
||||||
TabControl.AddItem("tab1");
|
TabControl.AddItem("tab1");
|
||||||
|
@ -50,14 +50,29 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Gray,
|
Colour = Color4.Gray,
|
||||||
},
|
},
|
||||||
title = CreateTitle().With(title =>
|
new Container
|
||||||
{
|
{
|
||||||
title.Margin = new MarginPadding
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
|
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||||
Vertical = 10,
|
Vertical = 10,
|
||||||
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
},
|
||||||
};
|
Children = new[]
|
||||||
})
|
{
|
||||||
|
title = CreateTitle().With(title =>
|
||||||
|
{
|
||||||
|
title.Anchor = Anchor.CentreLeft;
|
||||||
|
title.Origin = Anchor.CentreLeft;
|
||||||
|
}),
|
||||||
|
CreateTitleContent().With(content =>
|
||||||
|
{
|
||||||
|
content.Anchor = Anchor.CentreRight;
|
||||||
|
content.Origin = Anchor.CentreRight;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -75,10 +90,16 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
protected virtual Drawable CreateContent() => Drawable.Empty();
|
protected virtual Drawable CreateContent() => Empty();
|
||||||
|
|
||||||
[NotNull]
|
[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();
|
protected abstract ScreenTitle CreateTitle();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user