Participants

This commit is contained in:
Dean Herbert
2018-12-26 21:58:14 +09:00
parent bf9954aede
commit a1fa914c66
7 changed files with 27 additions and 7 deletions

View File

@ -217,6 +217,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
modeTypeInfo.Type.BindTo(bindings.Type);
participantInfo.Host.BindTo(bindings.Host);
participantInfo.Participants.BindTo(bindings.Participants);
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
bindings.Name.BindValueChanged(n => name.Text = n, true);
bindings.EndDate.BindValueChanged(d => endDate.Date = d, true);

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -21,9 +22,11 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public readonly IBindable<User> Host = new Bindable<User>();
public readonly IBindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
public readonly IBindable<int> ParticipantCount = new Bindable<int>();
public ParticipantInfo()
{
OsuSpriteText summary;
RelativeSizeAxes = Axes.X;
Height = 15f;
@ -78,7 +81,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Direction = FillDirection.Horizontal,
Children = new[]
{
new OsuSpriteText
summary = new OsuSpriteText
{
Text = "0 participants",
TextSize = 14,
@ -96,6 +99,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
});
ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}");
/*Participants.BindValueChanged(v =>
{
var ranks = v.Select(u => u.Statistics.Ranks.Global);

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
private OsuColour colours;
private Box statusStrip;
private UpdateableBeatmapBackgroundSprite background;
private ParticipantCount participantCount;
private ParticipantCountDisplay participantCount;
private FillFlowContainer topFlow, participantsFlow;
private OsuSpriteText name, status;
private BeatmapTypeInfo beatmapTypeInfo;
@ -84,7 +84,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Padding = new MarginPadding(20),
Children = new Drawable[]
{
participantCount = new ParticipantCount
participantCount = new ParticipantCountDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
@ -167,9 +167,12 @@ namespace osu.Game.Screens.Multi.Lounge.Components
};
participantInfo.Host.BindTo(bindings.Host);
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
participantInfo.Participants.BindTo(bindings.Participants);
participantCount.Participants.BindTo(bindings.Participants);
participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
beatmapTypeInfo.Type.BindTo(bindings.Type);
background.Beatmap.BindTo(bindings.CurrentBeatmap);
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);