2020-02-14 19:42:14 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
2020-02-19 16:37:01 +08:00
|
|
|
using osu.Game.Graphics.Containers;
|
2020-02-14 19:42:14 +08:00
|
|
|
|
2020-02-19 16:33:09 +08:00
|
|
|
namespace osu.Game.Screens.Multi.Components
|
2020-02-14 19:42:14 +08:00
|
|
|
{
|
|
|
|
public class OverlinedParticipants : OverlinedDisplay
|
|
|
|
{
|
2020-02-19 16:37:01 +08:00
|
|
|
public new Axes AutoSizeAxes
|
|
|
|
{
|
|
|
|
get => base.AutoSizeAxes;
|
|
|
|
set => base.AutoSizeAxes = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public OverlinedParticipants(Direction direction)
|
2020-02-27 18:42:28 +08:00
|
|
|
: base("Recent participants")
|
2020-02-14 19:42:14 +08:00
|
|
|
{
|
2020-02-19 16:37:01 +08:00
|
|
|
OsuScrollContainer scroll;
|
|
|
|
ParticipantsList list;
|
|
|
|
|
|
|
|
Content.Add(scroll = new OsuScrollContainer(direction)
|
|
|
|
{
|
|
|
|
Child = list = new ParticipantsList()
|
|
|
|
});
|
|
|
|
|
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case Direction.Horizontal:
|
|
|
|
scroll.RelativeSizeAxes = Axes.X;
|
|
|
|
scroll.Height = ParticipantsList.TILE_SIZE + OsuScrollContainer.SCROLL_BAR_HEIGHT + OsuScrollContainer.SCROLL_BAR_PADDING * 2;
|
|
|
|
list.AutoSizeAxes = Axes.Both;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Direction.Vertical:
|
|
|
|
scroll.RelativeSizeAxes = Axes.Both;
|
|
|
|
list.RelativeSizeAxes = Axes.X;
|
|
|
|
list.AutoSizeAxes = Axes.Y;
|
|
|
|
break;
|
|
|
|
}
|
2020-02-14 19:42:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
ParticipantCount.BindValueChanged(_ => setParticipantCount());
|
|
|
|
MaxParticipants.BindValueChanged(_ => setParticipantCount());
|
|
|
|
|
|
|
|
setParticipantCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setParticipantCount() => Details = MaxParticipants.Value != null ? $"{ParticipantCount.Value}/{MaxParticipants.Value}" : ParticipantCount.Value.ToString();
|
|
|
|
}
|
|
|
|
}
|