Example #1
0
        /// <summary>
        /// 退出房间
        /// </summary>
        /// <param name="proto"></param>
        public void ExitRoom(JY_ROOM_LEAVE proto)
        {
            SeatEntity seat = GetSeatByPlayerId(proto.playerId);

            if (seat == null)
            {
                return;
            }
            seat.PlayerId = 0;

            PeopleCounting();
            SendSeatInfoChangeNotify(seat);

            AppDebug.Log(seat.Nickname + "离开房间");

            if (seat == PlayerSeat)
            {
                NetWorkSocket.Instance.SafeClose(GameCtrl.Instance.SocketHandle);
                SceneMgr.Instance.LoadScene(SceneType.Main);
            }
        }
Example #2
0
    /// <summary>
    /// 服务器广播玩家离开消息
    /// </summary>
    /// <param name="obj"></param>
    private void OnServerBroadcastLeave(byte[] obj)
    {
        JY_ROOM_LEAVE proto = JY_ROOM_LEAVE.decode(obj);

        RoomJuYouProxy.Instance.ExitRoom(proto);
    }