1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 14:07:24 +08:00
osu-lazer/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs

114 lines
4.0 KiB
C#
Raw Normal View History

2018-04-13 17:19:50 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
2018-12-20 17:04:35 +08:00
using osu.Game.Graphics.Containers;
2018-04-13 17:19:50 +08:00
using osu.Game.Graphics.Sprites;
2018-12-20 17:04:35 +08:00
using osu.Game.Online.Chat;
2018-04-13 17:19:50 +08:00
using osu.Game.Users;
2018-11-20 15:51:59 +08:00
using osuTK;
2018-04-13 17:19:50 +08:00
2018-12-10 18:20:41 +08:00
namespace osu.Game.Screens.Multi.Lounge.Components
2018-04-13 17:19:50 +08:00
{
public class ParticipantInfo : Container
{
2018-12-26 19:31:04 +08:00
private readonly FillFlowContainer summaryContainer;
2018-04-13 17:19:50 +08:00
2018-12-22 13:01:06 +08:00
public readonly IBindable<User> Host = new Bindable<User>();
public readonly IBindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
2018-04-13 17:19:50 +08:00
2018-12-26 19:31:04 +08:00
public ParticipantInfo()
2018-04-13 17:19:50 +08:00
{
RelativeSizeAxes = Axes.X;
Height = 15f;
OsuSpriteText levelRangeHigher;
OsuSpriteText levelRangeLower;
Container flagContainer;
2018-12-20 17:04:35 +08:00
LinkFlowContainer hostText;
2018-04-13 17:19:50 +08:00
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5f, 0f),
Children = new Drawable[]
{
flagContainer = new Container
{
Width = 22f,
RelativeSizeAxes = Axes.Y,
},
2018-12-26 19:31:04 +08:00
/*new Container //todo: team banners
2018-04-13 17:19:50 +08:00
{
Width = 38f,
RelativeSizeAxes = Axes.Y,
CornerRadius = 2f,
Masking = true,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"ad387e"),
},
},
2018-12-26 19:31:04 +08:00
},*/
2018-12-20 17:04:35 +08:00
hostText = new LinkFlowContainer
2018-04-13 17:19:50 +08:00
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2018-12-20 17:04:35 +08:00
AutoSizeAxes = Axes.Both
}
2018-04-13 17:19:50 +08:00
},
},
2018-12-26 19:31:04 +08:00
summaryContainer = new FillFlowContainer
2018-04-13 17:19:50 +08:00
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = new[]
{
new OsuSpriteText
{
2018-12-26 19:31:04 +08:00
Text = "0 participants",
2018-04-13 17:19:50 +08:00
TextSize = 14,
2018-12-26 19:31:04 +08:00
}
2018-04-13 17:19:50 +08:00
},
},
};
Host.BindValueChanged(v =>
{
2018-12-20 17:04:35 +08:00
hostText.Clear();
hostText.AddText("hosted by ");
hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic");
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
});
2018-12-26 19:31:04 +08:00
/*Participants.BindValueChanged(v =>
{
var ranks = v.Select(u => u.Statistics.Ranks.Global);
levelRangeLower.Text = ranks.Min().ToString();
levelRangeHigher.Text = ranks.Max().ToString();
2018-12-26 19:31:04 +08:00
});*/
2018-04-13 17:19:50 +08:00
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
2018-12-26 19:31:04 +08:00
summaryContainer.Colour = colours.Gray9;
2018-04-13 17:19:50 +08:00
}
}
}