Ejemplo n.º 1
0
        MahjongMachineCmd NewCmd(MahjongOpCode opCode)
        {
            MahjongMachineCmd cmd = null;

            switch (opCode)
            {
            case MahjongOpCode.PlayEffectAudio: cmd = new PlayEffectAudioOpCmd(); break;

            case MahjongOpCode.XiPai: cmd = new XiPaiCmd(); break;

            case MahjongOpCode.FaPai: cmd = new FaPaiCmd(); break;

            case MahjongOpCode.TurnNextPlayer: cmd = new TurnNextPlayerOpCmd(); break;

            case MahjongOpCode.ReqSelectSwapPai: cmd = new ReqSelectSwapPaiOpCmd(); break;

            case MahjongOpCode.ReqSelectQueMen: cmd = new ReqSelectQueMenOpCmd(); break;

            case MahjongOpCode.ReqSelectDaPai: cmd = new ReqSelectDaPaiOpCmd(); break;

            case MahjongOpCode.ReqSelectPCGTHPai: cmd = new ReqSelectPCGTHPaiOpCmd(); break;

            case MahjongOpCode.ShowSwapPaiHint: cmd = new ShowSwapPaiHintCmd(); break;

            case MahjongOpCode.HideSwapPaiUI: cmd = new MahjongMachineCmd(); cmd.opCode = MahjongOpCode.HideSwapPaiUI; break;

            case MahjongOpCode.QiDongDiceMachine: cmd = new QiDongDiceMachineCmd(); break;

            case MahjongOpCode.SwapPaiGroup: cmd = new MahjongSwapPaiGroupCmd(); break;

            case MahjongOpCode.SwapPai: cmd = new MahjongSwapPaiCmd(); break;

            case MahjongOpCode.QueMen: cmd = new QueMenCmd(); break;

            case MahjongOpCode.MoPai: cmd = new MahjongMoPaiOpCmd(); break;

            case MahjongOpCode.DaPai: cmd = new MahjongDaPaiOpCmd(); break;

            case MahjongOpCode.ChaPai: cmd = new MahjongChaPaiOpCmd(); break;

            case MahjongOpCode.SortPai: cmd = new MahjongPaiOpCmd(); cmd.opCode = MahjongOpCode.SortPai; break;

            case MahjongOpCode.BuHuaPai: cmd = new MahjongBuHuaPaiOpCmd(); break;

            case MahjongOpCode.HuPai: cmd = new MahjongHuPaiOpCmd(); break;

            case MahjongOpCode.PengChiGangPai: cmd = new MahjongPcgPaiOpCmd(); break;

            case MahjongOpCode.TuiDaoPai: cmd = new MahjongTuiDaoPaiOpCmd(); break;

            case MahjongOpCode.ShowScore: cmd = new ShowScoreCmd(); break;
            }

            return(cmd);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 选择打牌结束回调
        /// </summary>
        /// <param name="selectPaiHandPaiIdx"></param>
        /// <param name="paiType"></param>
        void SelectDaPaiEnd(int selectPaiHandPaiIdx, HandPaiType paiType)
        {
            MahjongDaPaiOpCmd cmd = (MahjongDaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.DaPai);

            cmd.seatIdx     = 0;
            cmd.handStyle   = PlayerType.FEMALE;
            cmd.paiIdx      = selectPaiHandPaiIdx;
            cmd.paiType     = paiType;
            cmd.mjFaceValue = GetHandPaiMjFaceValue(0, selectPaiHandPaiIdx);
            mjOpCmdList.Append(cmd);

            MahjongPaiOpCmd cmd2 = (MahjongPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.SortPai);

            cmd2.seatIdx   = 0;
            cmd2.handStyle = PlayerType.FEMALE;
            cmd2.canSelectPaiAfterCmdEnd = true;
            mjOpCmdList.Append(cmd2);

            //test
            ReqSelectDaPaiOpCmd cmdx = (ReqSelectDaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ReqSelectDaPai);

            mjOpCmdList.Append(cmdx);
        }
Ejemplo n.º 3
0
        void Action()
        {
            string playerName = uiCanvasTransform.Find("TestUI").Find("PlayerDropdown").Find("Label").GetComponent <Text>().text;
            string actionName = uiCanvasTransform.Find("TestUI").Find("ActionDropdown").Find("Label").GetComponent <Text>().text;
            int    seatIdx    = 1;

            switch (playerName)
            {
            case "玩家0": seatIdx = 0; break;

            case "玩家1": seatIdx = 1; break;

            case "玩家2": seatIdx = 2; break;

            case "玩家3": seatIdx = 3; break;
            }

            ActionCombineNum actionCombineNum = GetRandomHandDaPaiActionNumForNextDeskMjPos(seatIdx);
            MahjongFaceValue fv = (MahjongFaceValue)Random.Range(0, 42);

            MahjongFaceValue[] fvs = new MahjongFaceValue[] { MahjongFaceValue.MJ_TIAO_4, MahjongFaceValue.MJ_TIAO_6, MahjongFaceValue.MJ_TIAO_4, MahjongFaceValue.MJ_TIAO_6, MahjongFaceValue.MJ_TONG_6 };

            switch (actionName)
            {
            case "洗牌":
            {
                XiPaiCmd cmd = (XiPaiCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.XiPai);
                cmd.isBlock = true;
                mjOpCmdList.Append(cmd);

                FaPaiCmd cmd2 = (FaPaiCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.FaPai);

                MahjongFaceValue[] values = new MahjongFaceValue[]
                {
                    MahjongFaceValue.MJ_TONG_1, MahjongFaceValue.MJ_TONG_1, MahjongFaceValue.MJ_TONG_1,
                    MahjongFaceValue.MJ_TONG_2, MahjongFaceValue.MJ_TONG_3, MahjongFaceValue.MJ_TONG_4,
                    MahjongFaceValue.MJ_TONG_5, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6,
                    MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_7,
                    MahjongFaceValue.MJ_TONG_8, MahjongFaceValue.MJ_FENG_DONG,
                };

                // cmd2.delayExecuteTime = 2f;
                cmd2.startPaiIdx = 15;
                cmd2.mjHandSelfPaiFaceValueList = CreateSelfHandPaiFaceValueList(values);
                //cmd.Append(mjOpCmdList.CreateCmdNode(cmd2));

                mjOpCmdList.Append(cmd2);
            }
            break;

            case "发牌":
            {
                FaPaiCmd cmd = (FaPaiCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.FaPai);

                MahjongFaceValue[] values = new MahjongFaceValue[]
                {
                    MahjongFaceValue.MJ_TONG_1, MahjongFaceValue.MJ_TONG_1, MahjongFaceValue.MJ_TONG_1,
                    MahjongFaceValue.MJ_TONG_2, MahjongFaceValue.MJ_TONG_3, MahjongFaceValue.MJ_TONG_4,
                    MahjongFaceValue.MJ_TONG_5, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6,
                    MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_7,
                    MahjongFaceValue.MJ_TONG_8, MahjongFaceValue.MJ_FENG_DONG,
                };

                cmd.startPaiIdx = 15;
                cmd.mjHandSelfPaiFaceValueList = CreateSelfHandPaiFaceValueList(values);

                mjOpCmdList.Append(cmd);
            }
            break;


            case "头像流光On":
                uiTouXiang.LiuGuangTurnTo(seatIdx);
                uiTouXiang.ShowHuaSeFlag(seatIdx, MahjongHuaSe.TIAO);
                break;

            case "头像流光Off":
                uiTouXiang.LiuGuangStop(seatIdx);
                break;

            case "设置头像分值":
                uiTouXiang.SetScore(seatIdx, 3600);
                break;

            case "启动动作":
            {
                QiDongDiceMachine(seatIdx);
            }
            break;

            case "启动骰子机":
            {
                diceMachine.StartRun();
            }
            break;

            case "选择打牌":
            {
                ReqSelectDaPaiOpCmd cmdx = (ReqSelectDaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ReqSelectDaPai);
                mjOpCmdList.Append(cmdx);
            }
            break;

            case "cmd":
            {
                QiDongDiceMachineCmd qiDongCmd = (QiDongDiceMachineCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.QiDongDiceMachine);
                qiDongCmd.seatIdx = 0;
                mjOpCmdList.Append(qiDongCmd);

                MahjongDaPaiOpCmd cmd = (MahjongDaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.DaPai);
                cmd.seatIdx     = 1;
                cmd.handStyle   = PlayerType.FEMALE;
                cmd.paiIdx      = 3;
                cmd.paiType     = HandPaiType.HandPai;
                cmd.mjFaceValue = MahjongFaceValue.MJ_FENG_DONG;
                mjOpCmdList.Append(cmd);

                MahjongMoPaiOpCmd cmdm = (MahjongMoPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.MoPai);
                cmdm.seatIdx     = 1;
                cmdm.handStyle   = PlayerType.FEMALE;
                cmdm.mjFaceValue = MahjongFaceValue.MJ_TIAO_1;
                mjOpCmdList.Append(cmdm);

                MahjongChaPaiOpCmd cmdc = (MahjongChaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ChaPai);
                cmdc.seatIdx         = 1;
                cmdc.adjustDirection = HandPaiAdjustDirection.GoToHandLeftDir;
                cmdc.dstHandPaiIdx   = 3;
                cmdc.orgPaiIdx       = 0;
                cmdc.orgPaiType      = HandPaiType.MoPai;
                cmdc.handStyle       = PlayerType.FEMALE;
                mjOpCmdList.Append(cmdc);

                TurnNextPlayerOpCmd turnCmd = (TurnNextPlayerOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.TurnNextPlayer);
                turnCmd.waitActionEndPlayerSeatIdxs = new int[] { 1 };
                turnCmd.turnToPlayerSeatIdx         = 2;
                turnCmd.time = 10;
                mjOpCmdList.Append(turnCmd);

                cmd             = (MahjongDaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.DaPai);
                cmd.seatIdx     = 2;
                cmd.handStyle   = PlayerType.FEMALE;
                cmd.paiIdx      = 0;
                cmd.paiType     = HandPaiType.HandPai;
                cmd.mjFaceValue = MahjongFaceValue.MJ_TIAO_6;
                mjOpCmdList.Append(cmd);

                cmdm             = (MahjongMoPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.MoPai);
                cmdm.seatIdx     = 2;
                cmdm.handStyle   = PlayerType.FEMALE;
                cmdm.mjFaceValue = MahjongFaceValue.MJ_TIAO_4;
                mjOpCmdList.Append(cmdm);

                cmdc                 = (MahjongChaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ChaPai);
                cmdc.seatIdx         = 2;
                cmdc.adjustDirection = HandPaiAdjustDirection.GoToHandLeftDir;
                cmdc.dstHandPaiIdx   = 3;
                cmdc.orgPaiIdx       = 0;
                cmdc.orgPaiType      = HandPaiType.MoPai;
                cmdc.handStyle       = PlayerType.FEMALE;
                mjOpCmdList.Append(cmdc);


                MahjongHuPaiOpCmd cmd2 = (MahjongHuPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.HuPai);
                cmd2.seatIdx         = 1;
                cmd2.handStyle       = PlayerType.FEMALE;
                cmd2.huTargetSeatIdx = 2;
                cmd2.huTargetMjIdx   = new Vector3Int(0, 0, 0);
                cmd2.huPaiFaceValue  = MahjongFaceValue.MJ_TONG_9;
                mjOpCmdList.Append(cmd2);


                ////turnCmd = new TurnNextPlayerOpCmd();
                ////turnCmd.waitActionEndPlayerSeatIdxs = new int[] { 2 };
                ////turnCmd.turnToPlayerSeatIdx = 3;
                ////turnCmd.time = 10;
                ////mjOpCmdList.Append(turnCmd);


                ////cmdm = new MahjongMoPaiOpCmd();
                ////cmdm.seatIdx = 3;
                ////cmdm.handStyle = PlayerType.FEMALE;
                ////cmdm.mjFaceValue = MahjongFaceValue.MJ_TIAO_4;
                ////mjOpCmdList.Append(cmdm);


                ////cmd = new MahjongDaPaiOpCmd();
                ////cmd.seatIdx = 3;
                ////cmd.handStyle = PlayerType.FEMALE;
                ////cmd.paiIdx = 0;
                ////cmd.paiType = HandPaiType.HandPai;
                ////cmd.mjFaceValue = MahjongFaceValue.MJ_WANG_7;
                ////mjOpCmdList.Append(cmd);

                ////cmdc = new MahjongChaPaiOpCmd();
                ////cmdc.seatIdx = 3;
                ////cmdc.adjustDirection = HandPaiAdjustDirection.GoToHandLeftDir;
                ////cmdc.dstHandPaiIdx = 3;
                ////cmdc.orgPaiIdx = 0;
                ////cmdc.orgPaiType = HandPaiType.MoPai;
                ////cmdc.handStyle = PlayerType.FEMALE;
                ////mjOpCmdList.Append(cmdc);


                ////turnCmd = new TurnNextPlayerOpCmd();

                ////turnCmd.waitActionEndPlayerSeatIdxs = new int[] { 3 };
                ////turnCmd.turnToPlayerSeatIdx = 0;
                ////turnCmd.time = 10;
                ////mjOpCmdList.Append(turnCmd);



                ////cmd = new MahjongDaPaiOpCmd();
                ////cmd.seatIdx = 0;
                ////cmd.handStyle = PlayerType.FEMALE;
                ////cmd.paiIdx = 0;
                ////cmd.paiType = HandPaiType.HandPai;
                ////cmd.mjFaceValue = MahjongFaceValue.MJ_WANG_8;
                ////mjOpCmdList.Append(cmd);
            }

            break;

            case "cmd2":
            {
                ReqSelectQueMenOpCmd cmdx = (ReqSelectQueMenOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ReqSelectQueMen);
                cmdx.defaultQueMenHuaSe = MahjongHuaSe.WANG;
                mjOpCmdList.Append(cmdx);

                //MahjongSwapPaiGroupCmd cmd = new MahjongSwapPaiGroupCmd();
                //cmd.SwapDirection = SwapPaiDirection.OPPOSITE;
                //cmd.SwapHandPaiIdx = new int[] { 1, 2, 3 };
                //cmd.TakeMjFaceValues = new MahjongFaceValue[] { MahjongFaceValue.MJ_TIAO_3, MahjongFaceValue.MJ_WANG_4, MahjongFaceValue.MJ_WANG_9 };
                //mjOpCmdList.Append(cmd);
            }
            break;

            case "cmd3":
            {
                ReqSelectQueMenOpCmd cmdx = (ReqSelectQueMenOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ReqSelectQueMen);
                cmdx.defaultQueMenHuaSe = MahjongHuaSe.WANG;
                mjOpCmdList.Append(cmdx);

                MahjongHuPaiOpCmd cmd = (MahjongHuPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.HuPai);
                cmd.seatIdx          = 1;
                cmd.handStyle        = PlayerType.FEMALE;
                cmd.huTargetSeatIdx  = 2;
                cmd.huTargetMjIdx    = new Vector3Int(0, 0, 0);
                cmd.huPaiFaceValue   = MahjongFaceValue.MJ_TONG_9;
                cmd.delayExecuteTime = 2f;
                cmdx.Append(mjOpCmdList.CreateCmdNode(cmd));

                ShowScoreCmd scoreCmd = (ShowScoreCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ShowScore);
                scoreCmd.seatScores       = new int[] { -200, -300, -1550, 6000 };
                scoreCmd.delayExecuteTime = 0.5f;
                cmd.Append(mjOpCmdList.CreateCmdNode(scoreCmd));
            }
            break;


            case "请求碰吃杠听胡":
            {
                ReqSelectPCGTHPaiOpCmd cmd = (ReqSelectPCGTHPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ReqSelectPCGTHPai);
                cmd.pcgthBtnTypes = new PengChiGangTingHuType[]
                {
                    PengChiGangTingHuType.HU, PengChiGangTingHuType.PENG,
                    PengChiGangTingHuType.CHI, PengChiGangTingHuType.TING,
                    PengChiGangTingHuType.GANG, PengChiGangTingHuType.GUO
                };

                cmd.chiPaiMjValueList = new List <MahjongFaceValue[]>();

                MahjongFaceValue[] values = new MahjongFaceValue[]
                {
                    MahjongFaceValue.MJ_TONG_3,
                    MahjongFaceValue.MJ_TONG_4,
                    MahjongFaceValue.MJ_TONG_5,
                };

                MahjongFaceValue[] values2 = new MahjongFaceValue[]
                {
                    MahjongFaceValue.MJ_TONG_5,
                    MahjongFaceValue.MJ_TONG_6,
                    MahjongFaceValue.MJ_TONG_7,
                };

                cmd.chiPaiMjValueList.Add(values);
                cmd.chiPaiMjValueList.Add(values2);


                cmd.tingPaiInHandPaiIdxs = new int[] { 2, 3, 6, 8 };

                HuPaiTipsInfo[] tingPaiTipsInfos = new HuPaiTipsInfo[4];

                tingPaiTipsInfos[0].faceValue   = MahjongFaceValue.MJ_TIAO_8;
                tingPaiTipsInfos[0].fanAmount   = 5;
                tingPaiTipsInfos[0].zhangAmount = 6;

                tingPaiTipsInfos[1].faceValue = MahjongFaceValue.MJ_TIAO_2;
                tingPaiTipsInfos[2].faceValue = MahjongFaceValue.MJ_TIAO_3;
                tingPaiTipsInfos[3].faceValue = MahjongFaceValue.MJ_WANG_5;


                HuPaiTipsInfo[] tingPaiTipsInfos2 = new HuPaiTipsInfo[3];

                tingPaiTipsInfos2[0].faceValue   = MahjongFaceValue.MJ_TIAO_8;
                tingPaiTipsInfos2[0].fanAmount   = 5;
                tingPaiTipsInfos2[0].zhangAmount = 6;

                tingPaiTipsInfos2[1].faceValue = MahjongFaceValue.MJ_TIAO_2;
                tingPaiTipsInfos2[2].faceValue = MahjongFaceValue.MJ_WANG_5;


                cmd.tingPaiInfosInHandPai = new List <HuPaiTipsInfo[]>
                {
                    tingPaiTipsInfos,
                    tingPaiTipsInfos2,
                    tingPaiTipsInfos,
                    tingPaiTipsInfos2
                };


                mjOpCmdList.Append(cmd);
            }
            break;

            case "选择交换牌命令":
            {
                ReqSelectSwapPaiOpCmd cmd = (ReqSelectSwapPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ReqSelectSwapPai);
                mjOpCmdList.Append(cmd);
            }
            break;

            case "显示分数":
            {
                uiScore.Show(new int[] { 2000, 110, 560, 1255 });
            }
            break;


            case "缺一门":
            {
                if (seatIdx == 0)
                {
                    uiSelectQueMen.Show(MahjongHuaSe.TIAO);
                }
                else
                {
                    uiSelectQueMen.PlaySelectQueMenForOtherSeat(seatIdx, MahjongHuaSe.TONG);
                }
            }
            break;



            case "交换牌":
                SwapPai(seatIdx, 1, 3, new int[] { 3, 3, 3 }, new MahjongFaceValue[] { MahjongFaceValue.MJ_FENG_NAN, MahjongFaceValue.MJ_TIAO_4, MahjongFaceValue.MJ_TONG_3 }, new int[] { 3, 7, 9 });
                break;

            case "显示胡牌按键":
                //uiPcghtBtnMgr.Show(new PengChiGangTingHuType[] {
                //    PengChiGangTingHuType.HU, PengChiGangTingHuType.PENG,
                //    PengChiGangTingHuType.CHI, PengChiGangTingHuType.TING,
                //    PengChiGangTingHuType.GANG , PengChiGangTingHuType.GUO});


                uiPcghtBtnMgr.Show(new PengChiGangTingHuType[] {
                    PengChiGangTingHuType.HU, PengChiGangTingHuType.GANG, PengChiGangTingHuType.GUO
                });

                break;

            case "显示碰牌按键":
                // uiPcgtBtn.Show();
                break;

            case "摸牌":

                MoPai(seatIdx, MahjongFaceValue.MJ_TIAO_4);

                // uiPcgtBtn.Show();
                // uiHuBtn.Show();

                //ReqSelectDaPaiOpCmd cmdxx = new ReqSelectDaPaiOpCmd();
                //cmdxx.huPaiInHandPaiIdxs = new int[] { 2, 3, 6, 8 };

                //HuPaiTipsInfo[] huPaiTipsInfos = new HuPaiTipsInfo[4];

                //huPaiTipsInfos[0].faceValue = MahjongFaceValue.MJ_TIAO_8;
                //huPaiTipsInfos[0].fanAmount = 5;
                //huPaiTipsInfos[0].zhangAmount = 6;

                //huPaiTipsInfos[1].faceValue = MahjongFaceValue.MJ_TIAO_2;
                //huPaiTipsInfos[2].faceValue = MahjongFaceValue.MJ_TIAO_3;
                //huPaiTipsInfos[3].faceValue = MahjongFaceValue.MJ_WANG_5;


                //HuPaiTipsInfo[] huPaiTipsInfos2 = new HuPaiTipsInfo[3];

                //huPaiTipsInfos2[0].faceValue = MahjongFaceValue.MJ_TIAO_8;
                //huPaiTipsInfos2[0].fanAmount = 5;
                //huPaiTipsInfos2[0].zhangAmount = 6;

                //huPaiTipsInfos2[1].faceValue = MahjongFaceValue.MJ_TIAO_2;
                //huPaiTipsInfos2[2].faceValue = MahjongFaceValue.MJ_WANG_5;


                //cmdxx.huPaiInfosInHandPai = new List<HuPaiTipsInfo[]>
                //{
                //    huPaiTipsInfos,
                //    huPaiTipsInfos2,
                //    huPaiTipsInfos,
                //    huPaiTipsInfos2

                //};
                //mjOpCmdList.Append(cmdxx);

                //MoPai(seatIdx, MahjongFaceValue.MJ_TIAO_5);
                //uiSwapPaiingTips.SetHintSwapType(SwapPaiDirection.ANTICLOCKWISE);
                //uiSwapPaiingTips.Show();

                //swapPaiHintArrowEffect.ShowAnitClockWiseArrow();

                // HuPaiTipsInfo[] huPaiTipsInfos = new HuPaiTipsInfo[4];

                // huPaiTipsInfos[0].faceValue = MahjongFaceValue.MJ_TIAO_8;
                // huPaiTipsInfos[0].fanAmount = 5;
                // huPaiTipsInfos[0].zhangAmount = 6;

                //huPaiTipsInfos[1].faceValue = MahjongFaceValue.MJ_TIAO_2;
                // huPaiTipsInfos[2].faceValue = MahjongFaceValue.MJ_TIAO_3;
                // huPaiTipsInfos[3].faceValue = MahjongFaceValue.MJ_WANG_5;

                // uiHuPaiTips.SetHuPaiInfo(huPaiTipsInfos);
                // uiHuPaiTips.Show();

                break;

            case "打牌":
                idx %= fvs.Length;
                DaPai(seatIdx, PlayerType.FEMALE, 0, 0, fvs[idx], false, actionCombineNum);
                idx++;
                break;

            case "高亮桌面麻将":
                OnDeskMjHighLight(MahjongFaceValue.MJ_TONG_6);
                break;

            case "关闭高亮桌面麻将":
                OffDeskMjHighLight(MahjongFaceValue.MJ_TONG_6);
                break;

            case "插牌":
                ChaPai(seatIdx, PlayerType.FEMALE, 0, 2, HandPaiType.MoPai, HandPaiAdjustDirection.GoToHandLeftDir);
                break;

            case "整理牌":
                SortPai(seatIdx);
                break;

            case "自摸":
                HuPai(seatIdx, PlayerType.FEMALE, -1, new Vector3Int(0, mn++, 0), fv, ActionCombineNum.HuPai);
                break;

            case "胡牌":
                HuPai(seatIdx, PlayerType.FEMALE, 0, new Vector3Int(0, mn++, 1), fv, ActionCombineNum.HuPai);
                break;

            case "补花":

                MahjongBuHuaPaiOpCmd buHuaCmd = (MahjongBuHuaPaiOpCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.BuHuaPai);
                buHuaCmd.seatIdx           = 0;
                buHuaCmd.handStyle         = PlayerType.FEMALE;
                buHuaCmd.buHuaPaiFaceValue = MahjongFaceValue.MJ_HUA_DONG;
                mjOpCmdList.Append(buHuaCmd);

                //  BuHua(seatIdx, PlayerType.FEMALE, fv, ActionCombineNum.HuPai);
                break;

            case "推倒牌":
                List <MahjongFaceValue> handpaiList = new List <MahjongFaceValue>
                {
                    MahjongFaceValue.MJ_FENG_DONG, MahjongFaceValue.MJ_TIAO_9, MahjongFaceValue.MJ_TIAO_8, MahjongFaceValue.MJ_TIAO_7,
                    MahjongFaceValue.MJ_TIAO_6, MahjongFaceValue.MJ_TIAO_5, MahjongFaceValue.MJ_TIAO_4, MahjongFaceValue.MJ_TIAO_3, MahjongFaceValue.MJ_TIAO_2, MahjongFaceValue.MJ_TIAO_1
                };

                TuiDaoPai(seatIdx, PlayerType.FEMALE, handpaiList, ActionCombineNum.TuiDaoPai);
                break;

            case "碰九条":
                PengChiGangPai(
                    seatIdx, PlayerType.FEMALE, true, 0.05f,
                    new MahjongFaceValue[] { MahjongFaceValue.MJ_TIAO_9, MahjongFaceValue.MJ_TIAO_9, MahjongFaceValue.MJ_TIAO_9, MahjongFaceValue.MJ_TIAO_9 },
                    PengChiGangPaiType.PENG, 0, new Vector3Int(0, mn++, 0), EffectFengRainEtcType.EFFECT_RAIN, ActionCombineNum.PengPai);
                break;

            case "碰六筒":
                PengChiGangPai(
                    seatIdx, PlayerType.FEMALE, true, 0.05f,
                    new MahjongFaceValue[] { MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6 },
                    PengChiGangPaiType.PENG, 0, new Vector3Int(0, mn++, 0), EffectFengRainEtcType.EFFECT_FENG, ActionCombineNum.PengPai);
                break;

            case "碰后杠六筒":
                PengChiGangPai(
                    seatIdx, PlayerType.FEMALE, true, 0.05f,
                    new MahjongFaceValue[] { MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6, MahjongFaceValue.MJ_TONG_6 },
                    PengChiGangPaiType.BU_GANG, -1, new Vector3Int(0, 0, 0), EffectFengRainEtcType.EFFECT_NONE, ActionCombineNum.PengPai);
                break
                ;

            case "Dapai0":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai5);
                break;

            case "DaPai1":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai1_TaiHand2);
                break;

            case "DaPai2":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai1_MovPai1_TaiHand1);
                break;

            case "DaPai3":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai1_MovPai1_TaiHand2);
                break;

            case "DaPai4":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai1_ZhengPai_TaiHand);
                break;

            case "DaPai5":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai1_MovPai1_ZhengPai_TaiHand);
                break;

            case "DaPai8":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai2_MovPai_TaiHand1);
                break;

            case "DaPai9":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai2_MovPai_TaiHand2);
                break;

            case "DaPai10":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.DaPai3_TaiHand);

                break;

            case "DaPai11":
                DaPai(seatIdx, PlayerType.FEMALE, 0, HandPaiType.HandPai, fv, false, ActionCombineNum.FirstTaiHand2_DaPai4_TaiHand);
                break;

            case "HuPai":
                HuPai(seatIdx, PlayerType.FEMALE, 0, new Vector3Int(0, mn++, 0), fv, ActionCombineNum.HuPai);
                break;
            }
        }
