2019-01-24 16:43:03 +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.
|
2018-05-16 07:34:14 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
using osu.Game.Overlays.SearchableList;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-05-16 07:34:14 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multi
|
|
|
|
|
{
|
|
|
|
|
public class Header : Container
|
|
|
|
|
{
|
|
|
|
|
public const float HEIGHT = 121;
|
|
|
|
|
|
2018-05-29 15:23:29 +08:00
|
|
|
|
private readonly OsuSpriteText screenType;
|
2018-05-17 17:19:55 +08:00
|
|
|
|
private readonly HeaderBreadcrumbControl breadcrumbs;
|
2018-05-16 07:34:14 +08:00
|
|
|
|
|
2019-01-23 19:52:00 +08:00
|
|
|
|
public Header(ScreenStack stack)
|
2018-05-16 07:34:14 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = HEIGHT;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"2f2043"),
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-01-25 13:10:59 +08:00
|
|
|
|
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
2018-05-16 07:34:14 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Position = new Vector2(-35f, 5f),
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Spacing = new Vector2(10f, 0f),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(25),
|
|
|
|
|
Icon = FontAwesome.fa_osu_multi,
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "multiplayer ",
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 25)
|
2018-05-16 07:34:14 +08:00
|
|
|
|
},
|
2018-05-29 15:23:29 +08:00
|
|
|
|
screenType = new OsuSpriteText
|
2018-05-16 07:34:14 +08:00
|
|
|
|
{
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 25)
|
2018-05-16 07:34:14 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2019-01-23 19:52:00 +08:00
|
|
|
|
breadcrumbs = new HeaderBreadcrumbControl(stack)
|
2018-05-16 07:34:14 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2019-02-22 16:51:39 +08:00
|
|
|
|
breadcrumbs.Current.ValueChanged += scren =>
|
2018-12-11 16:32:01 +08:00
|
|
|
|
{
|
2019-02-22 16:51:39 +08:00
|
|
|
|
if (scren.NewValue is IMultiplayerSubScreen multiScreen)
|
|
|
|
|
screenType.Text = multiScreen.ShortTitle.ToLowerInvariant();
|
2018-12-11 16:32:01 +08:00
|
|
|
|
};
|
|
|
|
|
|
2018-05-16 07:34:14 +08:00
|
|
|
|
breadcrumbs.Current.TriggerChange();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
2018-05-29 15:23:29 +08:00
|
|
|
|
screenType.Colour = colours.Yellow;
|
2018-05-16 07:34:14 +08:00
|
|
|
|
breadcrumbs.StripColour = colours.Green;
|
|
|
|
|
}
|
2018-05-17 17:19:55 +08:00
|
|
|
|
|
|
|
|
|
private class HeaderBreadcrumbControl : ScreenBreadcrumbControl
|
|
|
|
|
{
|
2019-01-23 19:52:00 +08:00
|
|
|
|
public HeaderBreadcrumbControl(ScreenStack stack)
|
|
|
|
|
: base(stack)
|
2018-05-17 17:19:55 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
AccentColour = Color4.White;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-16 07:34:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|