Revert "breaking(NetworkManager)!: Removed obsolete OnServerError / OnClientError"

This reverts commit 3f7c1af819.
This commit is contained in:
MrGadget1024 2023-03-06 11:50:37 -05:00
parent 3f7c1af819
commit 788fd4df91

View File

@ -1306,8 +1306,16 @@ public virtual void OnServerAddPlayer(NetworkConnectionToClient conn)
NetworkServer.AddPlayerForConnection(conn, player); NetworkServer.AddPlayerForConnection(conn, player);
} }
// Deprecated 2022-05-12
[Obsolete("OnServerError(conn, Exception) was changed to OnServerError(conn, TransportError, string)")]
public virtual void OnServerError(NetworkConnectionToClient conn, Exception exception) {}
/// <summary>Called on server when transport raises an exception. NetworkConnection may be null.</summary> /// <summary>Called on server when transport raises an exception. NetworkConnection may be null.</summary>
public virtual void OnServerError(NetworkConnectionToClient conn, TransportError error, string reason) {} public virtual void OnServerError(NetworkConnectionToClient conn, TransportError error, string reason)
{
#pragma warning disable CS0618
OnServerError(conn, new Exception(reason));
#pragma warning restore CS0618
}
/// <summary>Called from ServerChangeScene immediately before SceneManager.LoadSceneAsync is executed</summary> /// <summary>Called from ServerChangeScene immediately before SceneManager.LoadSceneAsync is executed</summary>
public virtual void OnServerChangeScene(string newSceneName) {} public virtual void OnServerChangeScene(string newSceneName) {}
@ -1336,8 +1344,16 @@ public virtual void OnClientConnect()
/// <summary>Called on clients when disconnected from a server.</summary> /// <summary>Called on clients when disconnected from a server.</summary>
public virtual void OnClientDisconnect() {} public virtual void OnClientDisconnect() {}
// Deprecated 2022-05-12
[Obsolete("OnClientError(Exception) was changed to OnClientError(TransportError, string)")]
public virtual void OnClientError(Exception exception) {}
/// <summary>Called on client when transport raises an exception.</summary> /// <summary>Called on client when transport raises an exception.</summary>
public virtual void OnClientError(TransportError error, string reason) {} public virtual void OnClientError(TransportError error, string reason)
{
#pragma warning disable CS0618
OnClientError(new Exception(reason));
#pragma warning restore CS0618
}
/// <summary>Called on clients when a servers tells the client it is no longer ready, e.g. when switching scenes.</summary> /// <summary>Called on clients when a servers tells the client it is no longer ready, e.g. when switching scenes.</summary>
public virtual void OnClientNotReady() {} public virtual void OnClientNotReady() {}