Пример #1
0
    public override void OnServerDisconnect(NetworkConnection conn)
    {
        for (int i = 0; i < conn.playerControllers.Count; ++i)
        {
            PlayerController player = conn.playerControllers[i];
            if (player.gameObject != null)
            {
                JigsawPlayerController jigsawController = player.gameObject.GetComponent <JigsawPlayerController>();
                if (jigsawController)
                {
                    jigsawController.CleanupPlayer();
                    NetWorldState.DeregisterPlayer(jigsawController.PlayerState);
                }
            }
        }

        NetworkServer.DestroyPlayersForConnection(conn);
        if (conn.lastError != NetworkError.Ok && LogFilter.logError)
        {
            Debug.LogError("ServerDisconnected due to error: " + conn.lastError);
        }
        Debug.Log("A client disconnected from the server: " + conn);
    }
Пример #2
0
    // stop/disconnect /////////////////////////////////////////////////////////
    // called on the server when a client disconnects
    public override void OnServerDisconnect(NetworkConnection conn)
    {
        print("OnServerDisconnect " + conn);

        // save player (if any)
        GameObject go = Utils.GetGameObjectFromPlayerControllers(conn.playerControllers);
        if (go != null)
        {
            Database.CharacterSave(go.GetComponent<Player>(), false);
            print("saved:" + go.name);
        }
        else print("no player to save for: " + conn);

        // addon system hooks
        Utils.InvokeMany(typeof(NetworkManagerMMO), this, "OnServerDisconnect_", conn);

        // remove logged in account after everything else was done
        lobby.Remove(conn); // just returns false if not found

        // do base function logic without showing the annoying Debug.LogErrror
        // (until UNET fixes it)
        //base.OnServerDisconnect(conn);
        NetworkServer.DestroyPlayersForConnection(conn);
    }
Пример #3
0
 /// <summary>
 /// Called on the server when a client disconnects.
 /// </summary>
 /// <param name="conn"></param>
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     NetworkServer.DestroyPlayersForConnection(conn);
     MatchManager.Instance.CancelSync();
 }
Пример #4
0
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     Debug.Log("OnServerDisconnect: " + conn);
     NetworkServer.DestroyPlayersForConnection(conn);
 }
 //クライアントがサーバーから切断されたときに呼び出される
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     Debug.Log("サーバーから切断されました。");
     NetworkServer.DestroyPlayersForConnection(conn);
 }
Пример #6
0
 public virtual void OnServerDisconnect(NetworkConnection conn)
 {
     NetworkServer.DestroyPlayersForConnection(conn);
 }
Пример #7
0
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     NetworkServer.DestroyPlayersForConnection(conn);
     GameObject.Find("ClientManager").GetComponent <ClientManager>().Disconnect();
 }
Пример #8
0
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     numOfPlayers--;
     NetworkServer.DestroyPlayersForConnection(conn);
 }
Пример #9
0
 public void Handle(NetworkMessage message)
 {
     Debug.Log("OnServerDisconnect");
     NetworkServer.DestroyPlayersForConnection(message.conn);
 }
Пример #10
0
 /// <summary>
 /// Callback that is called on the server whenever a client disconnects.
 /// We use this to update the player count of the match.
 /// </summary>
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     playerCount--;
     StartCoroutine(PUTMatchPlayerCount());
     NetworkServer.DestroyPlayersForConnection(conn);
 }
Пример #11
0
 // CALLED WHEN A CLIENT DISCONNECTS
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     NetworkServer.DestroyPlayersForConnection(conn);
     text.GetComponent <TextMesh>().text += "\nClient Disconnected";
 }
 // 服务器监听客服端断开连接回调
 private void  OnServerListenClientDisConnect(NetworkMessage msg)
 {
     NetworkServer.DestroyPlayersForConnection(msg.conn);
 }
Пример #13
0
 private void RemovePlayer(NetworkMessage netMsg)
 {
     Debug.Log("Remove Player !");
     NetworkServer.DestroyPlayersForConnection(netMsg.conn);
 }
 // called when a client disconnects
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     NetworkServer.DestroyPlayersForConnection(conn);
     clientStatus.text = "Client disconnected";
 }
Пример #15
0
 private void OnDisconnect(NetworkMessage msg)
 {
     Debug.Log("server: client disconnected");
     NetworkServer.DestroyPlayersForConnection(msg.conn);
 }
Пример #16
0
 public void OnServerDisconnected(NetworkMessage netMsg)
 {
     NetworkServer.DestroyPlayersForConnection(netMsg.conn);
 }
    // Handles receiving damage, dying and rewarding the Player with <shooterID> for the damage/kill.
    public void TakeDamage(float damage, NetworkInstanceId shooterID)
    {
        // Prevent this zombie from taking damage is he is dead.
        if (isDead)
        {
            return;
        }

        currentHealth -= damage;

        if (isServer)
        {
            // If we are the Server, reward the Player with <shooterID>.
            RewardPlayer(shooterID);
        }

        if (currentHealth <= 0f && !isDead)
        {
            isDead = true;
        }

        if (isDead)
        {
            // Get the flame child, if any.
            Transform flameChild = transform.Find("Flame");

            // Instantiate the ragdoll for this zombie, if there is one.
            if (deadBody != null)
            {
                GameObject deadClone = Instantiate(deadBody, transform.position, transform.rotation) as GameObject;

                // Set the <deadClone> name and make sure that he does not have a 'Zombie' tag.
                deadClone.name = "Dead Zombie";
                deadClone.tag  = "Untagged";

                if (localPlayerAuthority)
                {
                    NetworkServer.ReplacePlayerForConnection(connectionToClient, deadClone, 0);
                }

                // If we had a flame child, then parent it to our dead body.
                if (flameChild != null)
                {
                    flameChild.SetParent(deadClone.transform, true);
                    flameChild.localPosition = Vector3.zero;
                }

                // If the death was by grenade and we are the Server, then apply explosion force to the ragdoll.
                if ((grenadeExplosion != null) && isServer)
                {
                    // Apply the grenade explosion force to all rigidbody children of the <deadClone>.
                    foreach (Transform child in deadClone.transform)
                    {
                        Rigidbody childRigidbody = child.GetComponent <Rigidbody>();

                        // Get the explosion data.
                        float   force    = grenadeExplosion.damage * 10f;
                        float   radius   = grenadeExplosion.blastRadius;
                        Vector3 position = grenadeExplosion.transform.position;

                        // Apply the grenade explosion force to the current child of the <deadClone>.
                        childRigidbody.AddExplosionForce(force, position, radius);
                    }
                }
            }
            else if (flameChild != null)
            {
                Destroy(flameChild.gameObject);
            }
            else if (localPlayerAuthority && isServer)
            {
                NetworkServer.DestroyPlayersForConnection(connectionToClient);
            }

            Destroy(gameObject);

            if (isServer)
            {
                NetworkServer.Destroy(gameObject);
            }
        }
    }
Пример #18
0
 public override void OnServerDisconnect(NetworkConnection conn)
 {
     NetworkServer.DestroyPlayersForConnection(conn);
     GameObject.Find("OnlineUsersRecord").GetComponent <OnlineUsersTable>().RemoveUser(conn.connectionId);
     Debug.Log("A client disconnected from the server: " + conn);
 }