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