Add host under room title

This commit is contained in:
smoogipoo
2021-07-12 16:28:22 +09:00
parent 4ac812de86
commit aba09b20a5
2 changed files with 62 additions and 11 deletions

View File

@ -187,11 +187,17 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
},
}
},
new RoomName
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 28)
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new RoomNameText(),
new RoomHostText()
}
},
new FillFlowContainer
{
@ -262,11 +268,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
protected override bool ShouldBeConsideredForInput(Drawable child) => state == SelectionState.Selected;
private class RoomName : OsuSpriteText
private class RoomNameText : OsuSpriteText
{
[Resolved(typeof(Room), nameof(Online.Rooms.Room.Name))]
private Bindable<string> name { get; set; }
public RoomNameText()
{
Font = OsuFont.GetFont(size: 24);
}
[BackgroundDependencyLoader]
private void load()
{
@ -274,6 +285,41 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
}
private class RoomHostText : OnlinePlayComposite
{
private LinkFlowContainer hostText;
public RoomHostText()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
AutoSizeAxes = Axes.Both
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Host.BindValueChanged(host =>
{
hostText.Clear();
if (host.NewValue != null)
{
hostText.AddText("hosted by ");
hostText.AddUserLink(host.NewValue);
}
}, true);
}
}
public MenuItem[] ContextMenuItems => new MenuItem[]
{
new OsuMenuItem("Create copy", MenuItemType.Standard, () =>