Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove BindableList<> properties from Room #30633

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
72564b5
Make `CurrentPlaylistItem` not a bindable
smoogipoo Nov 11, 2024
8d5cd2b
Fix inspection
smoogipoo Nov 12, 2024
f3fd87a
Make `DrawableMatchRoom` structurally match other implementations
smoogipoo Nov 12, 2024
db025d8
Reorder public property vs private field
smoogipoo Nov 13, 2024
99762da
Make RoomID non-bindable
smoogipoo Nov 13, 2024
5b2568d
Fix cases where the bindable is resolved directly
smoogipoo Nov 13, 2024
a2a930a
Fix CI issues
smoogipoo Nov 13, 2024
6160df1
Make `Room.Name` non-bindable
smoogipoo Nov 13, 2024
8694f7e
Make `Room.Host` non-bindable
smoogipoo Nov 13, 2024
bde7b8e
Make `Room.Category` non-bindable
smoogipoo Nov 13, 2024
81e4cb3
Make `Room.Type` non-bindable
smoogipoo Nov 13, 2024
5d4838a
Make `Room.Status` non-bindable
smoogipoo Nov 13, 2024
7e3e520
Make `Room.Availability` non-bindable
smoogipoo Nov 13, 2024
198681e
Make `Room.QueueMode` non-bindable
smoogipoo Nov 13, 2024
ec5be6d
Make `Room.Password` & `Room.HasPassword` non-bindable
smoogipoo Nov 13, 2024
f001cce
Make `Room.AutoSkip` non-bindable
smoogipoo Nov 13, 2024
b8bae30
Make `Room.ParticipantCount` & `Room.MaxParticipants` non-bindable
smoogipoo Nov 13, 2024
89de4f0
Make `Room.AutoStartDuration` non-bindable
smoogipoo Nov 13, 2024
0ceaafe
Make `Room.Duration` & `Room.StartDate` & `Room.EndDate` non-bindable
smoogipoo Nov 13, 2024
6c84e42
Make `Room.MaxAttempts` non-bindable
smoogipoo Nov 13, 2024
80b3e33
Make `Room.ChannelId` non-bindable
smoogipoo Nov 13, 2024
487a010
Make `Room.PlaylistItemStats` non-bindable
smoogipoo Nov 13, 2024
c4f8fd1
Make `Room.DifficultyRange` non-bindable
smoogipoo Nov 13, 2024
dc5337d
Make `Room.UserScore` non-bindable
smoogipoo Nov 13, 2024
b16edbb
Make `Room.RecentParticipants` non-bindable
smoogipoo Nov 14, 2024
34c0f72
Make `Room.Playlist` non-bindable
smoogipoo Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void TestPlayingUsersUpdatedOnJoin()
var newRoom = new Room();
newRoom.CopyFrom(SelectedRoom.Value);
newRoom.RoomID.Value = null;
newRoom.RoomID = null;
MultiplayerClient.RoomSetupAction = room =>
{
room.State = MultiplayerRoomState.Playing;
Expand Down
36 changes: 18 additions & 18 deletions osu.Game.Tests/Visual/DailyChallenge/TestSceneDailyChallenge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ public void TestDailyChallenge()
{
var room = new Room
{
RoomID = { Value = 1234 },
Name = { Value = "Daily Challenge: June 4, 2024" },
RoomID = 1234,
Name = "Daily Challenge: June 4, 2024",
Playlist =
{
[
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().Beatmaps.First())
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
}
},
EndDate = { Value = DateTimeOffset.Now.AddHours(12) },
Category = { Value = RoomCategory.DailyChallenge }
],
EndDate = DateTimeOffset.Now.AddHours(12),
Category = RoomCategory.DailyChallenge
};

AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
Expand All @@ -62,18 +62,18 @@ public void TestNotifications()
{
var room = new Room
{
RoomID = { Value = 1234 },
Name = { Value = "Daily Challenge: June 4, 2024" },
RoomID = 1234,
Name = "Daily Challenge: June 4, 2024",
Playlist =
{
[
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().Beatmaps.First())
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
}
},
EndDate = { Value = DateTimeOffset.Now.AddHours(12) },
Category = { Value = RoomCategory.DailyChallenge }
],
EndDate = DateTimeOffset.Now.AddHours(12),
Category = RoomCategory.DailyChallenge
};

AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
Expand All @@ -91,18 +91,18 @@ public void TestConclusionNotificationDoesNotFireOnDisconnect()
{
var room = new Room
{
RoomID = { Value = 1234 },
Name = { Value = "Daily Challenge: June 4, 2024" },
RoomID = 1234,
Name = "Daily Challenge: June 4, 2024",
Playlist =
{
[
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().Beatmaps.First())
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
}
},
EndDate = { Value = DateTimeOffset.Now.AddHours(12) },
Category = { Value = RoomCategory.DailyChallenge }
],
EndDate = DateTimeOffset.Now.AddHours(12),
Category = RoomCategory.DailyChallenge
};

AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void TestIntegration()
Origin = Anchor.Centre,
Children = new Drawable[]
{
new DailyChallengeTimeRemainingRing(),
new DailyChallengeTimeRemainingRing(room.Value),
breakdown = new DailyChallengeScoreBreakdown(),
}
}
Expand All @@ -125,8 +125,8 @@ public void TestIntegration()
AddSliderStep("update time remaining", 0f, 1f, 0f, progress =>
{
var startedTimeAgo = TimeSpan.FromHours(24) * progress;
room.Value.StartDate.Value = DateTimeOffset.Now - startedTimeAgo;
room.Value.EndDate.Value = room.Value.StartDate.Value.Value.AddDays(1);
room.Value.StartDate = DateTimeOffset.Now - startedTimeAgo;
room.Value.EndDate = room.Value.StartDate.Value.AddDays(1);
});
AddStep("add normal score", () =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ private void startChallenge(int roomId)
{
API.Perform(new CreateRoomRequest(room = new Room
{
RoomID = { Value = roomId },
Name = { Value = "Daily Challenge: June 4, 2024" },
RoomID = roomId,
Name = "Daily Challenge: June 4, 2024",
Playlist =
{
[
new PlaylistItem(CreateAPIBeatmap(new OsuRuleset().RulesetInfo))
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
}
},
StartDate = { Value = DateTimeOffset.Now },
EndDate = { Value = DateTimeOffset.Now.AddHours(24) },
Category = { Value = RoomCategory.DailyChallenge }
],
StartDate = DateTimeOffset.Now,
EndDate = DateTimeOffset.Now.AddHours(24),
Category = RoomCategory.DailyChallenge
}));
});
AddStep("signal client", () => metadataClient.DailyChallengeUpdated(new DailyChallengeInfo { RoomID = roomId }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void TestBasicBehaviour()
return false;
};
});
AddStep("create leaderboard", () => Child = leaderboard = new DailyChallengeLeaderboard(new Room { RoomID = { Value = 1 } }, new PlaylistItem(Beatmap.Value.BeatmapInfo))
AddStep("create leaderboard", () => Child = leaderboard = new DailyChallengeLeaderboard(new Room { RoomID = 1 }, new PlaylistItem(Beatmap.Value.BeatmapInfo))
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Expand Down Expand Up @@ -86,7 +86,7 @@ public void TestLoadingBehaviour()
return false;
};
});
AddStep("create leaderboard", () => Child = leaderboard = new DailyChallengeLeaderboard(new Room { RoomID = { Value = 1 } }, new PlaylistItem(Beatmap.Value.BeatmapInfo))
AddStep("create leaderboard", () => Child = leaderboard = new DailyChallengeLeaderboard(new Room { RoomID = 1 }, new PlaylistItem(Beatmap.Value.BeatmapInfo))
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void TestBasicAppearance()
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4,
},
ring = new DailyChallengeTimeRemainingRing
ring = new DailyChallengeTimeRemainingRing(room.Value)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Expand All @@ -59,29 +59,29 @@ public void TestBasicAppearance()

AddStep("just started", () =>
{
room.Value.StartDate.Value = DateTimeOffset.Now.AddMinutes(-1);
room.Value.EndDate.Value = room.Value.StartDate.Value.Value.AddDays(1);
room.Value.StartDate = DateTimeOffset.Now.AddMinutes(-1);
room.Value.EndDate = room.Value.StartDate.Value.AddDays(1);
});
AddStep("midway through", () =>
{
room.Value.StartDate.Value = DateTimeOffset.Now.AddHours(-12);
room.Value.EndDate.Value = room.Value.StartDate.Value.Value.AddDays(1);
room.Value.StartDate = DateTimeOffset.Now.AddHours(-12);
room.Value.EndDate = room.Value.StartDate.Value.AddDays(1);
});
AddStep("nearing end", () =>
{
room.Value.StartDate.Value = DateTimeOffset.Now.AddDays(-1).AddMinutes(8);
room.Value.EndDate.Value = room.Value.StartDate.Value.Value.AddDays(1);
room.Value.StartDate = DateTimeOffset.Now.AddDays(-1).AddMinutes(8);
room.Value.EndDate = room.Value.StartDate.Value.AddDays(1);
});
AddStep("already ended", () =>
{
room.Value.StartDate.Value = DateTimeOffset.Now.AddDays(-2);
room.Value.EndDate.Value = room.Value.StartDate.Value.Value.AddDays(1);
room.Value.StartDate = DateTimeOffset.Now.AddDays(-2);
room.Value.EndDate = room.Value.StartDate.Value.AddDays(1);
});
AddSliderStep("manual progress", 0f, 1f, 0f, progress =>
{
var startedTimeAgo = TimeSpan.FromHours(24) * progress;
room.Value.StartDate.Value = DateTimeOffset.Now - startedTimeAgo;
room.Value.EndDate.Value = room.Value.StartDate.Value.Value.AddDays(1);
room.Value.StartDate = DateTimeOffset.Now - startedTimeAgo;
room.Value.EndDate = room.Value.StartDate.Value.AddDays(1);
});
}
}
Expand Down
12 changes: 6 additions & 6 deletions osu.Game.Tests/Visual/Menus/TestSceneMainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public void TestDailyChallenge()
beatmap.OnlineID = 1001;
getRoomRequest.TriggerSuccess(new Room
{
RoomID = { Value = 1234 },
Name = { Value = "Aug 8, 2024" },
RoomID = 1234,
Name = "Aug 8, 2024",
Playlist =
{
[
new PlaylistItem(beatmap)
},
StartDate = { Value = DateTimeOffset.Now.AddMinutes(-30) },
EndDate = { Value = DateTimeOffset.Now.AddSeconds(60) }
],
StartDate = DateTimeOffset.Now.AddMinutes(-30),
EndDate = DateTimeOffset.Now.AddSeconds(60)
});
return true;

