2020-07-07 18:23:11 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-07-07 18:23:11 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2022-01-28 12:53:48 +08:00
|
|
|
using osu.Framework.Localisation;
|
2020-07-07 18:23:11 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osuTK;
|
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Components
|
2020-07-07 18:23:11 +08:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A header used in the multiplayer interface which shows text / details beneath a line.
|
|
|
|
/// </summary>
|
2020-12-26 00:12:33 +08:00
|
|
|
public partial class OverlinedHeader : OnlinePlayComposite
|
2020-07-07 18:23:11 +08:00
|
|
|
{
|
|
|
|
private bool showLine = true;
|
|
|
|
|
|
|
|
public bool ShowLine
|
|
|
|
{
|
|
|
|
get => showLine;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
showLine = value;
|
|
|
|
line.Alpha = value ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Bindable<string> Details = new Bindable<string>();
|
|
|
|
|
|
|
|
private readonly Circle line;
|
|
|
|
private readonly OsuSpriteText details;
|
|
|
|
|
2022-01-28 12:53:48 +08:00
|
|
|
public OverlinedHeader(LocalisableString title)
|
2020-07-07 18:23:11 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
|
|
|
Margin = new MarginPadding { Bottom = 5 };
|
|
|
|
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
line = new Circle
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 2,
|
|
|
|
Margin = new MarginPadding { Bottom = 2 }
|
|
|
|
},
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
Margin = new MarginPadding { Top = 5 },
|
|
|
|
Spacing = new Vector2(10, 0),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = title,
|
|
|
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
|
|
|
|
},
|
|
|
|
details = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Details.BindValueChanged(val => details.Text = val.NewValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
|
|
|
line.Colour = colours.Yellow;
|
|
|
|
details.Colour = colours.Yellow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|