SetLocalPlayer() 개인적인 메소드

private SetLocalPlayer ( short localPlayerControllerId ) : void
localPlayerControllerId short
리턴 void
        static void CheckForOwner(NetworkIdentity uv)
        {
            for (int i = 0; i < s_PendingOwnerIds.Count; i++)
            {
                var pendingOwner = s_PendingOwnerIds[i];

                if (pendingOwner.netId == uv.netId)
                {
                    // found owner, turn into a local player

                    // Set isLocalPlayer to true on this NetworkIdentity and trigger OnStartLocalPlayer in all scripts on the same GO
                    uv.SetConnectionToServer(s_ReadyConnection);
                    uv.SetLocalPlayer(pendingOwner.playerControllerId);

                    if (LogFilter.logDev)
                    {
                        Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name);
                    }
                    if (s_ReadyConnection.connectionId < 0)
                    {
                        if (LogFilter.logError)
                        {
                            Debug.LogError("Owner message received on a local client.");
                        }
                        return;
                    }
                    InternalAddPlayer(uv, pendingOwner.playerControllerId);

                    s_PendingOwnerIds.RemoveAt(i);
                    break;
                }
            }
        }
예제 #2
0
 private static void CheckForOwner(NetworkIdentity uv)
 {
     for (int i = 0; i < s_PendingOwnerIds.Count; i++)
     {
         PendingOwner owner = s_PendingOwnerIds[i];
         if (owner.netId == uv.netId)
         {
             uv.SetConnectionToServer(s_ReadyConnection);
             uv.SetLocalPlayer(owner.playerControllerId);
             if (LogFilter.logDev)
             {
                 Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name);
             }
             if (s_ReadyConnection.connectionId < 0)
             {
                 if (LogFilter.logError)
                 {
                     Debug.LogError("Owner message received on a local client.");
                 }
             }
             else
             {
                 InternalAddPlayer(uv, owner.playerControllerId);
                 s_PendingOwnerIds.RemoveAt(i);
             }
             break;
         }
     }
 }
예제 #3
0
 private static void CheckForOwner(NetworkIdentity uv)
 {
     for (int index = 0; index < ClientScene.s_PendingOwnerIds.Count; ++index)
     {
         ClientScene.PendingOwner pendingOwnerId = ClientScene.s_PendingOwnerIds[index];
         if (pendingOwnerId.netId == uv.netId)
         {
             uv.SetConnectionToServer(ClientScene.s_ReadyConnection);
             uv.SetLocalPlayer(pendingOwnerId.playerControllerId);
             if (LogFilter.logDev)
             {
                 Debug.Log((object)("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name));
             }
             if (ClientScene.s_ReadyConnection.connectionId < 0)
             {
                 if (!LogFilter.logError)
                 {
                     break;
                 }
                 Debug.LogError((object)"Owner message received on a local client.");
                 break;
             }
             ClientScene.InternalAddPlayer(uv, pendingOwnerId.playerControllerId);
             ClientScene.s_PendingOwnerIds.RemoveAt(index);
             break;
         }
     }
 }
예제 #4
0
        private static void CheckForOwner(NetworkIdentity uv)
        {
            int i = 0;

            while (i < ClientScene.s_PendingOwnerIds.Count)
            {
                ClientScene.PendingOwner pendingOwner = ClientScene.s_PendingOwnerIds[i];
                if (pendingOwner.netId == uv.netId)
                {
                    uv.SetConnectionToServer(ClientScene.s_ReadyConnection);
                    uv.SetLocalPlayer(pendingOwner.playerControllerId);
                    if (LogFilter.logDev)
                    {
                        Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name);
                    }
                    if (ClientScene.s_ReadyConnection.connectionId < 0)
                    {
                        if (LogFilter.logError)
                        {
                            Debug.LogError("Owner message received on a local client.");
                        }
                        break;
                    }
                    ClientScene.InternalAddPlayer(uv, pendingOwner.playerControllerId);
                    ClientScene.s_PendingOwnerIds.RemoveAt(i);
                    break;
                }
                else
                {
                    i++;
                }
            }
        }
예제 #5
0
        private static void CheckForOwner(NetworkIdentity uv)
        {
            int          num = 0;
            PendingOwner pendingOwner;

            while (true)
            {
                if (num < s_PendingOwnerIds.Count)
                {
                    pendingOwner = s_PendingOwnerIds[num];
                    if (pendingOwner.netId == uv.netId)
                    {
                        break;
                    }
                    num++;
                    continue;
                }
                return;
            }
            uv.SetConnectionToServer(s_ReadyConnection);
            uv.SetLocalPlayer(pendingOwner.playerControllerId);
            if (LogFilter.logDev)
            {
                Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name);
            }
            if (s_ReadyConnection.connectionId < 0)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("Owner message received on a local client.");
                }
            }
            else
            {
                InternalAddPlayer(uv, pendingOwner.playerControllerId);
                s_PendingOwnerIds.RemoveAt(num);
            }
        }
