This commit is contained in:
vis2k 2021-03-09 18:41:42 +08:00
parent 9f68d269cc
commit a4e237d307

View File

@ -124,10 +124,9 @@ public class NetworkManager : MonoBehaviour
static NetworkConnection clientReadyConnection;
/// <summary>
/// This is true if the client loaded a new scene when connecting to the server.
/// <para>This is set before OnClientConnect is called, so it can be checked there to perform different logic if a scene load occurred.</para>
/// </summary>
/// <summary>True if the client loaded a new scene when connecting to the server.</summary>
// This is set before OnClientConnect is called, so it can be checked
// there to perform different logic if a scene load occurred.
[NonSerialized]
public bool clientLoadedScene;
@ -139,11 +138,7 @@ public class NetworkManager : MonoBehaviour
// during FinishLoadScene.
public NetworkManagerMode mode { get; private set; }
#region Unity Callbacks
/// <summary>
/// virtual so that inheriting classes' OnValidate() can call base.OnValidate() too
/// </summary>
// virtual so that inheriting classes' OnValidate() can call base.OnValidate() too
public virtual void OnValidate()
{
// add transport if there is none yet. makes upgrading easier.
@ -219,10 +214,6 @@ public virtual void LateUpdate()
UpdateScene();
}
#endregion
#region Start & Stop
// keep the online scene change check in a separate function
bool IsServerOnlineSceneChangeNeeded()
{
@ -758,10 +749,6 @@ public virtual void OnDestroy()
//Debug.Log("NetworkManager destroyed");
}
#endregion
#region Scene Management
/// <summary>
/// The name of the current network scene.
/// </summary>
@ -1034,10 +1021,6 @@ void FinishLoadSceneClientOnly()
}
}
#endregion
#region Start Positions
/// <summary>
/// Registers the transform of a game object as a player spawn location.
/// <para>This is done automatically by NetworkStartPosition components, but can be done manually from user script code.</para>
@ -1091,10 +1074,6 @@ public Transform GetStartPosition()
}
}
#endregion
#region Server Internal Message Handlers
void OnServerConnectInternal(NetworkConnection conn)
{
//Debug.Log("NetworkManager.OnServerConnectInternal");
@ -1166,10 +1145,6 @@ void OnServerAddPlayerInternal(NetworkConnection conn, AddPlayerMessage msg)
OnServerAddPlayer(conn);
}
#endregion
#region Client Internal Message Handlers
void OnClientConnectInternal(NetworkConnection conn)
{
//Debug.Log("NetworkManager.OnClientConnectInternal");
@ -1234,10 +1209,6 @@ void OnClientSceneInternal(NetworkConnection conn, SceneMessage msg)
}
}
#endregion
#region Server System Callbacks
/// <summary>
/// Called on the server when a new client connects.
/// <para>Unity calls this on the Server when a Client connects to the Server. Use an override to tell the NetworkManager what to do when a client connects to the server.</para>
@ -1307,10 +1278,6 @@ public virtual void OnServerChangeScene(string newSceneName) {}
/// <param name="sceneName">The name of the new scene.</param>
public virtual void OnServerSceneChanged(string sceneName) {}
#endregion
#region Client System Callbacks
/// <summary>
/// Called on the client when connected to a server.
/// <para>The default implementation of this function sets the client as ready and adds a player. Override the function to dictate what happens when the client connects.</para>
@ -1384,10 +1351,6 @@ public virtual void OnClientSceneChanged(NetworkConnection conn)
}
}
#endregion
#region Start & Stop callbacks
// Since there are multiple versions of StartServer, StartClient and StartHost, to reliably customize
// their functionality, users would need override all the versions. Instead these callbacks are invoked
// from all versions, so users only need to implement this one case.
@ -1423,7 +1386,5 @@ public virtual void OnStopClient() {}
/// This is called when a host is stopped.
/// </summary>
public virtual void OnStopHost() {}
#endregion
}
}