Beispiel #1
0
        //玩家执行操作
        public static void ExecuteOperate(this FiveStarPlayer fiveStarPlayer, FiveStarOperateInfo operateInfo)
        {
            fiveStarPlayer.boolData = false;
            if (operateInfo.OperateType == FiveStarOperateType.MingGang)
            {
                if (!fiveStarPlayer.canGangCards.ContainsKey(operateInfo.Card))
                {
                    Log.Error("玩家要杠的牌 不在可杠列表里面" + operateInfo.Card);
                    return;
                }
                operateInfo.OperateType = fiveStarPlayer.canGangCards[operateInfo.Card];//玩家只发明杠 需要服务器判断是什么杠
            }

            if (fiveStarPlayer.IsLiangDao)//如果玩家亮倒了 可以胡 却选择不胡 强制胡
            {
                if (operateInfo.OperateType == FiveStarOperateType.None && fiveStarPlayer.canOperateLists.Contains(FiveStarOperateType.FangChongHu))
                {
                    operateInfo.OperateType = FiveStarOperateType.FangChongHu;
                }
            }

            switch (operateInfo.OperateType)
            {
            case FiveStarOperateType.None:
                fiveStarPlayer.boolData = true;
                break;

            case FiveStarOperateType.Peng:
                operateInfo.Card        = fiveStarPlayer.FiveStarRoom.CurrChuPaiCard;
                fiveStarPlayer.boolData = fiveStarPlayer.PengOrMingGangOrAnGang(fiveStarPlayer.FiveStarRoom.CurrChuPaiCard, 2, operateInfo.OperateType);
                break;

            case FiveStarOperateType.MingGang:
                operateInfo.Card        = fiveStarPlayer.FiveStarRoom.CurrChuPaiCard;
                fiveStarPlayer.boolData = fiveStarPlayer.PengOrMingGangOrAnGang(fiveStarPlayer.FiveStarRoom.CurrChuPaiCard, 3, operateInfo.OperateType);
                break;

            case FiveStarOperateType.AnGang:
                fiveStarPlayer.boolData = fiveStarPlayer.PengOrMingGangOrAnGang(operateInfo.Card, 4, operateInfo.OperateType);     //暗杠是可以有多个选择 要客户端传
                break;

            case FiveStarOperateType.CaGang:
                fiveStarPlayer.boolData = fiveStarPlayer.CaGang(operateInfo.Card);     //擦杠是可以有多个选择 要客户端传
                break;

            case FiveStarOperateType.FangChongHu:
            case FiveStarOperateType.ZiMo:
                operateInfo.Card        = 0;
                operateInfo.OperateType = FiveStarOperateType.ZiMo;
                if (fiveStarPlayer.Hands.Count % 3 == 1)
                {
                    operateInfo.Card        = fiveStarPlayer.FiveStarRoom.CurrChuPaiCard;
                    operateInfo.OperateType = FiveStarOperateType.FangChongHu;
                }
                fiveStarPlayer.boolData = fiveStarPlayer.HuPai(operateInfo.Card, fiveStarPlayer.FiveStarRoom.CurrChuPaiIndex);
                break;
            }
            if (!fiveStarPlayer.boolData)
            {
                Log.Error("操作错误 视为放弃操作");
                operateInfo.OperateType = FiveStarOperateType.None;
            }
        }