/// <summary> /// 显示按钮,并disable所有按钮 /// </summary> private void DisableAllBtns() { //DDzUtil.DisableBtn(BuYaoBtn, DisBuYaoBtn); DDzUtil.DisableBtn(TiShiBtn, DisTiShiBtn); DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn); var hdcdSplitGp = new CdSplitStruct(HdCdsListTemp.ToArray()); //如果含有炸弹则跳过 if (hdcdSplitGp.FourCds.Count < 1) { var canOutType = CheckCanOutCdsOneTime(hdcdSplitGp); //防止发送消息不成功,直接点亮出牌按钮,让玩家有再次发送的机会 if (canOutType != CardType.None && canOutType != CardType.Exception) { HdCdctrlInstance.UpAllHandCds(); DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn); return; } } var args = new HdCdCtrlEvtArgs(HdCdctrlInstance.GetUpCdList().ToArray()); OnHdCdsCtrlEvent(null, args); _onoffIchosecCds = true; }
/// <summary> /// 最终检测手牌 /// </summary> /// <param name="isgetcdsWithoutCompare">是不是在没有其他人出牌情况下</param> private void FinalOutCdsCheck(bool isgetcdsWithoutCompare) { //经过智能检索后最后检查一遍抬出的牌是否合法----start--- var finalType = PokerRuleUtil.GetCdsType(HdCdctrlInstance.GetUpCdList().ToArray()); if (finalType != CardType.None && finalType != CardType.Exception) { //如果选出的牌型不是那种单牌,或者对子的小牌型,就先关闭智能选牌 if (isgetcdsWithoutCompare && finalType != CardType.C1 && finalType != CardType.C2) { _onoffIchosecCds = false; } else if (!isgetcdsWithoutCompare) { _onoffIchosecCds = false; } DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn); } else { DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn); } //------------end }
//检测最后一手牌全出 private void endchupaiV(bool isRejoin, List <int> Tcards, ISFSObject lastOutData) { //Debug.Log("<color=#0021FFFF>" + "检测最后一手牌全出" + "</color>"); _cardManager.FindCds(Tcards.ToArray(), lastOutData); var tishiGpCunt = _cardManager.GetTishiGroupList.Count; if (tishiGpCunt > 0) { DDzUtil.ActiveBtn(TiShiBtn, DisTiShiBtn); //如果不是重连则自动提示,重连现在自动提示牌不提起来,有些问题,需要查一下,先保证不出错,重连时就不自动预提示了,需要手动点提示 if (tishiGpCunt == 1) { //如果直接一手牌全出,则自动出牌 if (_cardManager.GetTishiGroupList[0].Length == Tcards.Count) { foreach (var purecdvalue in Tcards.ToArray()) { HdCdctrlInstance.JustUpCd(purecdvalue); } OnChuPaiClick(); } } if (!isRejoin) { OnTishiClick(); } } else { //DDzUtil.DisableBtn(TiShiBtn, DisTiShiBtn); HdCdctrlInstance.RepositionAllHdCds(); HideAllBtns(); } }
/// <summary> /// 点击提示按钮 /// </summary> public void OnTishiClick() { HdCdctrlInstance.RepositionAllHdCds(); var oneTishiGroup = _cardManager.GetOneTishiGroup(); if (oneTishiGroup == null || oneTishiGroup.Length < 1) { return; } foreach (var purecdvalue in oneTishiGroup) { HdCdctrlInstance.JustUpCd(purecdvalue); } //如果提示成功,把智能选牌关闭 _onoffIchosecCds = false; //_mayoutCdsTemp = (int[]) oneTishiGroup.Clone(); //有提示牌组,点亮出牌按钮 DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn); }
/// <summary> /// 当玩家有对手牌进行点击操作时 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void OnHdCdsCtrlEvent(object sender, HdCdCtrlEvtArgs args) { //如果不该自己行动 if (!ChuPaiBtn.activeSelf && !DisChuPaiBtn.activeSelf) { return; } //如果没有选牌 if (args.SelectedCds.Length == 0) { DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn); _onoffIchosecCds = true; return; } var selectedCds = args.SelectedCds; var lastOutCds = _lastOutData.GetIntArray(RequestKey.KeyCards); //如果直接全选了所有手牌,且不是关别家的牌是自己主动出的情况下,检查能不能一次全出 if (selectedCds.Length == HdCdsListTemp.Count && _lastOutData.GetInt(RequestKey.KeySeat) == App.GetGameData <GlobalData>().GetSelfSeat) { var canOutType = CheckCanOutCdsOneTime(new CdSplitStruct(HdCdsListTemp.ToArray())); if (canOutType != CardType.None && canOutType != CardType.Exception) { HdCdctrlInstance.UpAllHandCds(); DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn); return; } } //-----------------------start 智能选牌过程-------有赖子,或者开关关闭则不用智能选牌---------------------------- bool isgetcdsWithoutCompare = false;//标记是不是在自己出动出牌时做出的智能选牌 int[] mayOutCds = null; bool selCdshasLaizi = PokerRuleUtil.CheckHaslz(selectedCds); if (!selCdshasLaizi && _onoffIchosecCds) { if (_lastOutData.GetInt(RequestKey.KeySeat) == App.GetGameData <GlobalData>().GetSelfSeat) { mayOutCds = _checkCardTool.GetcdsWithOutCompare(selectedCds, HdCdsListTemp.ToArray()); isgetcdsWithoutCompare = true; } else { //DDzUtil.ActiveBtn(BuYaoBtn, DisBuYaoBtn); mayOutCds = _checkCardTool.ChkCanoutCdListWithLastCdList(selectedCds, _cardManager.GetTishiGroupDic, lastOutCds); } } //---------------------------------------------------------------------------------------end /* //---start---------------使智能选牌出了相同的牌型,不重复执行----------------------- * var haschosemayOutCds = DDzUtil.IsTwoArrayEqual(HdCdsCtrl.SortCds(_mayoutCdsTemp), HdCdsCtrl.SortCds(mayOutCds)); * _mayoutCdsTemp = mayOutCds; * //如果上次智能选牌和本次相同,则直接取消一次智能选牌 * if (haschosemayOutCds) * { * mayOutCds = null; * } * //----------------------------------------------------------------------------------end*/ if (mayOutCds == null || mayOutCds.Length == 0) { bool isMatch; //如果_lastOutData不是自己出牌 if (_lastOutData.GetInt(RequestKey.KeySeat) != App.GetGameData <GlobalData>().GetSelfSeat) { var lastoutcds = new List <int>(); lastoutcds.AddRange(lastOutCds); var cardTypeDic = _cardManager.CheckCanGuanCds(selectedCds, selCdshasLaizi, lastoutcds.ToArray()); isMatch = cardTypeDic != null && cardTypeDic.Count > 0; } else { var cardTypeDic = _cardManager.CheckCanGuanCds(selectedCds, selCdshasLaizi, null); isMatch = cardTypeDic != null && cardTypeDic.Count > 0; } //Debug.LogError("isMatch: " + isMatch); if (isMatch) { HdCdctrlInstance.UpCdList(selectedCds); } else { DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn); return; } } else { if (!ChooseMayOutCards(mayOutCds, selectedCds)) { DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn); return; } } FinalOutCdsCheck(isgetcdsWithoutCompare); }