예제 #6
0
 private static void CheckForOwner(NetworkIdentity uv)
 {
   for (int index = 0; index < ClientScene.s_PendingOwnerIds.Count; ++index)
   {
     ClientScene.PendingOwner pendingOwnerId = ClientScene.s_PendingOwnerIds[index];
     if (pendingOwnerId.netId == uv.netId)
     {
       uv.SetConnectionToServer(ClientScene.s_ReadyConnection);
       uv.SetLocalPlayer(pendingOwnerId.playerControllerId);
       if (LogFilter.logDev)
         Debug.Log((object) ("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name));
       if (ClientScene.s_ReadyConnection.connectionId < 0)
       {
         if (!LogFilter.logError)
           break;
         Debug.LogError((object) "Owner message received on a local client.");
         break;
       }
       ClientScene.InternalAddPlayer(uv, pendingOwnerId.playerControllerId);
       ClientScene.s_PendingOwnerIds.RemoveAt(index);
       break;
     }
   }
 }
예제 #7
0
 private bool SetupLocalPlayerForConnection(NetworkConnection conn, NetworkIdentity uv, PlayerController newPlayerController)
 {
     if (LogFilter.logDev)
     Debug.Log((object) ("NetworkServer SetupLocalPlayerForConnection netID:" + (object) uv.netId));
       ULocalConnectionToClient connectionToClient = conn as ULocalConnectionToClient;
       if (connectionToClient == null)
     return false;
       if (LogFilter.logDev)
     Debug.Log((object) "NetworkServer AddPlayer handling ULocalConnectionToClient");
       if (uv.netId.IsEmpty())
     uv.OnStartServer();
       uv.RebuildObservers(true);
       this.SendSpawnMessage(uv, (NetworkConnection) null);
       connectionToClient.localClient.AddLocalPlayer(newPlayerController);
       uv.SetLocalPlayer(newPlayerController.playerControllerId);
       return true;
 }
예제 #8
0
 private static void CheckForOwner(NetworkIdentity uv)
 {
     for (int i = 0; i < s_PendingOwnerIds.Count; i++)
     {
         PendingOwner owner = s_PendingOwnerIds[i];
         if (owner.netId == uv.netId)
         {
             uv.SetConnectionToServer(s_ReadyConnection);
             uv.SetLocalPlayer(owner.playerControllerId);
             if (LogFilter.logDev)
             {
                 Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name);
             }
             if (s_ReadyConnection.connectionId < 0)
             {
                 if (LogFilter.logError)
                 {
                     Debug.LogError("Owner message received on a local client.");
                 }
             }
             else
             {
                 InternalAddPlayer(uv, owner.playerControllerId);
                 s_PendingOwnerIds.RemoveAt(i);
             }
             break;
         }
     }
 }