Expand Down
22 changes: 10 additions & 12 deletions osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
Expand Down Expand Up @@ -30,16 +28,16 @@ public abstract partial class QueueModeTestScene : ScreenTestScene
{
protected abstract QueueMode Mode { get; }

protected BeatmapInfo InitialBeatmap { get; private set; }
protected BeatmapInfo OtherBeatmap { get; private set; }
protected BeatmapInfo InitialBeatmap { get; private set; } = null!;
protected BeatmapInfo OtherBeatmap { get; private set; } = null!;

protected IScreen CurrentScreen => multiplayerComponents.CurrentScreen;
protected IScreen CurrentSubScreen => multiplayerComponents.MultiplayerScreen.CurrentSubScreen;

private BeatmapManager beatmaps;
private BeatmapSetInfo importedSet;
private BeatmapManager beatmaps = null!;
private BeatmapSetInfo importedSet = null!;

private TestMultiplayerComponents multiplayerComponents;
private TestMultiplayerComponents multiplayerComponents = null!;

protected TestMultiplayerClient MultiplayerClient => multiplayerComponents.MultiplayerClient;

Expand Down Expand Up @@ -75,15 +73,15 @@ public override void SetUpSteps()
AddUntilStep("wait for lounge", () => multiplayerComponents.ChildrenOfType<LoungeSubScreen>().SingleOrDefault()?.IsLoaded == true);
AddStep("open room", () => multiplayerComponents.ChildrenOfType<LoungeSubScreen>().Single().Open(new Room
{
Name = { Value = "Test Room" },
QueueMode = { Value = Mode },
Name = "Test Room",
QueueMode = Mode,
Playlist =
{
[
new PlaylistItem(InitialBeatmap)
{
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
}
}
]
}));

AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
Expand All @@ -98,7 +96,7 @@ public override void SetUpSteps()
[Test]
public void TestCreatedWithCorrectMode()
{
AddUntilStep("room created with correct mode", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == Mode);
AddUntilStep("room created with correct mode", () => MultiplayerClient.ClientAPIRoom?.QueueMode == Mode);
}

protected void RunGameplay()
Expand Down
22 changes: 11 additions & 11 deletions osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Testing;
Expand All @@ -25,14 +24,14 @@ public partial class TestSceneDrawableLoungeRoom : OsuManualInputManagerTestScen
{
private readonly Room room = new Room
{
HasPassword = { Value = true }
Password = "*"
};

[Cached]
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);

private DrawableLoungeRoom drawableRoom;
private SearchTextBox searchTextBox;
private DrawableLoungeRoom drawableRoom = null!;
private SearchTextBox searchTextBox = null!;

private readonly ManualResetEventSlim allowResponseCallback = new ManualResetEventSlim();

Expand Down Expand Up @@ -78,6 +77,7 @@ public void SetUpSteps()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
SelectedRoom = new Bindable<Room?>()
}
}
};
Expand All @@ -87,7 +87,7 @@ public void SetUpSteps()
[Test]
public void TestFocusViaKeyboardCommit()
{
DrawableLoungeRoom.PasswordEntryPopover popover = null;
DrawableLoungeRoom.PasswordEntryPopover? popover = null;

AddAssert("search textbox has focus", () => checkFocus(searchTextBox));
AddStep("click room twice", () =>
Expand All @@ -103,11 +103,11 @@ public void TestFocusViaKeyboardCommit()
AddStep("enter password", () => popover.ChildrenOfType<OsuPasswordTextBox>().Single().Text = "password");
AddStep("commit via enter", () => InputManager.Key(Key.Enter));

AddAssert("popover has focus", () => checkFocus(popover));
AddAssert("popover has focus", () => checkFocus(popover!));

AddStep("attempt another enter", () => InputManager.Key(Key.Enter));

AddAssert("popover still has focus", () => checkFocus(popover));
AddAssert("popover still has focus", () => checkFocus(popover!));

AddStep("unblock response", () => allowResponseCallback.Set());

Expand All @@ -122,7 +122,7 @@ public void TestFocusViaKeyboardCommit()
[Test]
public void TestFocusViaMouseCommit()
{
DrawableLoungeRoom.PasswordEntryPopover popover = null;
DrawableLoungeRoom.PasswordEntryPopover? popover = null;

AddAssert("search textbox has focus", () => checkFocus(searchTextBox));
AddStep("click room twice", () =>
Expand All @@ -144,11 +144,11 @@ public void TestFocusViaMouseCommit()
InputManager.Click(MouseButton.Left);
});

AddAssert("popover has focus", () => checkFocus(popover));
AddAssert("popover has focus", () => checkFocus(popover!));

AddStep("attempt another click", () => InputManager.Click(MouseButton.Left));

AddAssert("popover still has focus", () => checkFocus(popover));
AddAssert("popover still has focus", () => checkFocus(popover!));

AddStep("unblock response", () => allowResponseCallback.Set());

Expand Down
Loading
Loading