/// <summary> /// 开始发空牌 /// </summary> /// <param name="proto"></param> internal void BeginProxy(GP_ROOM_BEGIN proto) { CurrentRoom.roomStatus = ROOM_STATUS.DEAL; CurrentRoom.dealSecond++; CurrentRoom.FirstGivePos = proto.room.firstGivePos; //首发牌座位号 CurrentRoom.FirstDice = proto.room.firstDice; //第一个筛子 CurrentRoom.SecondDice = proto.room.secondDice; //第二个筛子 for (int i = 0; i < proto.room.seatListCount(); i++) { SeatEntity seat = GetSeatBySeatId(proto.room.getSeatList(i).pos); seat.seatStatus = SEAT_STATUS.EMPTYPOKER; if (seat.pokerList.Count != 0) { seat.pokerList.Clear(); } GP_SEAT op_seat = proto.room.getSeatList(i); 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, //大小 }); } } TransferData data = new TransferData(); data.SetValue("Room", CurrentRoom); SendNotification("DealRollDice", data);//播放发牌摇筛子,发牌 }
/// <summary> /// 正常游戏下设置排行 /// </summary> /// <param name="proto"></param> public void SetUI(GP_ROOM_GAMEOVER proto) { seatList = new List <SeatEntity>(); for (int i = 0; i < proto.room.seatListCount(); i++) { GP_SEAT op_seat = proto.room.getSeatList(i); if (op_seat.playerId == 0) { continue; } SeatEntity seat = new SeatEntity(); seat.PlayerId = op_seat.playerId; //玩家ID seat.Nickname = op_seat.nickname; //玩家名字 seat.Pos = op_seat.pos; seat.Avatar = op_seat.avatar; //玩家头像 seat.Gender = op_seat.gender; //玩家性别 seat.Gold = op_seat.gold; //底分 seat.Pos = op_seat.pos; //座位位置 seat.pokerList = new List <Poker>(); for (int j = 0; j < op_seat.maxPokerListCount(); j++) { GP_POKER op_Poker = op_seat.getMaxPokerList(j); seat.pokerList.Add(new Poker() { Index = op_Poker.index, //索引 Type = op_Poker.type, //花色 Size = op_Poker.size, //大小 }); } seatList.Add(seat); } SeatSort(seatList); #if IS_CHUANTONGPAIJIU LoadRanking(seatList); #else SetResult(seatList); #endif }
/// <summary> /// 发实牌 /// </summary> internal void ValidDealProxy(GP_ROOM_VALIDDEAL proto) { if (CurrentRoom.roomPlay == EnumPlay.BigPaiJiu) { CurrentRoom.roomStatus = ROOM_STATUS.GROUPPOKER; } if (CurrentRoom.roomPlay == EnumPlay.SmallPaiJiu) { CurrentRoom.roomStatus = ROOM_STATUS.CUOPAI; } for (int i = 0; i < proto.seatListCount(); i++) { SeatEntity seat = GetSeatBySeatId(proto.getSeatList(i).pos); seat.seatStatus = SEAT_STATUS.GROUP; if (seat == PlayerSeat) { seat.groupTime = proto.unixtime; if (seat.pokerList.Count != 0) { seat.pokerList.Clear(); } for (int j = 0; j < proto.getSeatList(i).pokerListCount(); ++j) { GP_POKER protoPoker = proto.getSeatList(i).getPokerList(j); seat.pokerList.Add(new Poker() { Index = protoPoker.index, //索引 Type = protoPoker.type, //花色 Size = protoPoker.size, //大小 }); } TransferData data = new TransferData(); data.SetValue("Seat", seat); data.SetValue("Room", CurrentRoom); SendNotification(ConstantGuPaiJiu.GroupValidPoker, data); } } }
/// <summary> /// 每次结算 /// </summary> internal void SettleProxy(GP_ROOM_SETTLE proto) { CurrentRoom.roomStatus = ROOM_STATUS.SETTLE; //if (CurrentRoom.roomPokerList.Count != 0) CurrentRoom.roomPokerList.Clear(); List <SeatEntity> seatList = new List <SeatEntity>(); List <SeatEntity> seatList1 = new List <SeatEntity>(); TransferData data = new TransferData(); for (int i = 0; i < proto.room.seatListCount(); i++) { GP_SEAT op_seat = proto.room.getSeatList(i); SeatEntity seat = GetSeatBySeatId(proto.room.getSeatList(i).pos); if (seat.pokerList.Count != 0) { seat.pokerList.Clear(); } seat.seatStatus = SEAT_STATUS.SETTLE; if (seat.drawPokerList != null) { seat.drawPokerList.Clear();//清空是否翻牌集合 } seat.isCuoPai = 0; seat.firstPour = 0; seat.secondPour = 0; seat.threePour = 0; seat.Gold += proto.room.getSeatList(i).earnings; seat.eamings = proto.room.getSeatList(i).earnings; if (seat.IsBanker) { seat.firstPour = op_seat.getPourList(0); } 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, //大小 }); CurrentRoom.roomPokerList.Add(new Poker() { Index = protoPoker.index, //索引 Type = protoPoker.type, //花色 Size = protoPoker.size, //大小 }); } seatList.Add(seat); data.SetValue("Room", CurrentRoom); data.SetValue("RoomStatus", CurrentRoom.roomStatus); data.SetValue("Seat", seat); data.SetValue("PlayerSeat", PlayerSeat); data.SetValue("IsPlayer", seat == PlayerSeat); #if IS_CHUANTONGPAIJIU if (seat != PlayerSeat) { SendNotification(ConstantGuPaiJiu.GroupEnd, data); //实例化其他人的牌 } SendNotification(ConstantGuPaiJiu.OnGuPaiSetBetPour, data); //重新设置庄家下注分数 SendNotification(ConstantGuPaiJiu.SetSeatGold, data); //设置玩家的金币 #endif SendNotification(ConstantGuPaiJiu.EndIamge, data);//隐藏组合完成的图片 } data.SetValue("SeatList", seatList); #if IS_BAODINGQIPAI SendNotification(ConstantGuPaiJiu.GroupEndJieSuan, data); #endif SendNotification(ConstantGuPaiJiu.CloseDrawPoker, data); //关闭翻牌倒计时和全开按钮 #if IS_CHUANTONGPAIJIU SendNotification(ConstantGuPaiJiu.LoadSmallResult, data); //小结算界面 SendNotification(ConstantGuPaiJiu.PlayMusic, data); //播放音乐 #endif }
} //目前运营商 #region 初始化房间数据 internal void InitRoom(GP_ROOM_CREATE 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, //每局第几次 fzName = proto.room.ownerNickName, //PlayerID = 111, isGrabBankerNum = 0,//抢庄的人数 }; CurrentRoom.roomPokerList = new List <Poker>(); 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(); Debug.Log(proto.room.settingIdCount() + " Stting长度"); 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; } 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.IP = op_seat.ipAddr; //IP seat.Longitude = op_seat.longitude; //经度 seat.Latitude = op_seat.latitude; //维度 seat.IsFocus = !op_seat.isAfk; //是否在线 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(i); seat.pokerList.Add(new Poker() { Index = protoPoker.index, //索引 Type = protoPoker.type, //花色 Size = protoPoker.size, //大小 }); } CurrentRoom.seatList.Add(seat); } CalculateSeatIndexOne(); //普通场计算座位 Index }