mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Removed useless proxy methods and substituted in direct property modification. (#454)
This commit is contained in:
parent
82535b0a8c
commit
96133d1583
@ -664,7 +664,7 @@ static void OnOwnerMessage(NetworkMessage netMsg)
|
||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
||||
{
|
||||
// this object already exists
|
||||
localObject.SetConnectionToServer(netMsg.conn);
|
||||
localObject.connectionToServer = netMsg.conn;
|
||||
localObject.SetLocalPlayer();
|
||||
InternalAddPlayer(localObject);
|
||||
}
|
||||
@ -684,7 +684,7 @@ static void CheckForOwner(NetworkIdentity identity)
|
||||
// found owner, turn into a local player
|
||||
|
||||
// Set isLocalPlayer to true on this NetworkIdentity and trigger OnStartLocalPlayer in all scripts on the same GO
|
||||
identity.SetConnectionToServer(readyConnection);
|
||||
identity.connectionToServer = readyConnection;
|
||||
identity.SetLocalPlayer();
|
||||
|
||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnOwnerMessage - player=" + identity.name); }
|
||||
|
@ -55,7 +55,7 @@ internal void AddLocalPlayer(NetworkIdentity localPlayer)
|
||||
{
|
||||
localPlayer.EnableIsClient();
|
||||
NetworkIdentity.spawned[localPlayer.netId] = localPlayer;
|
||||
localPlayer.SetConnectionToServer(connection);
|
||||
localPlayer.connectionToServer = connection;
|
||||
}
|
||||
// there is no SystemOwnerMessage for local client. add to ClientScene here instead
|
||||
ClientScene.InternalAddPlayer(localPlayer);
|
||||
|
@ -46,8 +46,8 @@ public sealed class NetworkIdentity : MonoBehaviour
|
||||
public bool serverOnly { get { return m_ServerOnly; } set { m_ServerOnly = value; } }
|
||||
public bool localPlayerAuthority { get { return m_LocalPlayerAuthority; } set { m_LocalPlayerAuthority = value; } }
|
||||
public NetworkConnection clientAuthorityOwner { get; private set; }
|
||||
public NetworkConnection connectionToServer { get; private set; }
|
||||
public NetworkConnection connectionToClient { get; private set; }
|
||||
public NetworkConnection connectionToServer { get; internal set; }
|
||||
public NetworkConnection connectionToClient { get; internal set; }
|
||||
|
||||
// all spawned NetworkIdentities by netId. needed on server and client.
|
||||
public static Dictionary<uint, NetworkIdentity> spawned = new Dictionary<uint, NetworkIdentity>();
|
||||
@ -648,16 +648,6 @@ internal void SetLocalPlayer()
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetConnectionToServer(NetworkConnection conn)
|
||||
{
|
||||
connectionToServer = conn;
|
||||
}
|
||||
|
||||
internal void SetConnectionToClient(NetworkConnection conn)
|
||||
{
|
||||
connectionToClient = conn;
|
||||
}
|
||||
|
||||
internal void OnNetworkDestroy()
|
||||
{
|
||||
for (int i = 0; m_NetworkBehaviours != null && i < m_NetworkBehaviours.Length; i++)
|
||||
|
@ -524,7 +524,7 @@ internal static bool InternalAddPlayerForConnection(NetworkConnection conn, Game
|
||||
conn.SetPlayerController(identity);
|
||||
|
||||
// Set the connection on the NetworkIdentity on the server, NetworkIdentity.SetLocalPlayer is not called on the server (it is on clients)
|
||||
identity.SetConnectionToClient(conn);
|
||||
identity.connectionToClient = conn;
|
||||
|
||||
SetClientReady(conn);
|
||||
|
||||
@ -613,7 +613,7 @@ internal static bool InternalReplacePlayerForConnection(NetworkConnection conn,
|
||||
conn.SetPlayerController(playerNetworkIdentity);
|
||||
|
||||
// Set the connection on the NetworkIdentity on the server, NetworkIdentity.SetLocalPlayer is not called on the server (it is on clients)
|
||||
playerNetworkIdentity.SetConnectionToClient(conn);
|
||||
playerNetworkIdentity.connectionToClient = conn;
|
||||
|
||||
//NOTE: DONT set connection ready.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user