From 8e014ca17ad6bab674db6076e5c0c2bb0eee3c19 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 16 Nov 2021 00:09:38 +0900 Subject: [PATCH] Reverse in-match playlist --- .../OnlinePlay/DrawableRoomPlaylist.cs | 25 ++++++++++++++++--- .../Multiplayer/MultiplayerMatchSubScreen.cs | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index a08d9edb34..296bb4bea5 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -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> CreateListFillFlowContainer() => new FillFlowContainer> + protected override FillFlowContainer> 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> + { + private bool reverse; + + public bool Reverse + { + get => reverse; + set + { + reverse = value; + Invalidate(); + } + } + + public override IEnumerable FlowingChildren => Reverse ? base.FlowingChildren.OrderBy(d => -GetLayoutPosition(d)) : base.FlowingChildren; + } } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index 9e689773af..c99367851a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -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, },