1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 22:17:46 +08:00

Reverse in-match playlist

This commit is contained in:
Dan Balasescu 2021-11-16 00:09:38 +09:00
parent eb983ed548
commit 8e014ca17a
2 changed files with 22 additions and 5 deletions

View File

@ -19,10 +19,12 @@ namespace osu.Game.Screens.OnlinePlay
private readonly bool allowEdit;
private readonly bool allowSelection;
public DrawableRoomPlaylist(bool allowEdit, bool allowSelection)
public DrawableRoomPlaylist(bool allowEdit, bool allowSelection, bool reverse = false)
{
this.allowEdit = allowEdit;
this.allowSelection = allowSelection;
((ReversibleFillFlowContainer)ListContainer).Reverse = reverse;
}
protected override void LoadComplete()
@ -47,10 +49,8 @@ namespace osu.Game.Screens.OnlinePlay
d.ScrollbarVisible = false;
});
protected override FillFlowContainer<RearrangeableListItem<PlaylistItem>> CreateListFillFlowContainer() => new FillFlowContainer<RearrangeableListItem<PlaylistItem>>
protected override FillFlowContainer<RearrangeableListItem<PlaylistItem>> CreateListFillFlowContainer() => new ReversibleFillFlowContainer
{
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
Spacing = new Vector2(0, 2)
};
@ -72,5 +72,22 @@ namespace osu.Game.Screens.OnlinePlay
Items.Remove(item);
}
private class ReversibleFillFlowContainer : FillFlowContainer<RearrangeableListItem<PlaylistItem>>
{
private bool reverse;
public bool Reverse
{
get => reverse;
set
{
reverse = value;
Invalidate();
}
}
public override IEnumerable<Drawable> FlowingChildren => Reverse ? base.FlowingChildren.OrderBy(d => -GetLayoutPosition(d)) : base.FlowingChildren;
}
}
}

View File

@ -154,7 +154,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
null,
new Drawable[]
{
playlist = new DrawableRoomPlaylist(false, false)
playlist = new DrawableRoomPlaylist(false, false, true)
{
RelativeSizeAxes = Axes.Both,
},