osu/osu.Game/Screens/Multi/Match/Components/Participants.cs

66 lines
2.3 KiB
C#
Raw Normal View History

// 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.
using System.Linq;
2019-02-05 10:00:01 +00:00
using osu.Framework.Allocation;
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 07:51:59 +00:00
using osuTK;
2018-12-10 10:20:41 +00:00
namespace osu.Game.Screens.Multi.Match.Components
{
2019-02-05 10:00:01 +00:00
public class Participants : MultiplayerComposite
{
2019-02-05 10:00:01 +00:00
[BackgroundDependencyLoader]
private void load()
{
2018-12-07 07:20:05 +00:00
FillFlowContainer<UserPanel> usersFlow;
InternalChild = new Container
{
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[]
{
2019-02-05 10:00:01 +00:00
new ParticipantCountDisplay
{
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 06:53:30 +00:00
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
},
},
},
},
};
2018-12-07 07:20:05 +00:00
Participants.BindValueChanged(participants =>
2018-12-07 07:20:05 +00:00
{
usersFlow.Children = participants.NewValue.Select(u => new UserPanel(u)
2018-12-07 07:20:05 +00:00
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Width = 300,
OnLoadComplete = d => d.FadeInFromZero(60),
}).ToList();
}, true);
}
}
}