1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 17:52:56 +08:00

Merge branch 'master' into mod-overlay/switches

This commit is contained in:
Dean Herbert 2022-02-23 13:49:23 +09:00 committed by GitHub
commit 5e7dd31f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 169 additions and 113 deletions

View File

@ -49,6 +49,8 @@ namespace osu.Game.Tests.Visual.Editing
double originalTimelineZoom = 0;
double changedTimelineZoom = 0;
AddUntilStep("wait for timeline load", () => Editor.ChildrenOfType<Timeline>().SingleOrDefault()?.IsLoaded == true);
AddStep("Set beat divisor", () => Editor.Dependencies.Get<BindableBeatDivisor>().Value = 16);
AddStep("Set timeline zoom", () =>
{

View File

@ -44,15 +44,20 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestBasicListChanges()
{
AddStep("add rooms", () => RoomManager.AddRooms(3));
AddStep("add rooms", () => RoomManager.AddRooms(5, withSpotlightRooms: true));
AddAssert("has 3 rooms", () => container.Rooms.Count == 3);
AddStep("remove first room", () => RoomManager.RemoveRoom(RoomManager.Rooms.FirstOrDefault()));
AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
AddAssert("has 5 rooms", () => container.Rooms.Count == 5);
AddAssert("all spotlights at top", () => container.Rooms
.SkipWhile(r => r.Room.Category.Value == RoomCategory.Spotlight)
.All(r => r.Room.Category.Value == RoomCategory.Normal));
AddStep("remove first room", () => RoomManager.RemoveRoom(RoomManager.Rooms.FirstOrDefault(r => r.RoomID.Value == 0)));
AddAssert("has 4 rooms", () => container.Rooms.Count == 4);
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
AddStep("select first room", () => container.Rooms.First().TriggerClick());
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
AddAssert("first spotlight selected", () => checkRoomSelected(RoomManager.Rooms.First(r => r.Category.Value == RoomCategory.Spotlight)));
}
[Test]

View File

@ -236,8 +236,7 @@ namespace osu.Game.Online.Chat
break;
default:
linkType = LinkAction.External;
break;
return new LinkDetails(LinkAction.External, url);
}
return new LinkDetails(linkType, args[2]);

View File

@ -67,6 +67,8 @@ namespace osu.Game.Overlays.BeatmapListing
[Resolved]
private IAPIProvider api { get; set; }
private IBindable<APIUser> apiUser;
public BeatmapListingFilterControl()
{
RelativeSizeAxes = Axes.X;
@ -127,7 +129,7 @@ namespace osu.Game.Overlays.BeatmapListing
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider, IAPIProvider api)
{
sortControlBackground.Colour = colourProvider.Background4;
}
@ -161,6 +163,9 @@ namespace osu.Game.Overlays.BeatmapListing
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
sortDirection.BindValueChanged(_ => queueUpdateSearch());
apiUser = api.LocalUser.GetBoundCopy();
apiUser.BindValueChanged(_ => queueUpdateSearch());
}
public void TakeFocus() => searchControl.TakeFocus();
@ -190,6 +195,9 @@ namespace osu.Game.Overlays.BeatmapListing
resetSearch();
if (!api.IsLoggedIn)
return;
queryChangedDebounce = Scheduler.AddDelayed(() =>
{
resetSearch();

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Localisation;
using osu.Framework.Graphics;
@ -19,6 +20,7 @@ using osu.Game.Beatmaps.Drawables.Cards;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapListing;
using osu.Game.Resources.Localisation.Web;
@ -32,6 +34,11 @@ namespace osu.Game.Overlays
[Resolved]
private PreviewTrackManager previewTrackManager { get; set; }
[Resolved]
private IAPIProvider api { get; set; }
private IBindable<APIUser> apiUser;
private Drawable currentContent;
private Container panelTarget;
private FillFlowContainer<BeatmapCard> foundContent;
@ -93,6 +100,13 @@ namespace osu.Game.Overlays
{
base.LoadComplete();
filterControl.CardSize.BindValueChanged(_ => onCardSizeChanged());
apiUser = api.LocalUser.GetBoundCopy();
apiUser.BindValueChanged(_ =>
{
if (api.IsLoggedIn)
addContentToResultsArea(Drawable.Empty());
});
}
public void ShowWithSearch(string query)

View File

@ -124,7 +124,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private void updateSorting()
{
foreach (var room in roomFlow)
roomFlow.SetLayoutPosition(room, -(room.Room.RoomID.Value ?? 0));
{
roomFlow.SetLayoutPosition(room, room.Room.Category.Value == RoomCategory.Spotlight
// Always show spotlight playlists at the top of the listing.
? float.MinValue
: -(room.Room.RoomID.Value ?? 0));
}
}
protected override bool OnClick(ClickEvent e)

View File

@ -69,13 +69,26 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
Room.MaxAttempts.BindValueChanged(attempts => progressSection.Alpha = Room.MaxAttempts.Value != null ? 1 : 0, true);
}
protected override Drawable CreateMainContent() => new GridContainer
protected override Drawable CreateMainContent() => new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 5, Vertical = 10 },
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{
// Playlist items column
new Container
{
RelativeSizeAxes = Axes.Both,
@ -110,7 +123,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
}
}
},
// Spacer
null,
// Middle column (mods and leaderboard)
new GridContainer
{
RelativeSizeAxes = Axes.Both,
@ -175,8 +190,6 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
new OverlinedHeader("Leaderboard")
},
new Drawable[] { leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both }, },
new Drawable[] { new OverlinedHeader("Chat"), },
new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } }
},
RowDimensions = new[]
{
@ -184,17 +197,27 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
},
// Spacer
null,
// Main right column
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[] { new OverlinedHeader("Chat") },
new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } }
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Relative, size: 0.4f, minSize: 120),
new Dimension(),
}
},
},
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Relative, size: 0.5f, maxSize: 400),
new Dimension(),
new Dimension(GridSizeMode.Relative, size: 0.5f, maxSize: 600),
}
};

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
base.JoinRoom(room, password, onSuccess, onError);
}
public void AddRooms(int count, RulesetInfo ruleset = null, bool withPassword = false)
public void AddRooms(int count, RulesetInfo ruleset = null, bool withPassword = false, bool withSpotlightRooms = false)
{
for (int i = 0; i < count; i++)
{
@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
Name = { Value = $@"Room {currentRoomId}" },
Host = { Value = new APIUser { Username = @"Host" } },
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) },
Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal },
Category = { Value = withSpotlightRooms && i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal },
};
if (withPassword)