//发牌 public static async void Deal(this FiveStarRoom fiveStarRoom) { fiveStarRoom.intData = fiveStarRoom.RoomNumber; if (fiveStarRoom.intData == 4) { fiveStarRoom.intData--;//4人房实际只有3个人 发牌 } RepeatedField <RepeatedField <int> > dealCards; if (fiveStarRoom.IsHaveAI) { dealCards = CardFiveGameDealLogic.AIDealCards(fiveStarRoom.intData);//如果有AI就用AI发牌 } else { dealCards = CardFiveGameDealLogic.DealCards(fiveStarRoom.intData);//如果没有有AI就正常发牌 } fiveStarRoom.ResidueCards = dealCards[fiveStarRoom.intData]; //四人房 在休息玩家的位置 多个一个空的数组 if (fiveStarRoom.RoomNumber == 4) { RepeatedField <RepeatedField <int> > fourCards = new RepeatedField <RepeatedField <int> >(); for (int i = 0; i < dealCards.Count; i++) { if (i == fiveStarRoom.CurrRestSeatIndex) { fourCards.Add(new RepeatedField <int>()); } fourCards.Add(dealCards[i]); } dealCards = fourCards; } //发牌 for (int i = 0; i < fiveStarRoom.FiveStarPlayerDic.Count; i++) { fiveStarRoom.FiveStarPlayerDic[i].Deal(dealCards[i]); } fiveStarRoom.DealFinishRecordGameInitInfo(); //发完牌记录初始化信息 await Game.Scene.GetComponent <TimerComponent>().WaitAsync(2000); //延迟两秒在摸牌 fiveStarRoom.PlayerMoPai(fiveStarRoom.FirstMoCardSeatIndex); //发完牌第一个玩家摸牌 }
//玩家进行出牌 public static void PlayerPlayCard(this FiveStarRoom fiveStarRoom, int seatIndex, int card) { fiveStarRoom.GangHuNum--;//给杠上开的标记减1 fiveStarRoom.CurrChuPaiIndex = seatIndex; fiveStarRoom.CurrChuPaiCard = card; fiveStarRoom.boolData = false; for (int i = 0; i < fiveStarRoom.RoomNumber; i++) { if (seatIndex == i) { continue; } if (fiveStarRoom.FiveStarPlayerDic[i].IsCanOperate(card)) //检测其他玩家能不能进行操作 { fiveStarRoom.FiveStarPlayerDic[i].CanOperate(FiveStarOperateType.MoCard); //广播可操作消息 fiveStarRoom.boolData = true; } } if (!fiveStarRoom.boolData) { fiveStarRoom.PlayerMoPai(); } }