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-29 09:11:01 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics;
|
2020-02-14 19:07:52 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Users.Drawables;
|
2018-12-20 14:17:33 +08:00
|
|
|
|
using osuTK;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
|
2018-12-10 18:20:41 +08:00
|
|
|
|
namespace osu.Game.Screens.Multi.Match.Components
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2019-02-05 18:00:01 +08:00
|
|
|
|
public class Header : MultiplayerComposite
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
public const float HEIGHT = 50;
|
2018-05-29 12:51:04 +08:00
|
|
|
|
|
2020-02-14 19:07:52 +08:00
|
|
|
|
private UpdateableAvatar avatar;
|
|
|
|
|
private LinkFlowContainer hostText;
|
2019-08-08 12:08:51 +08:00
|
|
|
|
|
2019-02-05 18:00:01 +08:00
|
|
|
|
public Header()
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-05-29 12:51:04 +08:00
|
|
|
|
Height = HEIGHT;
|
2019-02-05 18:00:01 +08:00
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
|
2019-02-05 18:00:01 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
InternalChild = new FillFlowContainer
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Spacing = new Vector2(10, 0),
|
|
|
|
|
Children = new Drawable[]
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
avatar = new UpdateableAvatar
|
2018-12-20 14:17:33 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
Size = new Vector2(50),
|
|
|
|
|
Masking = true,
|
|
|
|
|
CornerRadius = 10,
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
2018-12-20 14:17:33 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
new OsuSpriteText
|
2018-12-20 14:17:33 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 30),
|
|
|
|
|
Current = { BindTarget = RoomName }
|
2018-05-29 09:11:01 +08:00
|
|
|
|
},
|
2020-06-25 21:06:28 +08:00
|
|
|
|
hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20))
|
2020-02-14 19:07:52 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
};
|
2018-06-02 03:23:11 +08:00
|
|
|
|
|
2020-02-14 19:07:52 +08:00
|
|
|
|
Host.BindValueChanged(host =>
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2020-02-14 19:07:52 +08:00
|
|
|
|
avatar.User = host.NewValue;
|
2018-12-10 18:03:22 +08:00
|
|
|
|
|
2020-02-14 19:07:52 +08:00
|
|
|
|
hostText.Clear();
|
2018-12-06 17:31:12 +08:00
|
|
|
|
|
2020-02-14 19:07:52 +08:00
|
|
|
|
if (host.NewValue != null)
|
|
|
|
|
{
|
|
|
|
|
hostText.AddText("hosted by ");
|
2020-06-25 21:06:28 +08:00
|
|
|
|
hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(weight: FontWeight.SemiBold));
|
2020-02-14 19:07:52 +08:00
|
|
|
|
}
|
|
|
|
|
}, true);
|
2018-12-06 17:31:12 +08:00
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|