2019-01-24 08:43:03 +00: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-12-20 08:33:55 +00:00
|
|
|
|
2018-12-25 09:07:19 +00:00
|
|
|
using osu.Framework.Configuration;
|
2018-12-20 08:33:55 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
using osu.Game.Online.Chat;
|
|
|
|
using osu.Game.Users;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multi.Match.Components
|
|
|
|
{
|
|
|
|
public class HostInfo : CompositeDrawable
|
|
|
|
{
|
2018-12-25 09:07:19 +00:00
|
|
|
public readonly IBindable<User> Host = new Bindable<User>();
|
|
|
|
|
|
|
|
private readonly LinkFlowContainer linkContainer;
|
|
|
|
private readonly UpdateableAvatar avatar;
|
|
|
|
|
|
|
|
public HostInfo()
|
2018-12-20 08:33:55 +00:00
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.X;
|
|
|
|
Height = 50;
|
|
|
|
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
Spacing = new Vector2(5, 0),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2018-12-25 09:07:19 +00:00
|
|
|
avatar = new UpdateableAvatar { Size = new Vector2(50) },
|
2018-12-20 08:33:55 +00:00
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
2018-12-20 09:21:55 +00:00
|
|
|
Child = linkContainer = new LinkFlowContainer { AutoSizeAxes = Axes.Both }
|
2018-12-20 08:33:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-25 09:07:19 +00:00
|
|
|
Host.BindValueChanged(updateHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateHost(User host)
|
|
|
|
{
|
|
|
|
avatar.User = host;
|
|
|
|
|
|
|
|
if (host != null)
|
2018-12-21 04:26:50 +00:00
|
|
|
{
|
|
|
|
linkContainer.AddText("hosted by");
|
|
|
|
linkContainer.NewLine();
|
2018-12-25 09:07:19 +00:00
|
|
|
linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", s => s.Font = "Exo2.0-BoldItalic");
|
2018-12-21 04:26:50 +00:00
|
|
|
}
|
2018-12-20 08:33:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|