/// <summary> /// 玩家离开 /// </summary> internal void LeaveProxy(GP_ROOM_LEAVE proto) { SeatEntity seat = GetSeatBySeatId(proto.pos); if (seat == null) { return; } seat.PlayerId = 0; seat.Latitude = 0f; seat.Longitude = 0f; seat.Gold = 0; seat.Avatar = string.Empty; seat.seatStatus = SEAT_STATUS.IDLE; SendGameSeatInfoChangeNotify(seat); AppDebug.Log(seat.Nickname + "离开房间"); if (seat == PlayerSeat) { NetWorkSocket.Instance.SafeClose(GameCtrl.Instance.SocketHandle); SceneMgr.Instance.LoadScene(SceneType.Main); } }
/// <summary> /// 服务器广播离开的消息 /// </summary> /// <param name="obj"></param> private void OnServerBroadcastLeave(byte[] obj) { GP_ROOM_LEAVE proto = GP_ROOM_LEAVE.decode(obj); RoomGuPaiJiuProxy.Instance.LeaveProxy(proto); }