Ejemplo n.º 4
0
        void CmdOp(LinkedListNode <MahjongMachineCmd> opCmdNode, MahjongMachineCmd mjOpCmd = null)
        {
            if (opCmdNode == null && mjOpCmd == null)
            {
                return;
            }

            MahjongMachineCmd opCmd = mjOpCmd;

            if (opCmdNode != null)
            {
                opCmd = opCmdNode.Value;

                if (opCmd.isBlock)
                {
                    blockCmdCount++;
                }
            }

            if (opCmd.delayOpCmdLinkedList != null && opCmd.delayOpCmdLinkedList.Count > 0)
            {
                for (LinkedListNode <MahjongMachineCmd> node = opCmd.delayOpCmdLinkedList.First; node != null; node = opCmd.delayOpCmdLinkedList.First)
                {
                    opCmd.delayOpCmdLinkedList.RemoveFirst();
                    AppendCmdToDelayCmdList(node);
                }

                opCmd.delayOpCmdLinkedList.Clear();
            }

            switch (opCmd.opCode)
            {
            case MahjongOpCode.PlayEffectAudio:
            {
                PlayEffectAudioOpCmd cmd = (PlayEffectAudioOpCmd)opCmd;
                mjMachine.PlayEffectAudio(cmd.audioIdx, cmd.numIdx);
                RemoveCommonActionOpCmd(opCmdNode);
            }
            break;

            case MahjongOpCode.XiPai:
            {
                XiPaiCmd cmd = (XiPaiCmd)opCmd;
                mjMachine.XiPai(cmd.dealerSeatIdx, cmd.fengWei, opCmdNode);
            }
            break;


            case MahjongOpCode.FaPai:
            {
                FaPaiCmd cmd = (FaPaiCmd)opCmd;
                mjMachine.FaPai(cmd.startPaiIdx, cmd.mjHandSelfPaiFaceValueList, cmd.selfHuaList, cmd.selfBuPaiList, opCmdNode);
            }
            break;

            case MahjongOpCode.TurnNextPlayer:
            {
                TurnNextPlayerOpCmd cmd = (TurnNextPlayerOpCmd)opCmd;

                FengWei fw = mjMachine.GetSeatFengWei(cmd.turnToPlayerSeatIdx);
                mjMachine.diceMachine.OnFengWei(fw);
                mjMachine.diceMachine.SetLimitTime(cmd.time);
                mjMachine.diceMachine.StartTime();
                RemoveCommonActionOpCmd(opCmdNode);
            }
            break;

            case MahjongOpCode.ShowScore:
            {
                ShowScoreCmd cmd = (ShowScoreCmd)opCmd;
                mjMachine.uiScore.Show(cmd.seatScores);
                RemoveCommonActionOpCmd(opCmdNode);
            }
            break;

            case MahjongOpCode.HideSwapPaiUI:
            {
                mjMachine.uiSelectSwapHandPai.CompleteSwapPaiSelected();
                RemoveCommonActionOpCmd(opCmdNode);
            }
            break;

            case MahjongOpCode.QueMen:
            {
                QueMenCmd cmd = (QueMenCmd)opCmd;
                mjMachine.uiSelectQueMen.AppendPlayQueMenForSeatToList(cmd.seatIdx, cmd.queMenHuaSe);
                RemoveCommonActionOpCmd(opCmdNode);
            }
            break;


            case MahjongOpCode.ReqSelectSwapPai:
            {
                mjMachine.SelectSwapPai(opCmdNode);
            }
            break;

            case MahjongOpCode.ReqSelectQueMen:
            {
                ReqSelectQueMenOpCmd cmd = (ReqSelectQueMenOpCmd)opCmd;
                mjMachine.SelectQueMen(cmd.defaultQueMenHuaSe, opCmdNode);
            }
            break;

            case MahjongOpCode.ReqSelectDaPai:
            {
                ReqSelectDaPaiOpCmd cmd = (ReqSelectDaPaiOpCmd)opCmd;

                mjMachine.SelectDaPai(
                    cmd.huPaiInHandPaiIdxs, cmd.huPaiInfosInHandPai,
                    cmd.huPaiInMoPaiIdxs, cmd.huPaiInfosInMoPai, opCmdNode);
            }
            break;

            case MahjongOpCode.ReqSelectPCGTHPai:
            {
                ReqSelectPCGTHPaiOpCmd cmd = (ReqSelectPCGTHPaiOpCmd)opCmd;

                mjMachine.SelectPCGTHPai(cmd.pcgthBtnTypes,
                                         cmd.chiPaiMjValueList, cmd.tingPaiInHandPaiIdxs,
                                         cmd.tingPaiInfosInHandPai, cmd.tingPaiInMoPaiIdxs, cmd.tingPaiInfosInMoPai, opCmdNode);
            }
            break;

            case MahjongOpCode.QiDongDiceMachine:
            {
                QiDongDiceMachineCmd cmd = (QiDongDiceMachineCmd)opCmd;
                mjMachine.QiDongDiceMachine(cmd.seatIdx, cmd.dice1Point, cmd.dice2Point, opCmdNode);
            }
            break;

            case MahjongOpCode.ShowSwapPaiHint:
            {
                ShowSwapPaiHintCmd cmd = (ShowSwapPaiHintCmd)opCmd;
                mjMachine.ShowSwapPaiHint(cmd.swapPaiDirection);
                RemoveCommonActionOpCmd(opCmdNode);
            }
            break;

            case MahjongOpCode.SwapPai:
            {
                MahjongSwapPaiCmd cmd = (MahjongSwapPaiCmd)opCmd;
                mjMachine.SwapPai(
                    cmd.fromSeatIdx, cmd.toSeatIdx, cmd.swapMjCount,
                    cmd.toSeatHandPaiIdx,
                    cmd.mjFaceValues, cmd.fromSeatHandPaiIdx,
                    cmd.mjMoPaiFaceValues, cmd.fromSeatMoPaiIdx,
                    cmd.isShowBack, cmd.swapDir, opCmdNode);
            }
            break;



            case MahjongOpCode.MoPai:
            {
                MahjongMoPaiOpCmd cmd = (MahjongMoPaiOpCmd)opCmd;
                mjMachine.MoPai(cmd.seatIdx, cmd.mjFaceValue, opCmdNode);
            }
            break;

            case MahjongOpCode.DaPai:
            {
                MahjongDaPaiOpCmd cmd = (MahjongDaPaiOpCmd)opCmd;
                ActionCombineNum  actionCombineNum = mjMachine.GetRandomHandDaPaiActionNumForNextDeskMjPos(cmd.seatIdx);
                mjMachine.DaPai(cmd.seatIdx, cmd.handStyle, cmd.paiIdx, cmd.paiType, cmd.mjFaceValue, cmd.isJiaoTing, actionCombineNum, opCmdNode);
            }
            break;

            case MahjongOpCode.ChaPai:
            {
                MahjongChaPaiOpCmd cmd = (MahjongChaPaiOpCmd)opCmd;
                mjMachine.ChaPai(cmd.seatIdx, cmd.handStyle, cmd.orgPaiIdx, cmd.dstHandPaiIdx, cmd.orgPaiType, cmd.adjustDirection, opCmdNode);
            }
            break;

            case MahjongOpCode.SortPai:
            {
                MahjongPaiOpCmd cmd = (MahjongPaiOpCmd)opCmd;
                mjMachine.SortPai(cmd.seatIdx, SortPaiType.LEFT, opCmdNode);
            }
            break;

            case MahjongOpCode.BuHuaPai:
            {
                MahjongBuHuaPaiOpCmd cmd = (MahjongBuHuaPaiOpCmd)opCmd;
                mjMachine.BuHua(cmd.seatIdx, cmd.handStyle, cmd.buHuaPaiFaceValue, ActionCombineNum.HuPai, opCmdNode);
            }
            break;

            case MahjongOpCode.HuPai:
            {
                MahjongHuPaiOpCmd cmd = (MahjongHuPaiOpCmd)opCmd;
                mjMachine.HuPai(cmd.seatIdx, cmd.handStyle, cmd.huTargetSeatIdx, cmd.huTargetMjIdx, cmd.huPaiFaceValue, ActionCombineNum.HuPai, opCmdNode);
            }
            break;

            case MahjongOpCode.PengChiGangPai:
            {
                MahjongPcgPaiOpCmd cmd = (MahjongPcgPaiOpCmd)opCmd;
                mjMachine.PengChiGangPai(
                    cmd.seatIdx, cmd.handStyle, cmd.isMoveHand, cmd.moveHandDist,
                    cmd.faceValues, cmd.pcgType, cmd.pcgTargetSeatIdx, cmd.pcgTargetMjIdx, cmd.fengRainEffectEtcType,
                    ActionCombineNum.PengPai, opCmdNode);
            }
            break;

            case MahjongOpCode.TuiDaoPai:
            {
                MahjongTuiDaoPaiOpCmd cmd = (MahjongTuiDaoPaiOpCmd)opCmd;
                mjMachine.TuiDaoPai(cmd.seatIdx, cmd.handStyle, cmd.handPaiValueList, ActionCombineNum.TuiDaoPai, opCmdNode);
            }
            break;
            }
        }