private void __onDisconn(NetworkMessage netMsg) { if (playerDic.ContainsKey(netMsg.conn.connectionId)) { Message.Leave leave = new Message.Leave(); leave.playerId = playerDic[netMsg.conn.connectionId].playerId; NetworkServer.SendToAll(MessageType.Leave, leave); playerDic.Remove(netMsg.conn.connectionId); } Log.Instance.Info(string.Format("Client: {0} 下线", netMsg.conn.connectionId)); }
private void __onLeave(NetworkMessage netMsg) { Message.Leave leave = netMsg.ReadMessage <Message.Leave>(); GameManager.Instance.RemovePlayer(leave.playerId); }