/// <summary> /// 判断手牌中是否有该花色的副牌 /// </summary> /// <param name="mPokerType"></param> /// <returns></returns> public static bool IsContainTypePoke(List <PokerInfo> myRestPokerList, int mLevelPokerNum, Consts.PokerType mPokerType, out List <PokerInfo> typeList) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "IsContainTypePoke")) { typeList = new List <PokerInfo>(); bool b = (bool)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "IsContainTypePoke", null, myRestPokerList, mLevelPokerNum, mPokerType, typeList); return(b); } typeList = new List <PokerInfo>(); for (int i = 0; i < myRestPokerList.Count; i++) { PokerInfo myRestPoker = myRestPokerList[i]; if (myRestPoker.m_pokerType == mPokerType && myRestPoker.m_num != mLevelPokerNum) { typeList.Add(myRestPokerList[i]); } } if (typeList.Count > 0) { typeList = typeList.OrderBy(a => a.m_weight).ToList(); return(true); } return(false); }
/// <summary> /// 得到牌中对子,并通过权重排序 /// 如果是3副以上的牌,此算法有问题 /// </summary> /// <param name="PokerList"></param> /// <returns></returns> public static List <PokerInfo> GetDoublePoker(List <PokerInfo> PokerList) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "GetDoublePoker")) { List <PokerInfo> list_temp = (List <PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "GetDoublePoker", null, PokerList); return(list_temp); } List <PokerInfo> firestDoubleList = new List <PokerInfo>(); for (int i = 0; i < PokerList.Count - 1; i++) { PokerInfo pokerInfo = PokerList[i]; for (int j = i + 1; j < PokerList.Count; j++) { if (pokerInfo.m_num == PokerList[j].m_num && pokerInfo.m_pokerType == PokerList[j].m_pokerType) { firestDoubleList.Add(PokerList[i]); firestDoubleList.Add(PokerList[j]); } } } return(firestDoubleList.OrderBy(a => a.m_weight).ToList()); }
public void SetPoker(PokerInfo _info, bool isShow = true) { info = _info; img.sprite = ResourcesManage.GetPokerSprite(info.Id); if (isShow) { Show(); } }
public void Hide() { isSelect = false; tempSelect = false; isClickEvent = false; trans.localPosition = initPos; info = null; obj.SetActive(false); }
//单牌是否为主牌 public static bool IsMasterPoker(PokerInfo pokerInfo, int mLevelPokerNum, int masterPokerType) { if (pokerInfo.m_num == mLevelPokerNum || pokerInfo.m_pokerType == (Consts.PokerType)masterPokerType || pokerInfo.m_pokerType == Consts.PokerType.PokerType_Wang) { return(true); } else { return(false); } }
public void SetInfo(PokerInfo _info) { List <Poker> _list = GetHidePokerList(); if (_list.Count == 0) { Poker poker = new Poker(_rootTrans); this.PokerList.Add(poker); _list.Add(poker); } _list[0].SetPoker(_info); }
/// <summary> /// 判断手牌中是否有主牌 /// </summary> /// <param name="myRestPokerList"></param> /// <param name="mLevelPokerNum"></param> /// <param name="masterPokerType"></param> /// <returns></returns> public static bool IsContainMasterPoker(List <PokerInfo> myRestPokerList, int mLevelPokerNum, int masterPokerType) { for (int i = 0; i < myRestPokerList.Count; i++) { PokerInfo myRestPoker = myRestPokerList[i]; if (IsMasterPoker(myRestPoker, mLevelPokerNum, masterPokerType)) { return(true); } } return(false); }
/// <summary> /// 得到手牌中的所有主牌 /// </summary> /// <param name="pokerInfos"></param> /// <param name="mLevelPokerNum"></param> /// <param name="masterPokerType"></param> /// <returns></returns> public static List <PokerInfo> GetMasterPoker(List <PokerInfo> pokerInfos, int mLevelPokerNum, int masterPokerType) { List <PokerInfo> pokers = new List <PokerInfo>(); for (int i = 0; i < pokerInfos.Count; i++) { PokerInfo pokerInfo = pokerInfos[i]; if (IsMasterPoker(pokerInfo, mLevelPokerNum, masterPokerType)) { pokers.Add(pokerInfo); } } return(pokers.OrderBy(a => a.m_weight).ToList()); }
/// <summary> /// 得到主牌中的级牌和大小王 /// </summary> /// <param name="masterPoker"></param> /// <param name="mLevelPokerNum"></param> /// <param name="masterPokerType"></param> /// <returns></returns> public static List <PokerInfo> GetJiPaiAndWang(List <PokerInfo> masterPoker, int mLevelPokerNum) { List <PokerInfo> pokerInfos = new List <PokerInfo>(); for (int i = 0; i < masterPoker.Count; i++) { PokerInfo pokerInfo = masterPoker[i]; if (pokerInfo.m_num == mLevelPokerNum || pokerInfo.m_pokerType == Consts.PokerType.PokerType_Wang) { pokerInfos.Add(pokerInfo); } } return(pokerInfos); }
/// <summary> /// 发牌协程 /// </summary> public IEnumerator DealPoker(int[] pokerData) { int playerIndex = 0; for (int i = 0; i < pokerData.Length - 3; i++) { PokerInfo info = new PokerInfo(); info.Id = pokerData[i] + 1; PokerListManage list = userList[playerIndex].handsPoker; Tools.isAnimaOk = false; list.SetInfo(info); list.Sort(); list.MovePos(); playerIndex = (++playerIndex) % 3; yield return(new WaitForSeconds(0.1f)); } userList[0].handsPoker.SetClickEvent(true); for (int i = pokerData.Length - 3; i < pokerData.Length; i++) { Poker poker = new Poker(UIGameMainPanel.Self.lastPokerRoot); UIGameMainPanel.Self.lastPoker.Add(poker); } UIGameOperPanel.Self.ShowOperBtn(); // yield return new WaitForSeconds(1f); // //初始化显示底牌 // InsShowBackPoker(); // //显示玩家手牌 // for (int i = 0; i < player.Length; i++) // { // player[i].PokerSort(); // player[i].ShowPoker(); // } // //发牌完毕为抢地主状态 // if (state == GameState.Empty) // { // gameState = GameState.GrabLandLording; // } // //抢地主按钮 // if (maxPlayerIndex == -1) // { // View_GrabLandLord.SetActive(true); // } }
private void DoBigDeal() { var gdata = App.GetGameData <GangwuGameData>(); PokerInfo pokerInfo = _showPokersInfo.Dequeue(); Transform toPos = gdata.GetPlayer <PlayerPanel>(pokerInfo.Seat, true).PokersTrans[pokerInfo.PokerCount]; GameObject dealPoker = DealOnes(BigBirth, toPos, pokerInfo.PokerValue, pokerInfo.PokerCount); //显示牌正面 PokerCard pokerCard = dealPoker.GetComponent <PokerCard>(); pokerCard.SetCardFront(); //将牌放入公共牌堆,方便管理 App.GetGameManager <GangWuGameManager>().PublicPokers.Add(pokerCard); Facade.Instance <MusicManager>().Play("dealer"); }
/// <summary> /// 给weight重新赋值,从2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 /// 17为大王,16为小王,15为主级牌,14为副级牌 /// 无主情况下,16为大王,15为小王,14为级牌 /// </summary> /// <param name="list">牌</param> /// <param name="levelPokerNum">级牌</param> /// <param name="masterPokerType">主牌花色</param> /// <returns></returns> public static List <PokerInfo> SetPokerWeight(List <PokerInfo> list, int levelPokerNum, Consts.PokerType masterPokerType) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "SetPokerWeight")) { List <PokerInfo> list_temp = (List <PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "SetPokerWeight", null, list, levelPokerNum, masterPokerType); return(list_temp); } for (int i = 0; i < list.Count; i++) { PokerInfo pokerInfo = list[i]; //是级牌 if (pokerInfo.m_num == levelPokerNum) { if (pokerInfo.m_pokerType == masterPokerType) { pokerInfo.m_weight = 15; } else { pokerInfo.m_weight = 14; } } //大王 else if (pokerInfo.m_num == 16) { pokerInfo.m_weight = (int)masterPokerType != (-1) ? 17 : 16; } //小王 else if (pokerInfo.m_num == 15) { pokerInfo.m_weight = (int)masterPokerType != (-1) ? 16 : 15; } else if (pokerInfo.m_num < levelPokerNum) { pokerInfo.m_weight = pokerInfo.m_num; } else { pokerInfo.m_weight = pokerInfo.m_num - 1; } } return(list); }
/// <summary> /// 得到牌中对子,并通过权重排序 /// 如果是3副以上的牌,此算法有问题 /// </summary> /// <param name="PokerList"></param> /// <returns></returns> public static List <PokerInfo> GetDoublePoker(List <PokerInfo> PokerList) { List <PokerInfo> firestDoubleList = new List <PokerInfo>(); for (int i = 0; i < PokerList.Count - 1; i++) { PokerInfo pokerInfo = PokerList[i]; for (int j = i + 1; j < PokerList.Count; j++) { if (pokerInfo.m_num == PokerList[j].m_num && pokerInfo.m_pokerType == PokerList[j].m_pokerType) { firestDoubleList.Add(PokerList[i]); firestDoubleList.Add(PokerList[j]); } } } return(firestDoubleList.OrderBy(a => a.m_weight).ToList()); }
//单牌是否为主牌 public static bool IsMasterPoker(PokerInfo pokerInfo, int mLevelPokerNum, int masterPokerType) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "IsMasterPoker")) { bool b = (bool)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "IsMasterPoker", null, pokerInfo, mLevelPokerNum, masterPokerType); return(b); } if (pokerInfo.m_num == mLevelPokerNum || pokerInfo.m_pokerType == (Consts.PokerType)masterPokerType || pokerInfo.m_pokerType == Consts.PokerType.PokerType_Wang) { return(true); } else { return(false); } }
/// <summary> /// 判断手牌中是否有主牌 /// </summary> /// <param name="myRestPokerList"></param> /// <param name="mLevelPokerNum"></param> /// <param name="masterPokerType"></param> /// <returns></returns> public static bool IsContainMasterPoker(List <PokerInfo> myRestPokerList, int mLevelPokerNum, int masterPokerType) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "IsContainMasterPoker")) { bool b = (bool)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "IsContainMasterPoker", null, myRestPokerList, mLevelPokerNum, masterPokerType); return(b); } for (int i = 0; i < myRestPokerList.Count; i++) { PokerInfo myRestPoker = myRestPokerList[i]; if (IsMasterPoker(myRestPoker, mLevelPokerNum, masterPokerType)) { return(true); } } return(false); }
public void BeginBigDeal(int[] pokers, int[] seats, int cardCount) { if (_showPokersInfo.Count <= 0) { _showPokersInfo.Clear(); } for (int i = 0; i < pokers.Length; i++) { PokerInfo pokerInfo = new PokerInfo { Seat = seats[i], PokerCount = cardCount, PokerValue = pokers[i] }; _showPokersInfo.Enqueue(pokerInfo); } IsBigDeal = true; }
/// <summary> /// 得到主牌中的级牌和大小王 /// </summary> /// <param name="masterPoker"></param> /// <param name="mLevelPokerNum"></param> /// <param name="masterPokerType"></param> /// <returns></returns> public static List <PokerInfo> GetJiPaiAndWang(List <PokerInfo> masterPoker, int mLevelPokerNum) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "GetJiPaiAndWang")) { List <PokerInfo> list_temp = (List <PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "GetJiPaiAndWang", null, masterPoker, mLevelPokerNum); return(list_temp); } List <PokerInfo> pokerInfos = new List <PokerInfo>(); for (int i = 0; i < masterPoker.Count; i++) { PokerInfo pokerInfo = masterPoker[i]; if (pokerInfo.m_num == mLevelPokerNum || pokerInfo.m_pokerType == Consts.PokerType.PokerType_Wang) { pokerInfos.Add(pokerInfo); } } return(pokerInfos); }
/// <summary> /// 得到手牌中的所有主牌 /// </summary> /// <param name="pokerInfos"></param> /// <param name="mLevelPokerNum"></param> /// <param name="masterPokerType"></param> /// <returns></returns> public static List <PokerInfo> GetMasterPoker(List <PokerInfo> pokerInfos, int mLevelPokerNum, int masterPokerType) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("PlayRuleUtil_hotfix", "GetMasterPoker")) { List <PokerInfo> list_temp = (List <PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.PlayRuleUtil_hotfix", "GetMasterPoker", null, pokerInfos, mLevelPokerNum, masterPokerType); return(list_temp); } List <PokerInfo> pokers = new List <PokerInfo>(); for (int i = 0; i < pokerInfos.Count; i++) { PokerInfo pokerInfo = pokerInfos[i]; if (IsMasterPoker(pokerInfo, mLevelPokerNum, masterPokerType)) { pokers.Add(pokerInfo); } } return(pokers.OrderBy(a => a.m_weight).ToList()); }
/// <summary> /// 当收到结算信息时,进行紧急处理 /// </summary> public void OnResult() { var gdata = App.GameData; if (_showPokersInfo.Count <= 0) { return; } IsBigDeal = false; //停止有动画的发牌 PokerInfo pinfo = _showPokersInfo.Dequeue(); int cardIndex = pinfo.PokerCount; // BigIndex / _playerSeats.Length; //发到了第几张手牌 int seatIndex = pinfo.Seat; // _playerSeats[(BigIndex + _fristSeat) % _playerSeats.Length]; //发到了第几个人 Transform toPos = gdata.GetPlayer <PlayerPanel>(seatIndex, true).PokersTrans[cardIndex]; int cardValue; //第一张是个人牌,从第二张开始才是公共牌 if (seatIndex == gdata.SelfSeat) { cardValue = cardIndex < 1 ? gdata.GetPlayer <PlayerPanel>().UserBetPoker.LeftCardValue : pinfo.PokerValue;// _showPokers.Dequeue(); } else { cardValue = cardIndex < 1 ? 0 : pinfo.PokerValue; // _showPokers.Dequeue(); } GameObject dealPoker = DealOnes(toPos, cardValue, cardIndex); //_cardIndex dealPoker.GetComponent <PokerCard>().SetCardFront(); Facade.Instance <MusicManager>().Play("dealer"); App.GetGameManager <GangWuGameManager>().PublicPokers.Add(dealPoker.GetComponent <PokerCard>()); }
/// <summary> /// 给weight重新赋值,从2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 /// 17为大王,16为小王,15为主级牌,14为副级牌 /// 无主情况下,16为大王,15为小王,14为级牌 /// </summary> /// <param name="list">牌</param> /// <param name="levelPokerNum">级牌</param> /// <param name="masterPokerType">主牌花色</param> /// <returns></returns> public static List <PokerInfo> SetPokerWeight(List <PokerInfo> list, int levelPokerNum, Consts.PokerType masterPokerType) { for (int i = 0; i < list.Count; i++) { PokerInfo pokerInfo = list[i]; //是级牌 if (pokerInfo.m_num == levelPokerNum) { if (pokerInfo.m_pokerType == masterPokerType) { pokerInfo.m_weight = 15; } else { pokerInfo.m_weight = 14; } } //大王 else if (pokerInfo.m_num == 16) { pokerInfo.m_weight = (int)masterPokerType != (-1) ? 17 : 16; } //小王 else if (pokerInfo.m_num == 15) { pokerInfo.m_weight = (int)masterPokerType != (-1) ? 16 : 15; } else if (pokerInfo.m_num < levelPokerNum) { pokerInfo.m_weight = pokerInfo.m_num; } else { pokerInfo.m_weight = pokerInfo.m_num - 1; } } return(list); }
/// <summary> /// 判断手牌中是否有该花色的副牌 /// </summary> /// <param name="mPokerType"></param> /// <returns></returns> public static bool IsContainTypePoke(List <PokerInfo> myRestPokerList, int mLevelPokerNum, Consts.PokerType mPokerType, out List <PokerInfo> typeList) { typeList = new List <PokerInfo>(); for (int i = 0; i < myRestPokerList.Count; i++) { PokerInfo myRestPoker = myRestPokerList[i]; if (myRestPoker.m_pokerType == mPokerType && myRestPoker.m_num != mLevelPokerNum) { typeList.Add(myRestPokerList[i]); } } if (typeList.Count > 0) { typeList = typeList.OrderBy(a => a.m_weight).ToList(); return(true); } return(false); }
public void InitFirst() { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TestPoker_hotfix", "InitFirst")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TestPoker_hotfix", "InitFirst", null, null); return; } Init(HeiTaoContent, Consts.PokerType.PokerType_HeiTao); Init(HongContent, Consts.PokerType.PokerType_HongTao); Init(MeiContent, Consts.PokerType.PokerType_MeiHua); Init(FangContent, Consts.PokerType.PokerType_FangKuai); xiaoWangList.Add(xiaoWang1); xiaoWangList.Add(xiaoWang2); daWangList.Add(daWang1); daWangList.Add(daWang2); var xiaopokerInfo = new PokerInfo(15, Consts.PokerType.PokerType_Wang); var dapokerInfo = new PokerInfo(16, Consts.PokerType.PokerType_Wang); for (int i = 0; i < xiaoWangList.Count; i++) { var xiaoWang = xiaoWangList[i]; var dawang = daWangList[i]; var btn = xiaoWang.gameObject.AddComponent <Button>(); var image = xiaoWang.GetComponent <Image>(); bool isClick = false; btn.onClick.AddListener(() => { if (!isClick) { image.color = Color.gray; selectedPokers.Add(xiaopokerInfo); isClick = true; text.text = "当前选择:" + selectedPokers.Count + "张"; } else { image.color = Color.white; selectedPokers.Remove(xiaopokerInfo); isClick = false; text.text = "当前选择:" + selectedPokers.Count + "张"; } }); var btn1 = dawang.gameObject.AddComponent <Button>(); var image1 = dawang.GetComponent <Image>(); bool isClick1 = false; btn1.onClick.AddListener(() => { if (!isClick1) { image1.color = Color.gray; selectedPokers.Add(dapokerInfo); isClick1 = true; text.text = "当前选择:" + selectedPokers.Count + "张"; } else { image1.color = Color.white; selectedPokers.Remove(dapokerInfo); isClick1 = false; text.text = "当前选择:" + selectedPokers.Count + "张"; } }); } this.transform.localPosition = new Vector3(0, 0, 0); startPosition = this.transform.localPosition; }
public void UpdateUi(List <PokerInfo> list) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TestPoker_hotfix", "UpdateUi")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TestPoker_hotfix", "UpdateUi", null, list); return; } for (int i = 0; i < list.Count; i++) { PokerInfo pokerInfo = list[i]; //大小王 if (pokerInfo.m_num == 15) { if (xiaoWangList.Count == 2 || xiaoWangList.Count == 1) { xiaoWangList[0].color = Color.gray; xiaoWangList.Remove(xiaoWangList[0]); } } else if (pokerInfo.m_num == 16) { if (daWangList.Count == 2 || daWangList.Count == 1) { daWangList[0].color = Color.gray; daWangList.Remove(daWangList[0]); } } else if (pokerInfo.m_num < 15 && pokerInfo.m_num >= 2) { Consts.PokerType Type = pokerInfo.m_pokerType; List <PokerInfo> listPoker; dicPokerData.TryGetValue(Type, out listPoker); List <GameObject> listGo; dictionaryGo.TryGetValue(Type, out listGo); int index = -1; if (listPoker != null) { for (int j = 0; j < listPoker.Count; j++) { var item = listPoker[j]; if (pokerInfo.m_num == item.m_num && pokerInfo.m_pokerType == item.m_pokerType) { index = listPoker.IndexOf(item); listPoker.Remove(item); break; } } } if (index == -1) { return; } try { if (listGo != null) { GameObject go = listGo[index]; go.GetComponent <Image>().color = Color.gray; listGo.Remove(go); } } catch (Exception e) { Console.WriteLine(e); } } else { throw new Exception("牌的num异常"); } } }
public void Init(GameObject gameObject, Consts.PokerType pokerType) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TestPoker_hotfix", "Init")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TestPoker_hotfix", "Init", null, gameObject, pokerType); return; } //初始化数据 List <PokerInfo> heiTaoPokers = new List <PokerInfo>(); List <GameObject> PokerItems = new List <GameObject>(); for (int i = 0; i < 2; i++) { for (int j = 2; j < 15; j++) { heiTaoPokers.Add(new PokerInfo(j, pokerType)); } } heiTaoPokers = heiTaoPokers.OrderByDescending(a => a.m_num).ToList(); if (!dicPokerData.ContainsKey(pokerType)) { dicPokerData.Add(pokerType, heiTaoPokers); } //初始化UI for (int i = 0; i < heiTaoPokers.Count; i++) { PokerInfo poker = heiTaoPokers[i]; GameObject go = GameObject.Instantiate(ItemPoker, gameObject.transform); var btn = go.AddComponent <Button>(); var image = go.GetComponent <Image>(); bool isClick = false; btn.onClick.AddListener(() => { if (!isClick) { image.color = Color.gray; selectedPokers.Add(poker); isClick = true; text.text = "当前选择:" + selectedPokers.Count + "张"; } else { image.color = Color.white; selectedPokers.Remove(poker); isClick = false; text.text = "当前选择:" + selectedPokers.Count + "张"; } }); PokerItems.Add(go); string temp = null; switch (pokerType) { case Consts.PokerType.PokerType_FangKuai: temp = "icon_fangkuai"; break; case Consts.PokerType.PokerType_HeiTao: temp = "icon_heitao"; break; case Consts.PokerType.PokerType_HongTao: temp = "icon_hongtao"; break; case Consts.PokerType.PokerType_MeiHua: temp = "icon_meihua"; break; } CommonUtil.setImageSpriteByAssetBundle(go.transform.Find("Type").GetComponent <Image>(), "poker.unity3d", temp); int num = poker.m_num; if (num >= 2 && num <= 10) { go.GetComponentInChildren <Text>().text = num.ToString(); } else { if (num == 11) { go.GetComponentInChildren <Text>().text = "J"; } else if (num == 12) { go.GetComponentInChildren <Text>().text = "Q"; } else if (num == 13) { go.GetComponentInChildren <Text>().text = "K"; } else if (num == 14) { go.GetComponentInChildren <Text>().text = "A"; } } } if (!dictionaryGo.ContainsKey(pokerType)) { dictionaryGo.Add(pokerType, PokerItems); } }
/// <summary> /// 得到甩牌是否成功后的牌 /// </summary> /// <param name="room"></param> /// <param name="outPokerList"></param> /// <returns></returns> public static List <PokerInfo> GetShuaiPaiPoker(RoomData room, List <PokerInfo> outPokerList) { List <PokerInfo> resultList = new List <PokerInfo>(); //设置牌的权重 SetPokerWeight(outPokerList, room.m_levelPokerNum, (Consts.PokerType)room.m_masterPokerType); List <PlayerData> playerDatas = room.getPlayerDataList(); //设置牌的权重 foreach (var playerData in playerDatas) { SetPokerWeight(playerData.m_curOutPokerList, room.m_levelPokerNum, (Consts.PokerType)room.m_masterPokerType); SetPokerWeight(playerData.getPokerList(), room.m_levelPokerNum, (Consts.PokerType)room.m_masterPokerType); } //得到甩牌的对子 List <PokerInfo> firestDoubleList = GetDoublePoker(outPokerList); //得到甩牌的单牌 List <PokerInfo> firestSingleList = GetSinglePoker(outPokerList, firestDoubleList); //甩牌中最小的单牌 PokerInfo minSingle = null; if (firestSingleList.Count > 0) { minSingle = firestSingleList[0]; } //TLJ_PlayService.PlayService.log.Info("有几个玩家:" + playerDatas.Count); // PlayService.log.Warn($"第一个人出牌uid:{room.m_curRoundFirstPlayer.m_uid}"); //如果甩的牌都是主牌 if (IsAllMasterPoker(outPokerList, room.m_levelPokerNum, room.m_masterPokerType)) { for (int i = 0; i < playerDatas.Count; i++) { if (playerDatas[i].m_uid == room.m_curRoundFirstPlayer.m_uid) { continue; } //得到其余玩家的手牌 List <PokerInfo> pokerList = playerDatas[i].getPokerList(); List <PokerInfo> masterPoker = GetMasterPoker(pokerList, room.m_levelPokerNum, room.m_masterPokerType); if (masterPoker.Count > 0) { //得到主牌中的对子和单牌 List <PokerInfo> OtherDoubleleList = GetDoublePoker(masterPoker); List <PokerInfo> OtherSingleList = GetSinglePoker(masterPoker, OtherDoubleleList); //没有单牌 if (firestSingleList.Count == 0) { List <List <PokerInfo> > OtherTlj; List <PokerInfo> compareDoublePoker = CompareDoublePoker(firestDoubleList, OtherDoubleleList, room.m_levelPokerNum, room.m_masterPokerType, out OtherTlj); if (compareDoublePoker.Count > 0) { return(compareDoublePoker); } } //最小的单牌牌都比其他玩家手牌中的最大主牌大 else if (minSingle.m_weight >= masterPoker[masterPoker.Count - 1].m_weight) { List <List <PokerInfo> > OtherTlj; List <PokerInfo> compareDoublePoke = CompareDoublePoker(firestDoubleList, OtherDoubleleList, room.m_levelPokerNum, room.m_masterPokerType, out OtherTlj); if (compareDoublePoke.Count > 0) { return(compareDoublePoke); } } //甩牌失败,单牌比别人小 else { TLJ_PlayService.PlayService.log.Info("甩牌失败,单牌比别人小"); resultList.Add(minSingle); return(resultList); } } //其他玩家没有主牌 else { //该玩家牌大,不作处理 } } } //同花色的副牌 else if (IsAllFuPoker(outPokerList, room.m_levelPokerNum, room.m_masterPokerType)) { Consts.PokerType mPokerType = outPokerList[0].m_pokerType; for (int i = 0; i < playerDatas.Count; i++) { if (playerDatas[i].m_uid == room.m_curRoundFirstPlayer.m_uid) { continue; } //得到其余玩家的手牌 List <PokerInfo> pokerList = playerDatas[i].getPokerList(); //得到指定花色的牌 List <PokerInfo> pokerByType = GetPokerByType(pokerList, room.m_levelPokerNum, mPokerType); if (pokerByType.Count > 0) { //得到副牌中的对子和单牌 List <PokerInfo> OtherDoubleleList = GetDoublePoker(pokerByType); List <PokerInfo> OtherSingleList = GetSinglePoker(pokerByType, OtherDoubleleList); //没有单牌 if (firestSingleList.Count == 0) { List <List <PokerInfo> > OtherTlj; List <PokerInfo> compareDoublePoke = CompareDoublePoker(firestDoubleList, OtherDoubleleList, room.m_levelPokerNum, room.m_masterPokerType, out OtherTlj); if (compareDoublePoke.Count > 0) { return(compareDoublePoke); } } //最小的单牌牌都比其他玩家手牌中的最大主牌大 else if (minSingle.m_weight >= pokerByType[pokerByType.Count - 1].m_weight) { List <List <PokerInfo> > OtherTlj; List <PokerInfo> compareDoublePoke = CompareDoublePoker(firestDoubleList, OtherDoubleleList, room.m_levelPokerNum, room.m_masterPokerType, out OtherTlj); if (compareDoublePoke.Count > 0) { return(compareDoublePoke); } } //甩牌失败,单牌比别人小 else { TLJ_PlayService.PlayService.log.Info("甩牌失败,单牌比别人小"); resultList.Add(minSingle); return(resultList); } } //其他玩家没有副牌 else { //该玩家牌大,不作处理 } } } return(resultList); }