mirror of
https://github.com/ppy/osu.git
synced 2026-06-07 04:13:38 +08:00
Show pinned rooms on top of listing
This commit is contained in:
@@ -81,6 +81,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
CurrentPlaylistItem = item1
|
||||
}),
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = "Pinned room",
|
||||
Pinned = true,
|
||||
EndDate = DateTimeOffset.Now.AddDays(1),
|
||||
Type = MatchType.HeadToHead,
|
||||
Playlist = [item1],
|
||||
CurrentPlaylistItem = item1
|
||||
}),
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = "Private room",
|
||||
Password = "*",
|
||||
@@ -140,13 +149,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddUntilStep("wait for panel load", () => panel.ChildrenOfType<DrawableRoomParticipantsList>().Any());
|
||||
|
||||
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, panel.ChildrenOfType<RoomPanel.PasswordProtectedIcon>().Single().Alpha));
|
||||
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, panel.ChildrenOfType<RoomPanel.CornerIcon>().Single().Alpha));
|
||||
|
||||
AddStep("set password", () => room.Password = "password");
|
||||
AddAssert("password icon visible", () => Precision.AlmostEquals(1, panel.ChildrenOfType<RoomPanel.PasswordProtectedIcon>().Single().Alpha));
|
||||
AddAssert("password icon visible", () => Precision.AlmostEquals(1, panel.ChildrenOfType<RoomPanel.CornerIcon>().Single().Alpha));
|
||||
|
||||
AddStep("unset password", () => room.Password = string.Empty);
|
||||
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, panel.ChildrenOfType<RoomPanel.PasswordProtectedIcon>().Single().Alpha));
|
||||
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, panel.ChildrenOfType<RoomPanel.CornerIcon>().Single().Alpha));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -263,6 +263,12 @@ namespace osu.Game.Online.Rooms
|
||||
set => SetField(ref availability, value);
|
||||
}
|
||||
|
||||
public bool Pinned
|
||||
{
|
||||
get => pinned;
|
||||
set => SetField(ref pinned, value);
|
||||
}
|
||||
|
||||
[JsonProperty("id")]
|
||||
private long? roomId;
|
||||
|
||||
@@ -339,6 +345,9 @@ namespace osu.Game.Online.Rooms
|
||||
[JsonConverter(typeof(SnakeCaseStringEnumConverter))]
|
||||
private RoomStatus status;
|
||||
|
||||
[JsonProperty("pinned")]
|
||||
private bool pinned;
|
||||
|
||||
// Not yet serialised (not implemented).
|
||||
private RoomAvailability availability;
|
||||
|
||||
|
||||
@@ -194,8 +194,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
|
||||
roomFlow.Add(drawableRoom);
|
||||
|
||||
// Always show spotlight playlists at the top of the listing.
|
||||
roomFlow.SetLayoutPosition(drawableRoom, room.Category > RoomCategory.Normal ? float.MinValue : -(room.RoomID ?? 0));
|
||||
roomFlow.SetLayoutPosition(drawableRoom, room.Pinned ? float.MinValue : -(room.RoomID ?? 0));
|
||||
}
|
||||
|
||||
applyFilterCriteria(Filter.Value);
|
||||
|
||||
Reference in New Issue
Block a user