mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
breaking: NetworkAuthenticator OnClientAuthenticated Changed (#3027)
- No longer passes `NetworkConnection` on Client - Use `NetworkClient.connection` within your event hanlder This is only breaking for users that assigned their own events to OnClientAuthenticated in the inspector. Everything else related to an Authenticator works the same with no changes needed because nearly all Authenticator mechanisms are private. Deprecating would be worse than not in this case, since custom user-made handers would be the far uncommon case as far as I know.
This commit is contained in:
parent
ad739e66ff
commit
88fe9f9820
@ -18,7 +18,7 @@ public class TimeoutAuthenticator : NetworkAuthenticator
|
||||
public void Awake()
|
||||
{
|
||||
authenticator.OnServerAuthenticated.AddListener(connection => OnServerAuthenticated.Invoke(connection));
|
||||
authenticator.OnClientAuthenticated.AddListener(connection => OnClientAuthenticated.Invoke(connection));
|
||||
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated.Invoke);
|
||||
}
|
||||
|
||||
public override void OnStartServer()
|
||||
@ -57,12 +57,12 @@ public override void OnClientAuthenticate()
|
||||
|
||||
IEnumerator BeginAuthentication(NetworkConnection conn)
|
||||
{
|
||||
// Debug.Log($"Authentication countdown started {conn} {timeout}");
|
||||
//Debug.Log($"Authentication countdown started {conn} {timeout}");
|
||||
yield return new WaitForSecondsRealtime(timeout);
|
||||
|
||||
if (!conn.isAuthenticated)
|
||||
{
|
||||
// Debug.Log($"Authentication Timeout {conn}");
|
||||
Debug.LogError($"Authentication Timeout - Disconnecting {conn}");
|
||||
conn.Disconnect();
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ public static void AddDefineSymbols()
|
||||
"MIRROR_44_0_OR_NEWER",
|
||||
"MIRROR_46_0_OR_NEWER",
|
||||
"MIRROR_47_0_OR_NEWER",
|
||||
"MIRROR_53_0_OR_NEWER"
|
||||
"MIRROR_53_0_OR_NEWER",
|
||||
"MIRROR_55_0_OR_NEWER"
|
||||
};
|
||||
|
||||
// only touch PlayerSettings if we actually modified it.
|
||||
|
@ -17,7 +17,7 @@ public abstract class NetworkAuthenticator : MonoBehaviour
|
||||
|
||||
/// <summary>Notify subscribers on the client when the client is authenticated</summary>
|
||||
[Tooltip("Mirror has an internal subscriber to this event. You can add your own here.")]
|
||||
public UnityEventNetworkConnection OnClientAuthenticated = new UnityEventNetworkConnection();
|
||||
public UnityEvent OnClientAuthenticated = new UnityEvent();
|
||||
|
||||
/// <summary>Called when server starts, used to register message handlers if needed.</summary>
|
||||
public virtual void OnStartServer() {}
|
||||
@ -49,7 +49,7 @@ public virtual void OnStopClient() {}
|
||||
|
||||
protected void ClientAccept()
|
||||
{
|
||||
OnClientAuthenticated.Invoke(NetworkClient.connection);
|
||||
OnClientAuthenticated.Invoke();
|
||||
}
|
||||
|
||||
protected void ClientReject()
|
||||
|
@ -1159,12 +1159,12 @@ void OnClientConnectInternal()
|
||||
else
|
||||
{
|
||||
// authenticate immediately
|
||||
OnClientAuthenticated(NetworkClient.connection);
|
||||
OnClientAuthenticated();
|
||||
}
|
||||
}
|
||||
|
||||
// called after successful authentication
|
||||
void OnClientAuthenticated(NetworkConnection conn)
|
||||
void OnClientAuthenticated()
|
||||
{
|
||||
//Debug.Log("NetworkManager.OnClientAuthenticated");
|
||||
|
||||
|
@ -576,7 +576,7 @@ PlayerSettings:
|
||||
webGLThreadsSupport: 0
|
||||
webGLWasmStreaming: 0
|
||||
scriptingDefineSymbols:
|
||||
1: MIRROR;MIRROR_17_0_OR_NEWER;MIRROR_18_0_OR_NEWER;MIRROR_24_0_OR_NEWER;MIRROR_26_0_OR_NEWER;MIRROR_27_0_OR_NEWER;MIRROR_28_0_OR_NEWER;MIRROR_29_0_OR_NEWER;MIRROR_30_0_OR_NEWER;MIRROR_30_5_2_OR_NEWER;MIRROR_32_1_2_OR_NEWER;MIRROR_32_1_4_OR_NEWER;MIRROR_35_0_OR_NEWER;MIRROR_35_1_OR_NEWER;MIRROR_37_0_OR_NEWER;MIRROR_38_0_OR_NEWER;MIRROR_39_0_OR_NEWER;MIRROR_40_0_OR_NEWER;MIRROR_41_0_OR_NEWER;MIRROR_42_0_OR_NEWER;MIRROR_43_0_OR_NEWER;MIRROR_44_0_OR_NEWER;MIRROR_46_0_OR_NEWER;MIRROR_47_0_OR_NEWER;MIRROR_53_0_OR_NEWER
|
||||
1: MIRROR;MIRROR_17_0_OR_NEWER;MIRROR_18_0_OR_NEWER;MIRROR_24_0_OR_NEWER;MIRROR_26_0_OR_NEWER;MIRROR_27_0_OR_NEWER;MIRROR_28_0_OR_NEWER;MIRROR_29_0_OR_NEWER;MIRROR_30_0_OR_NEWER;MIRROR_30_5_2_OR_NEWER;MIRROR_32_1_2_OR_NEWER;MIRROR_32_1_4_OR_NEWER;MIRROR_35_0_OR_NEWER;MIRROR_35_1_OR_NEWER;MIRROR_37_0_OR_NEWER;MIRROR_38_0_OR_NEWER;MIRROR_39_0_OR_NEWER;MIRROR_40_0_OR_NEWER;MIRROR_41_0_OR_NEWER;MIRROR_42_0_OR_NEWER;MIRROR_43_0_OR_NEWER;MIRROR_44_0_OR_NEWER;MIRROR_46_0_OR_NEWER;MIRROR_47_0_OR_NEWER;MIRROR_53_0_OR_NEWER;MIRROR_55_0_OR_NEWER
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
il2cppCompilerConfiguration: {}
|
||||
|
Loading…
Reference in New Issue
Block a user