mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Allow different sizing modes for OverlinedParticipants
This commit is contained in:
@ -3,15 +3,43 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Components
|
||||
{
|
||||
public class OverlinedParticipants : OverlinedDisplay
|
||||
{
|
||||
public OverlinedParticipants()
|
||||
public new Axes AutoSizeAxes
|
||||
{
|
||||
get => base.AutoSizeAxes;
|
||||
set => base.AutoSizeAxes = value;
|
||||
}
|
||||
|
||||
public OverlinedParticipants(Direction direction)
|
||||
: base("Participants")
|
||||
{
|
||||
Content.Add(new ParticipantsList { RelativeSizeAxes = Axes.Both });
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Users;
|
||||
@ -19,21 +18,39 @@ namespace osu.Game.Screens.Multi.Components
|
||||
{
|
||||
public class ParticipantsList : MultiplayerComposite
|
||||
{
|
||||
public const float TILE_SIZE = 70;
|
||||
|
||||
public override Axes RelativeSizeAxes
|
||||
{
|
||||
get => base.RelativeSizeAxes;
|
||||
set
|
||||
{
|
||||
base.RelativeSizeAxes = value;
|
||||
fill.RelativeSizeAxes = value;
|
||||
}
|
||||
}
|
||||
|
||||
public new Axes AutoSizeAxes
|
||||
{
|
||||
get => base.AutoSizeAxes;
|
||||
set
|
||||
{
|
||||
base.AutoSizeAxes = value;
|
||||
fill.AutoSizeAxes = value;
|
||||
}
|
||||
}
|
||||
|
||||
public FillDirection Direction
|
||||
{
|
||||
get => fill.Direction;
|
||||
set => fill.Direction = value;
|
||||
}
|
||||
|
||||
private readonly FillFlowContainer fill;
|
||||
|
||||
public ParticipantsList()
|
||||
{
|
||||
InternalChild = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = fill = new FillFlowContainer
|
||||
{
|
||||
Spacing = new Vector2(10),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Full,
|
||||
}
|
||||
};
|
||||
InternalChild = fill = new FillFlowContainer { Spacing = new Vector2(10) };
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
@ -157,7 +158,15 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = 10 },
|
||||
Child = new ParticipantsList { RelativeSizeAxes = Axes.Both }
|
||||
Child = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new ParticipantsList
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 5 },
|
||||
Child = new OverlinedParticipants { RelativeSizeAxes = Axes.Both }
|
||||
Child = new OverlinedParticipants(Direction.Vertical) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
Reference in New Issue
Block a user