mirror of
https://github.com/ppy/osu.git
synced 2026-05-29 02:29:54 +08:00
Switch online play screens to new header (#37074)
Specifically the one used on the daily challenge screen. Was bugging me that playlists/multi have that old yellow header design used, so I've changed it. Will probably come in handy once the footer/leaderboard changes are in. Also localized the headers while at it. Multiplayer:  Playlists:  The only thing I'm wondering about is whether the detail thing (participant count/playlist length) should be using the highlight colour here. The old design had them be yellow, but I feel like the pink on this one stands out too much. --------- Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
committed by
GitHub
Unverified
parent
98debc8d44
commit
86ef145f56
@@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -14,8 +15,20 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public partial class SectionHeader : CompositeDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// Extra text to be shown in brackets next to the header.
|
||||
/// Unlike the header itself, this can be updated during runtime.
|
||||
/// </summary>
|
||||
public readonly Bindable<string> DetailsText = new Bindable<string>();
|
||||
|
||||
private readonly LocalisableString text;
|
||||
|
||||
private OsuTextFlowContainer textFlow = null!;
|
||||
private ITextPart? detailsPart;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
public SectionHeader(LocalisableString text)
|
||||
{
|
||||
this.text = text;
|
||||
@@ -27,7 +40,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new FillFlowContainer
|
||||
{
|
||||
@@ -37,7 +50,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Spacing = new Vector2(2),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 16, weight: FontWeight.SemiBold))
|
||||
textFlow = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 16, weight: FontWeight.SemiBold))
|
||||
{
|
||||
Text = text,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@@ -51,5 +64,21 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
DetailsText.BindValueChanged(updateDetails, true);
|
||||
}
|
||||
|
||||
private void updateDetails(ValueChangedEvent<string> details)
|
||||
{
|
||||
if (detailsPart != null)
|
||||
textFlow.RemovePart(detailsPart);
|
||||
|
||||
if (!string.IsNullOrEmpty(details.NewValue))
|
||||
detailsPart = textFlow.AddText($" ({details.NewValue})", t => t.Colour = colourProvider.Highlight1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user