private void OnDisconnected(SocketIOEvent obj) { Debug.Log("Player disconnected " + obj.data); var id = obj.data["id"].ToString(); spawner.RemovePlayer(id); }
private void OnDisconnected(SocketIOEvent obj) { // Debug.Log("Player disconnected " + obj.data); var id = obj.data["id"].ToString(); string userName = spawner.findPlayer(id).GetComponent <NetworkEntity>().id; int points = spawner.findPlayer(id).GetComponent <Points>().points; JSONObject data = new JSONObject(JSONObject.Type.OBJECT); data.AddField("name", userName); data.AddField("score", points); //Add other fields here socket.Emit("updateScore", data); spawner.RemovePlayer(id); }