Skip to content

Commit df66eaa

Browse files
committed
LobbyUIMediator relayjoinedfailed logic moved into internal scope
1 parent 6de1293 commit df66eaa

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

Assets/BossRoom/Scripts/Client/UI/Lobby/LobbyUIMediator.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class LobbyUIMediator : MonoBehaviour
2121
LobbyServiceFacade m_LobbyServiceFacade;
2222
LocalLobbyUser m_LocalUser;
2323
LocalLobby m_LocalLobby;
24-
IPublisher<UnityServiceErrorMessage> m_UnityServiceErrorMessagePublisher;
2524
NameGenerationData m_NameGenerationData;
2625
GameNetPortal m_GameNetPortal;
2726
ClientGameNetPortal m_ClientNetPortal;
@@ -40,7 +39,6 @@ ClientGameNetPortal clientGameNetPortal
4039
m_NameGenerationData = nameGenerationData;
4140
m_LocalUser = localUser;
4241
m_LobbyServiceFacade = lobbyServiceFacade;
43-
m_UnityServiceErrorMessagePublisher = unityServiceErrorMessagePublisher;
4442
m_LocalLobby = localLobby;
4543
m_GameNetPortal = gameNetPortal;
4644
m_ClientNetPortal = clientGameNetPortal;
@@ -156,16 +154,14 @@ void OnJoinedLobby(Lobby remoteLobby)
156154
m_ClientNetPortal.StartClientUnityRelayModeAsync(m_LocalLobby.RelayJoinCode, OnRelayJoinFailed);
157155
break;
158156
}
159-
}
160-
161-
void OnRelayJoinFailed(string message)
162-
{
163-
Debug.Log($"Relay join failed: {message}");
164-
//leave the lobby if relay failed for some reason
165-
m_LobbyServiceFacade.EndTracking();
166157

167-
UnblockUIAfterLoadingIsComplete();
168-
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Unity Relay: Join Failed", message));
158+
void OnRelayJoinFailed(string message)
159+
{
160+
Debug.Log($"Relay join failed: {message}");
161+
//leave the lobby if relay failed for some reason
162+
m_LobbyServiceFacade.EndTracking();
163+
UnblockUIAfterLoadingIsComplete();
164+
}
169165
}
170166

171167
//show/hide UI
@@ -237,7 +233,6 @@ void OnConnectFinished(ConnectStatus status)
237233
void OnNetworkTimeout()
238234
{
239235
UnblockUIAfterLoadingIsComplete();
240-
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Connection failed", "Unable to Reach Host/Server"));
241236
}
242237

243238
/// <summary>

Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement/ClientGameNetPortal.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
3+
using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure;
34
using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies;
45
using UnityEngine;
56
using UnityEngine.SceneManagement;

Assets/BossRoom/Scripts/Shared/Net/UnityServices/Lobbies/LobbyServiceFacade.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ public class LobbyServiceFacade : IDisposable
2222
readonly ApplicationController m_ApplicationController;
2323

2424
const float k_HeartbeatPeriod = 8; // The heartbeat must be rate-limited to 5 calls per 30 seconds. We'll aim for longer in case periods don't align.
25+
float m_HeartbeatTime = 0;
2526

2627
DIScope m_ServiceScope;
2728

28-
float m_HeartbeatTime = 0;
29-
3029
RateLimitCooldown m_RateLimitQuery;
3130
RateLimitCooldown m_RateLimitJoin;
3231
RateLimitCooldown m_RateLimitQuickJoin;
@@ -45,7 +44,6 @@ public LobbyServiceFacade(
4544
IPublisher<UnityServiceErrorMessage> serviceErrorMessagePub,
4645
IPublisher<LobbyListFetchedMessage> lobbyListFetchedPub)
4746
{
48-
4947
m_ApplicationController = applicationController;
5048
m_UpdateRunner = updateRunner;
5149
m_LocalLobby = localLobby;
@@ -194,7 +192,6 @@ public void QuickJoinLobbyAsync(Action<Lobby> onSuccess, Action onFailure)
194192
}
195193

196194
m_RateLimitQuickJoin.PutOnCooldown();
197-
198195
m_LobbyApiInterface.QuickJoinLobbyAsync(AuthenticationService.Instance.PlayerId, m_LocalUser.GetDataForUnityServices(), onSuccess, onFailure);
199196
}
200197

0 commit comments

Comments
 (0)