@@ -29,14 +29,7 @@ void ServiceErrorHandler(UnityServiceErrorMessage error)
29
29
{
30
30
case UnityServiceErrorMessage . Service . Lobby :
31
31
{
32
- if ( ( error . OriginalException is LobbyServiceException { Reason : LobbyExceptionReason . LobbyConflict } ) )
33
- {
34
- // LobbyConflict can have multiple causes. Let's add other solutions here if there's other situations that arise for this.
35
- errorMessage += "\n See logs for possible causes and solution." ;
36
- Debug . LogError ( $ "Got service error { error . Message } with LobbyConflict. Possible conflict cause: Trying to play with two builds on the " +
37
- $ "same machine. Please use command line arg '{ ProfileManager . AuthProfileCommandLineArg } someName' to set a different auth profile.\n ") ;
38
- }
39
- PopupPanel . ShowPopupPanel ( "Service error" , errorMessage ) ;
32
+ HandleLobbyError ( error ) ;
40
33
break ;
41
34
}
42
35
case UnityServiceErrorMessage . Service . Authentication :
@@ -48,12 +41,35 @@ void ServiceErrorHandler(UnityServiceErrorMessage error)
48
41
}
49
42
default :
50
43
{
51
- PopupPanel . ShowPopupPanel ( "Service error: " + error . Title , errorMessage ) ;
44
+ PopupPanel . ShowPopupPanel ( "Service error: " + error . Title , errorMessage ) ;
52
45
break ;
53
46
}
54
47
}
55
48
}
56
49
50
+ void HandleLobbyError ( UnityServiceErrorMessage error )
51
+ {
52
+ var errorMessage = error . Message ;
53
+ switch ( ( ( LobbyServiceException ) error . OriginalException ) . Reason )
54
+ {
55
+ case LobbyExceptionReason . LobbyConflict :
56
+ {
57
+ errorMessage += "\n See logs for possible causes and solution." ;
58
+ Debug . LogError ( $ "Got service error { error . Message } with LobbyConflict. Possible conflict cause: Trying to play with two builds on the " +
59
+ $ "same machine. Please use command line arg '{ ProfileManager . AuthProfileCommandLineArg } someName' to set a different auth profile.\n ") ;
60
+ break ;
61
+ }
62
+ case LobbyExceptionReason . LobbyFull :
63
+ {
64
+ PopupPanel . ShowPopupPanel ( "Failed to join lobby" , "Lobby is full and can't accept more players" ) ;
65
+ // Returning out of the function because we replace default popup panel with this.
66
+ return ;
67
+ }
68
+ }
69
+
70
+ PopupPanel . ShowPopupPanel ( "Service error: " + error . Title , errorMessage ) ;
71
+ }
72
+
57
73
void OnDestroy ( )
58
74
{
59
75
m_Subscriptions . Dispose ( ) ;
0 commit comments