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

Add ability to invite players to multiplayer rooms #25005

Merged
merged 38 commits into from
Oct 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d19cdbd
Add `InvitePlayer` method to multiplayer server
minetoblend Oct 2, 2023
574dc67
Add `Invited` task to multiplayer client
minetoblend Oct 2, 2023
7629b72
Add invite button to UserPanel context menu
minetoblend Oct 2, 2023
251e4d4
Add localisation for inviting a player
minetoblend Oct 2, 2023
e81695b
Display avatar in invitation notification
minetoblend Oct 2, 2023
3879775
Add room name to invite notification
minetoblend Oct 2, 2023
8e73dbc
Load api room before displaying notification
minetoblend Oct 2, 2023
a171fa7
Join multiplayer match when clicking the invite notification
minetoblend Oct 2, 2023
267d1ee
Handle cases when player cannot be invited.
minetoblend Oct 3, 2023
32f69cd
Make `UserAvatarNotification.user` readonly
minetoblend Oct 3, 2023
5678d90
Reduce silliness of notification test case
minetoblend Oct 3, 2023
5469d13
Add missing parameter description to docs.
minetoblend Oct 3, 2023
fe5177f
Remove unused import
minetoblend Oct 3, 2023
bfeafd6
Fix formatting
minetoblend Oct 4, 2023
74ed3bc
Rename `loadRoom` to `lookupRoom`
minetoblend Oct 4, 2023
0726ccb
Fix formatting
minetoblend Oct 4, 2023
6bd51b3
Make resolved `multiplayerClient` field nullable
minetoblend Oct 4, 2023
6d97f89
Rename `OnlinePlayScreen.LoungeSubScreen` to `Lounge`
minetoblend Oct 4, 2023
3023e44
Remove unused using statements
peppy Oct 12, 2023
55a9de0
Change `NotificationOverlay` type based logic to not require specifyi…
peppy Oct 12, 2023
e6103fe
Fix `async` usage in `TestSceneNotificationOverlay`
peppy Oct 12, 2023
aee8ba7
Tidy up `UserAvatarNotification` implementation
peppy Oct 12, 2023
20f32e2
Add light colouring for user notifications and adjust lighting slightly
peppy Oct 12, 2023
a512ef5
Add exceptions to online state handling
peppy Oct 12, 2023
94d7a65
Schedule `Join` operations rather than using `OnLoadComplete` for add…
peppy Oct 12, 2023
cde4fad
Simplify `async` lookup logic in `Invited` handling
peppy Oct 12, 2023
a1a9bb7
Remove unnecessary schedule logic
peppy Oct 12, 2023
d2aa601
Allow localisation of the invite notification
peppy Oct 12, 2023
361d70f
Rename callback to match standards
peppy Oct 12, 2023
5f62c22
Ad localisation (and adjust messaging) of invite failures
peppy Oct 12, 2023
a591af2
Fix too many tasks in `lookupRoom` method
peppy Oct 12, 2023
e48c4fa
Add missing `ConfigureAwait` calls
peppy Oct 12, 2023
56e27f1
Merge branch 'master' into multiplayer-invites
peppy Oct 12, 2023
fc1287b
Reword xmldoc on invite method to better describe what is happening
peppy Oct 12, 2023
1ce268b
Update some packages to match `osu.Server.Spectator`
peppy Oct 12, 2023
6c8490b
Revert changes to `LoungeSubScreen.Join()`
bdach Oct 12, 2023
79cec77
Privatise setter
bdach Oct 13, 2023
e04a57d
Use less dodgy method of specifying allowable notification types
bdach Oct 13, 2023
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
35 changes: 16 additions & 19 deletions osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,29 +297,26 @@ private void onLeaving()
popoverContainer.HidePopover();
}

public void Join(Room room, string password, Action<Room> onSuccess = null, Action<string> onFailure = null)
public virtual void Join(Room room, string password, Action<Room> onSuccess = null, Action<string> onFailure = null) => Schedule(() =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i guess this virtual is for mocking. at the time i couldn't understand why it was there.

{
Schedule(() =>
{
if (joiningRoomOperation != null)
return;
if (joiningRoomOperation != null)
return;

joiningRoomOperation = ongoingOperationTracker?.BeginOperation();
joiningRoomOperation = ongoingOperationTracker?.BeginOperation();

RoomManager?.JoinRoom(room, password, _ =>
{
Open(room);
joiningRoomOperation?.Dispose();
joiningRoomOperation = null;
onSuccess?.Invoke(room);
}, error =>
{
joiningRoomOperation?.Dispose();
joiningRoomOperation = null;
onFailure?.Invoke(error);
});
RoomManager?.JoinRoom(room, password, _ =>
{
Open(room);
joiningRoomOperation?.Dispose();
joiningRoomOperation = null;
onSuccess?.Invoke(room);
}, error =>
{
joiningRoomOperation?.Dispose();
joiningRoomOperation = null;
onFailure?.Invoke(error);
});
}
});

/// <summary>
/// Copies a room and opens it as a fresh (not-yet-created) one.
Expand Down