mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 08:33:55 +09:00
Participants
This commit is contained in:
@ -49,6 +49,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<IEnumerable<User>> Participants { get; private set; } = new Bindable<IEnumerable<User>>(Enumerable.Empty<User>());
|
public Bindable<IEnumerable<User>> Participants { get; private set; } = new Bindable<IEnumerable<User>>(Enumerable.Empty<User>());
|
||||||
|
|
||||||
|
[JsonProperty("participant_count")]
|
||||||
|
public Bindable<int> ParticipantCount { get; private set; } = new Bindable<int>();
|
||||||
|
|
||||||
[JsonProperty("duration")]
|
[JsonProperty("duration")]
|
||||||
private int duration
|
private int duration
|
||||||
{
|
{
|
||||||
@ -85,6 +88,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
Type.Value = other.Type;
|
Type.Value = other.Type;
|
||||||
|
|
||||||
MaxParticipants.Value = other.MaxParticipants;
|
MaxParticipants.Value = other.MaxParticipants;
|
||||||
|
ParticipantCount.Value = other.ParticipantCount.Value;
|
||||||
Participants.Value = other.Participants.Value.ToArray();
|
Participants.Value = other.Participants.Value.ToArray();
|
||||||
EndDate.Value = other.EndDate;
|
EndDate.Value = other.EndDate;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Multi.Components
|
namespace osu.Game.Screens.Multi.Components
|
||||||
{
|
{
|
||||||
public class ParticipantCount : CompositeDrawable
|
public class ParticipantCountDisplay : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const float text_size = 30;
|
private const float text_size = 30;
|
||||||
private const float transition_duration = 100;
|
private const float transition_duration = 100;
|
||||||
@ -19,9 +19,10 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private readonly OsuSpriteText slash, maxText;
|
private readonly OsuSpriteText slash, maxText;
|
||||||
|
|
||||||
public readonly IBindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
public readonly IBindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
||||||
|
public readonly IBindable<int> ParticipantCount = new Bindable<int>();
|
||||||
public readonly IBindable<int?> MaxParticipants = new Bindable<int?>();
|
public readonly IBindable<int?> MaxParticipants = new Bindable<int?>();
|
||||||
|
|
||||||
public ParticipantCount()
|
public ParticipantCountDisplay()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
Participants.BindValueChanged(v => count.Text = v.Count().ToString());
|
Participants.BindValueChanged(v => count.Text = v.Count().ToString());
|
||||||
MaxParticipants.BindValueChanged(_ => updateMax(), true);
|
MaxParticipants.BindValueChanged(_ => updateMax(), true);
|
||||||
|
ParticipantCount.BindValueChanged(v => count.Text = v.ToString("#,0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMax()
|
private void updateMax()
|
||||||
|
@ -217,6 +217,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
modeTypeInfo.Type.BindTo(bindings.Type);
|
modeTypeInfo.Type.BindTo(bindings.Type);
|
||||||
participantInfo.Host.BindTo(bindings.Host);
|
participantInfo.Host.BindTo(bindings.Host);
|
||||||
participantInfo.Participants.BindTo(bindings.Participants);
|
participantInfo.Participants.BindTo(bindings.Participants);
|
||||||
|
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
|
||||||
|
|
||||||
bindings.Name.BindValueChanged(n => name.Text = n, true);
|
bindings.Name.BindValueChanged(n => name.Text = n, true);
|
||||||
bindings.EndDate.BindValueChanged(d => endDate.Date = d, true);
|
bindings.EndDate.BindValueChanged(d => endDate.Date = d, true);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
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<User> Host = new Bindable<User>();
|
||||||
public readonly IBindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
public readonly IBindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
||||||
|
public readonly IBindable<int> ParticipantCount = new Bindable<int>();
|
||||||
|
|
||||||
public ParticipantInfo()
|
public ParticipantInfo()
|
||||||
{
|
{
|
||||||
|
OsuSpriteText summary;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 15f;
|
Height = 15f;
|
||||||
|
|
||||||
@ -78,7 +81,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
summary = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "0 participants",
|
Text = "0 participants",
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
@ -96,6 +99,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
|
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}");
|
||||||
|
|
||||||
/*Participants.BindValueChanged(v =>
|
/*Participants.BindValueChanged(v =>
|
||||||
{
|
{
|
||||||
var ranks = v.Select(u => u.Statistics.Ranks.Global);
|
var ranks = v.Select(u => u.Statistics.Ranks.Global);
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
private OsuColour colours;
|
private OsuColour colours;
|
||||||
private Box statusStrip;
|
private Box statusStrip;
|
||||||
private UpdateableBeatmapBackgroundSprite background;
|
private UpdateableBeatmapBackgroundSprite background;
|
||||||
private ParticipantCount participantCount;
|
private ParticipantCountDisplay participantCount;
|
||||||
private FillFlowContainer topFlow, participantsFlow;
|
private FillFlowContainer topFlow, participantsFlow;
|
||||||
private OsuSpriteText name, status;
|
private OsuSpriteText name, status;
|
||||||
private BeatmapTypeInfo beatmapTypeInfo;
|
private BeatmapTypeInfo beatmapTypeInfo;
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
Padding = new MarginPadding(20),
|
Padding = new MarginPadding(20),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
participantCount = new ParticipantCount
|
participantCount = new ParticipantCountDisplay
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
@ -167,9 +167,12 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
};
|
};
|
||||||
|
|
||||||
participantInfo.Host.BindTo(bindings.Host);
|
participantInfo.Host.BindTo(bindings.Host);
|
||||||
|
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
|
||||||
participantInfo.Participants.BindTo(bindings.Participants);
|
participantInfo.Participants.BindTo(bindings.Participants);
|
||||||
|
|
||||||
participantCount.Participants.BindTo(bindings.Participants);
|
participantCount.Participants.BindTo(bindings.Participants);
|
||||||
participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
|
participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
|
||||||
|
|
||||||
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
||||||
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||||
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||||
|
@ -16,12 +16,13 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
public class Participants : CompositeDrawable
|
public class Participants : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly IBindable<IEnumerable<User>> Users = new Bindable<IEnumerable<User>>();
|
public readonly IBindable<IEnumerable<User>> Users = new Bindable<IEnumerable<User>>();
|
||||||
|
public readonly IBindable<int> ParticipantCount = new Bindable<int>();
|
||||||
public readonly IBindable<int?> MaxParticipants = new Bindable<int?>();
|
public readonly IBindable<int?> MaxParticipants = new Bindable<int?>();
|
||||||
|
|
||||||
public Participants()
|
public Participants()
|
||||||
{
|
{
|
||||||
FillFlowContainer<UserPanel> usersFlow;
|
FillFlowContainer<UserPanel> usersFlow;
|
||||||
ParticipantCount count;
|
ParticipantCountDisplay count;
|
||||||
|
|
||||||
InternalChild = new Container
|
InternalChild = new Container
|
||||||
{
|
{
|
||||||
@ -35,7 +36,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
Padding = new MarginPadding { Top = 10 },
|
Padding = new MarginPadding { Top = 10 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
count = new ParticipantCount
|
count = new ParticipantCountDisplay
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
@ -55,6 +56,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
};
|
};
|
||||||
|
|
||||||
count.Participants.BindTo(Users);
|
count.Participants.BindTo(Users);
|
||||||
|
count.ParticipantCount.BindTo(ParticipantCount);
|
||||||
count.MaxParticipants.BindTo(MaxParticipants);
|
count.MaxParticipants.BindTo(MaxParticipants);
|
||||||
|
|
||||||
Users.BindValueChanged(v =>
|
Users.BindValueChanged(v =>
|
||||||
|
@ -45,6 +45,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
Type.UnbindFrom(room.Type);
|
Type.UnbindFrom(room.Type);
|
||||||
Playlist.UnbindFrom(room.Playlist);
|
Playlist.UnbindFrom(room.Playlist);
|
||||||
Participants.UnbindFrom(room.Participants);
|
Participants.UnbindFrom(room.Participants);
|
||||||
|
ParticipantCount.UnbindFrom(room.ParticipantCount);
|
||||||
MaxParticipants.UnbindFrom(room.MaxParticipants);
|
MaxParticipants.UnbindFrom(room.MaxParticipants);
|
||||||
EndDate.UnbindFrom(room.EndDate);
|
EndDate.UnbindFrom(room.EndDate);
|
||||||
Availability.UnbindFrom(room.Availability);
|
Availability.UnbindFrom(room.Availability);
|
||||||
@ -61,6 +62,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
Type.BindTo(room.Type);
|
Type.BindTo(room.Type);
|
||||||
Playlist.BindTo(room.Playlist);
|
Playlist.BindTo(room.Playlist);
|
||||||
Participants.BindTo(room.Participants);
|
Participants.BindTo(room.Participants);
|
||||||
|
ParticipantCount.BindTo(room.ParticipantCount);
|
||||||
MaxParticipants.BindTo(room.MaxParticipants);
|
MaxParticipants.BindTo(room.MaxParticipants);
|
||||||
EndDate.BindTo(room.EndDate);
|
EndDate.BindTo(room.EndDate);
|
||||||
Availability.BindTo(room.Availability);
|
Availability.BindTo(room.Availability);
|
||||||
@ -86,6 +88,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
public readonly Bindable<GameType> Type = new Bindable<GameType>();
|
public readonly Bindable<GameType> Type = new Bindable<GameType>();
|
||||||
public readonly BindableCollection<PlaylistItem> Playlist = new BindableCollection<PlaylistItem>();
|
public readonly BindableCollection<PlaylistItem> Playlist = new BindableCollection<PlaylistItem>();
|
||||||
public readonly Bindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
public readonly Bindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
|
||||||
|
public readonly Bindable<int> ParticipantCount = new Bindable<int>();
|
||||||
public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();
|
public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();
|
||||||
public readonly Bindable<DateTimeOffset> EndDate = new Bindable<DateTimeOffset>();
|
public readonly Bindable<DateTimeOffset> EndDate = new Bindable<DateTimeOffset>();
|
||||||
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
|
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
|
||||||
|
Reference in New Issue
Block a user