Пример #1
0
        /// <summary>
        /// 离开房间
        /// </summary>
        /// <param name="pbSeat"></param>
        public void ExitRoom(NN_ROOM_LEAVE proto)
        {
            NiuNiu.Seat seat = GetSeatByPlayerId(proto.playerId);

            if (seat == null)
            {
                return;
            }

            //PBSeat.Builder pbSeatNew = PBSeat.CreateBuilder();
            //pbSeatNew.PlayerId = 0;
            //seat.SetSeat(pbSeatNew.Build());

            seat.PlayerId = 0;


            PeopleCounting();//计算人数
            Debug.Log(string.Format("{0}号位 离开房间", seat.Pos));


            if (seat == PlayerSeat)
            {
                NetWorkSocket.Instance.SafeClose(GameCtrl.Instance.SocketHandle);
                SceneMgr.Instance.LoadScene(SceneType.Main);
                return;
            }


            ////显示UI
            //TransferData data = new TransferData();
            //data.SetValue("Seat", seat);
            //data.SetValue("RoomStatus", CurrentRoom.roomStatus);
            //SendNotification("SetLeaveItemUI", data);

            //SetInteractionOnOff();
            SendRoomInfoChangeNotify();
            //SendSeatInfoChangeNotify(seat);
        }
Пример #2
0
 /// <summary>
 /// 离开消息回调   服务器广播玩家离开消息
 /// </summary>
 /// <param name="obj"></param>
 public void LeaveRoom(NN_ROOM_LEAVE proto)
 {
     RoomNiuNiuProxy.Instance.ExitRoom(proto);
 }
Пример #3
0
    /// <summary>
    /// 服务器广播玩家离开消息
    /// </summary>
    /// <param name="obj"></param>
    private void OnServerBroadcastLeave(byte[] obj)
    {
        NN_ROOM_LEAVE proto = NN_ROOM_LEAVE.decode(obj);

        GameStateManager.Instance.LeaveRoom(proto);
    }