@@ -92,16 +92,15 @@ public void BeginTracking()
92
92
}
93
93
}
94
94
95
- public Task EndTracking ( )
95
+ public void EndTracking ( )
96
96
{
97
- var task = Task . CompletedTask ;
98
97
if ( CurrentUnityLobby != null )
99
98
{
100
99
CurrentUnityLobby = null ;
101
100
102
101
if ( ! string . IsNullOrEmpty ( m_LocalLobby ? . LobbyID ) )
103
102
{
104
- task = LeaveLobbyAsync ( m_LocalLobby ? . LobbyID , null , null ) ;
103
+ LeaveLobbyAsync ( m_LocalLobby ? . LobbyID , null , null ) ;
105
104
}
106
105
107
106
m_LocalUser . ResetState ( ) ;
@@ -115,7 +114,6 @@ public Task EndTracking()
115
114
m_HeartbeatTime = 0 ;
116
115
m_JoinedLobbyContentHeartbeat . EndTracking ( ) ;
117
116
}
118
- return task ;
119
117
}
120
118
121
119
void UpdateLobby ( float unused )
@@ -138,7 +136,7 @@ void OnSuccess(Lobby lobby)
138
136
}
139
137
}
140
138
m_UnityServiceErrorMessagePub . Publish ( new UnityServiceErrorMessage ( "Host left the lobby" , "Disconnecting." , UnityServiceErrorMessage . Service . Lobby ) ) ;
141
- ForceLeaveLobbyAttempt ( ) ;
139
+ EndTracking ( ) ;
142
140
// no need to disconnect Netcode, it should already be handled by Netcode's callback to disconnect
143
141
}
144
142
}
@@ -169,24 +167,24 @@ public void CreateLobbyAsync(string lobbyName, int maxPlayers, bool isPrivate, O
169
167
/// <summary>
170
168
/// Attempt to join an existing lobby. Will try to join via code, if code is null - will try to join via ID.
171
169
/// </summary>
172
- public Task JoinLobbyAsync ( string lobbyId , string lobbyCode , Action < Lobby > onSuccess , Action onFailure )
170
+ public void JoinLobbyAsync ( string lobbyId , string lobbyCode , Action < Lobby > onSuccess , Action onFailure )
173
171
{
174
172
if ( ! m_RateLimitJoin . CanCall ||
175
173
( lobbyId == null && lobbyCode == null ) )
176
174
{
177
175
onFailure ? . Invoke ( ) ;
178
176
UnityEngine . Debug . LogWarning ( "Join Lobby hit the rate limit." ) ;
179
- return Task . CompletedTask ;
177
+ return ;
180
178
}
181
179
m_RateLimitJoin . PutOnCooldown ( ) ;
182
180
183
181
if ( ! string . IsNullOrEmpty ( lobbyCode ) )
184
182
{
185
- return m_LobbyApiInterface . JoinLobbyAsync_ByCode ( AuthenticationService . Instance . PlayerId , lobbyCode , m_LocalUser . GetDataForUnityServices ( ) , onSuccess , onFailure ) ;
183
+ m_LobbyApiInterface . JoinLobbyAsync_ByCode ( AuthenticationService . Instance . PlayerId , lobbyCode , m_LocalUser . GetDataForUnityServices ( ) , onSuccess , onFailure ) ;
186
184
}
187
185
else
188
186
{
189
- return m_LobbyApiInterface . JoinLobbyAsync_ById ( AuthenticationService . Instance . PlayerId , lobbyId , m_LocalUser . GetDataForUnityServices ( ) , onSuccess , onFailure ) ;
187
+ m_LobbyApiInterface . JoinLobbyAsync_ById ( AuthenticationService . Instance . PlayerId , lobbyId , m_LocalUser . GetDataForUnityServices ( ) , onSuccess , onFailure ) ;
190
188
}
191
189
}
192
190
@@ -243,10 +241,10 @@ void RetrieveLobbyAsync(string lobbyId, Action<Lobby> onSuccess, Action onFailur
243
241
/// <summary>
244
242
/// Attempt to leave a lobby, and then delete it if no players remain.
245
243
/// </summary>
246
- public Task LeaveLobbyAsync ( string lobbyId , Action onSuccess , Action onFailure )
244
+ public void LeaveLobbyAsync ( string lobbyId , Action onSuccess , Action onFailure )
247
245
{
248
246
string uasId = AuthenticationService . Instance . PlayerId ;
249
- return m_LobbyApiInterface . LeaveLobbyAsync ( uasId , lobbyId , onSuccess , onFailure ) ;
247
+ m_LobbyApiInterface . LeaveLobbyAsync ( uasId , lobbyId , onSuccess , onFailure ) ;
250
248
}
251
249
252
250
public void RemovePlayerFromLobbyAsync ( string uasId , string lobbyId , Action onSuccess , Action onFailure )
@@ -406,10 +404,5 @@ public void DoLobbyHeartbeat(float dt)
406
404
m_LobbyApiInterface . HeartbeatPlayerAsync ( CurrentUnityLobby . Id ) ;
407
405
}
408
406
}
409
-
410
- public void ForceLeaveLobbyAttempt ( )
411
- {
412
- EndTracking ( ) ;
413
- }
414
407
}
415
408
}
0 commit comments