/// <summary> /// 服务器广播断线重连 /// </summary> private void OnServerBroadcastRecreate(byte[] obj) { GP_ROOM_RECREATE proto = GP_ROOM_RECREATE.decode(obj); UIViewManager.Instance.CloseWait(); RoomGuPaiJiuProxy.Instance.InitRoom(proto); SceneMgr.Instance.LoadScene(SceneType.GuPaiJiu); }
internal void InitRoom(GP_ROOM_RECREATE proto) { CurrentRoom = new RoomEntity() { roomId = proto.room.roomId, //房间ID currentLoop = proto.room.loop, //局数 maxLoop = proto.room.maxLoop, //总局数 roomStatus = proto.room.status, //房间状态 FirstDice = proto.room.firstDice, //第一个骰子 SecondDice = proto.room.secondDice, //第二个骰子 FirstGivePos = proto.room.firstGivePos, //首发牌座位号 TotalPokerNum = proto.room.totalPokerNum, //房间牌的总数量 RemainPokerNum = proto.room.remainPokerNum, //房间剩余牌的数量 PanBase = proto.room.panBase, //锅底 IsAddPanBase = proto.room.isAddPanBase, //是否加锅底 dealSecond = proto.room.dealTime, roomUnixtime = proto.room.unixtime, //庄家翻牌时间 fzName = proto.room.ownerNickName, // PlayerID = 111, isGrabBankerNum = 0,//抢庄的人数 }; Debug.Log(proto.room.status + " 断线重连房间状态"); CurrentRoom.roomPokerList = new List <Poker>(); Debug.Log(proto.room.historyPokerListCount() + " 房间牌长度"); for (int i = 0; i < proto.room.historyPokerListCount(); i++) { GP_POKER protoPoker = proto.room.getHistoryPokerList(i); CurrentRoom.roomPokerList.Add(new Poker() { Index = protoPoker.index, //索引 Type = protoPoker.type, //花色 Size = protoPoker.size, //大小 }); } CurrentRoom.Config.Clear(); for (int i = 0; i < proto.room.settingIdCount(); ++i) { cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(proto.room.getSettingId(i)); if (settingEntity != null) { CurrentRoom.Config.Add(settingEntity); if (settingEntity.tags.Equals("isGuiZi")) { CurrentRoom.enumGuiZi = (EnumGuiZi)settingEntity.value; } if (settingEntity.tags.Equals("isTianJiuWang")) { CurrentRoom.enumTianJiuWang = (EnumTianJiuWang)settingEntity.value; } if (settingEntity.tags.Equals("isDiJiuWang")) { CurrentRoom.enumDiJiuWang = (EnumDiJiuWang)settingEntity.value; } if (settingEntity.tags.Equals("banker")) { CurrentRoom.roomMode = (RoomEntity.RoomMode)settingEntity.value; Debug.Log((RoomEntity.RoomMode)settingEntity.value + " 是否是抢庄模式"); } if (settingEntity.tags.Equals("pourModel")) { CurrentRoom.betModel = (RoomEntity.BetModel)settingEntity.value; if (settingEntity.value == 1) { isBet = true; } else { isBet = false; } } if (settingEntity.tags.Equals("limit")) { CurrentRoom.scoreLimit = settingEntity.value; } if (settingEntity.tags.Equals("defaultScore")) { CurrentRoom.guDScore = settingEntity.value; } if (settingEntity.tags.Equals("isBig")) { CurrentRoom.roomPlay = (EnumPlay)settingEntity.value; } } } CurrentRoom.seatList = new List <SeatEntity>(); for (int i = 0; i < proto.room.seatListCount(); i++) { GP_SEAT op_seat = proto.room.getSeatList(i); SeatEntity seat = new SeatEntity(); seat.PlayerId = op_seat.playerId; //玩家ID seat.Nickname = op_seat.nickname; //玩家名字 seat.Avatar = op_seat.avatar; //玩家头像 seat.Gender = op_seat.gender; //玩家性别 seat.Gold = op_seat.gold; //底分 seat.Pos = op_seat.pos; //座位位置 seat.seatStatus = op_seat.status; ////座位状态 seat.IsBanker = op_seat.isBanker; //是否是庄家 seat.isDismiss = op_seat.isDismiss; //是否同意解散房间 seat.isWin = op_seat.isWin; //是否是赢家 seat.eamings = op_seat.earnings; //本次收益 seat.loopEamings = op_seat.loopEarnings; //每局收益 seat.groupTime = proto.room.groupPokerTime; //组合牌时间 seat.IP = op_seat.ipAddr; //IP seat.Longitude = op_seat.longitude; //经度 seat.Latitude = op_seat.latitude; //维度 seat.IsFocus = !op_seat.isAfk; //是否在线 (true 表示不在线,false 表示在线) seat.isGrabBanker = op_seat.isGrabBanker; //标记座位是否抢庄 if (seat.isGrabBanker == 1 && CurrentRoom.roomMode == RoomEntity.RoomMode.RobZhuang) { CurrentRoom.isGrabBankerNum++; } seat.isCuoPai = op_seat.isCuoPai; seat.firstPour = op_seat.getPourList(0); //一道 seat.secondPour = op_seat.getPourList(1); //二道 seat.threePour = op_seat.getPourList(2); //三道 seat.pokerList = new List <Poker>(); for (int j = 0; j < op_seat.pokerListCount(); ++j) { GP_POKER protoPoker = op_seat.getPokerList(j); seat.pokerList.Add(new Poker() { Index = protoPoker.index, //索引 Type = protoPoker.type, //花色 Size = protoPoker.size, //大小 }); } seat.drawPokerList = new List <int>(); if (op_seat.drawPokerListCount() != 0) { for (int k = 0; k < op_seat.drawPokerListCount(); k++) { seat.drawPokerList.Add(op_seat.getDrawPokerList(k)); } } CurrentRoom.seatList.Add(seat); } CalculateSeatIndexOne(); //普通场计算座位 Index }