2019-01-24 16:43:03 +08: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-05-29 13:42:52 +08:00
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2018-12-07 15:20:05 +08:00
|
|
|
|
using osu.Framework.Configuration;
|
2018-05-29 13:42:52 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Overlays.SearchableList;
|
|
|
|
|
using osu.Game.Screens.Multi.Components;
|
|
|
|
|
using osu.Game.Users;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-05-29 13:42:52 +08:00
|
|
|
|
|
2018-12-10 18:20:41 +08:00
|
|
|
|
namespace osu.Game.Screens.Multi.Match.Components
|
2018-05-29 13:42:52 +08:00
|
|
|
|
{
|
2018-12-07 15:20:05 +08:00
|
|
|
|
public class Participants : CompositeDrawable
|
2018-05-29 13:42:52 +08:00
|
|
|
|
{
|
2018-12-22 13:01:06 +08:00
|
|
|
|
public readonly IBindable<IEnumerable<User>> Users = new Bindable<IEnumerable<User>>();
|
2018-12-26 20:58:14 +08:00
|
|
|
|
public readonly IBindable<int> ParticipantCount = new Bindable<int>();
|
2018-12-22 13:01:06 +08:00
|
|
|
|
public readonly IBindable<int?> MaxParticipants = new Bindable<int?>();
|
2018-05-29 13:42:52 +08:00
|
|
|
|
|
|
|
|
|
public Participants()
|
|
|
|
|
{
|
2018-12-07 15:20:05 +08:00
|
|
|
|
FillFlowContainer<UserPanel> usersFlow;
|
2018-12-26 20:58:14 +08:00
|
|
|
|
ParticipantCountDisplay count;
|
2018-12-07 15:20:05 +08:00
|
|
|
|
|
|
|
|
|
InternalChild = new Container
|
2018-05-29 13:42:52 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new ScrollContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = 10 },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-12-26 20:58:14 +08:00
|
|
|
|
count = new ParticipantCountDisplay
|
2018-05-29 13:42:52 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
},
|
|
|
|
|
usersFlow = new FillFlowContainer<UserPanel>
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Spacing = new Vector2(5),
|
|
|
|
|
Padding = new MarginPadding { Top = 40 },
|
2018-05-29 14:53:30 +08:00
|
|
|
|
LayoutDuration = 200,
|
|
|
|
|
LayoutEasing = Easing.OutQuint,
|
2018-05-29 13:42:52 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2018-12-07 15:20:05 +08:00
|
|
|
|
|
2018-12-07 18:38:46 +08:00
|
|
|
|
count.Participants.BindTo(Users);
|
2018-12-26 20:58:14 +08:00
|
|
|
|
count.ParticipantCount.BindTo(ParticipantCount);
|
2018-12-07 18:38:46 +08:00
|
|
|
|
count.MaxParticipants.BindTo(MaxParticipants);
|
|
|
|
|
|
2018-12-07 15:20:05 +08:00
|
|
|
|
Users.BindValueChanged(v =>
|
|
|
|
|
{
|
|
|
|
|
usersFlow.Children = v.Select(u => new UserPanel(u)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Width = 300,
|
|
|
|
|
OnLoadComplete = d => d.FadeInFromZero(60),
|
|
|
|
|
}).ToList();
|
|
|
|
|
});
|
2018-05-29 13:42:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|