Пример #1
0
        void ProcessCmdType(MahjongOpCode opCode, MahjongMachineCmd cmd)
        {
            switch (opCode)
            {
            case MahjongOpCode.SwapPaiGroup:
            {
                MahjongSwapPaiCmd      swapPaiCmd;
                MahjongSwapPaiGroupCmd swapPaiGroupCmd = (MahjongSwapPaiGroupCmd)cmd;

                for (int j = 0; j < 4; j++)
                {
                    swapPaiCmd = (MahjongSwapPaiCmd)CreateCmd(MahjongOpCode.SwapPai);
                    swapPaiGroupCmd.cmdSeats[j] = swapPaiCmd;
                }
            }
            break;

            case MahjongOpCode.FaPai:
            {
                FaPaiCmd faPaiCmd = (FaPaiCmd)cmd;
                faPaiCmd.mjHandSelfPaiFaceValueList.Clear();
                faPaiCmd.selfHuaList.Clear();
                faPaiCmd.selfBuPaiList.Clear();
            }
            break;
            }
        }
Пример #2
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);
        }
Пример #3
0
        void SelectSwapPaiEnd(int[] handPaiIdxs, int[] moPaiIdxs)
        {
            MahjongMachineCmd cmdx = CmdPool.Instance.CreateCmd(MahjongOpCode.HideSwapPaiUI);

            mjOpCmdList.Append(cmdx);

            ShowSwapPaiHintCmd showCmd = (ShowSwapPaiHintCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.ShowSwapPaiHint);

            showCmd.isBlock          = false;
            showCmd.swapPaiDirection = SwapPaiDirection.OPPOSITE;
            mjOpCmdList.Append(showCmd);

            MahjongSwapPaiGroupCmd cmd = (MahjongSwapPaiGroupCmd)CmdPool.Instance.CreateCmd(MahjongOpCode.SwapPaiGroup);

            cmd.SwapHandPaiIdx   = handPaiIdxs;
            cmd.SwapMoPaiIdx     = moPaiIdxs;
            cmd.SwapDirection    = SwapPaiDirection.OPPOSITE;
            cmd.TakeMjFaceValues = new MahjongFaceValue[] { MahjongFaceValue.MJ_TIAO_3, MahjongFaceValue.MJ_WANG_4, MahjongFaceValue.MJ_WANG_9 };
            cmd.delayExecuteTime = 1f;
            showCmd.Append(mjOpCmdList.CreateCmdNode(cmd));
        }
Пример #4
0
        bool ProcessCmdNode(LinkedListNode <MahjongMachineCmd> opCmdNode)
        {
            curtOpCmd = opCmdNode.Value;

            switch (curtOpCmd.opCode)
            {
            case MahjongOpCode.TurnNextPlayer:
            {
                if (CanTurnNextPlayer((TurnNextPlayerOpCmd)curtOpCmd))
                {
                    CmdOp(null, curtOpCmd);
                    curtOpCmd = null;
                }
                else
                {
                    return(false);
                }
            }
            break;

            case MahjongOpCode.ReqSelectSwapPai:
            case MahjongOpCode.ReqSelectDaPai:
            case MahjongOpCode.ReqSelectPCGTHPai:
            case MahjongOpCode.ReqSelectQueMen:
            {
                playerActionOpCmdLists[0].AddLast(opCmdNode);
                curtOpCmd = null;

                if (playerActionOpCmdLists[0].Count == 1)
                {
                    CmdOp(playerActionOpCmdLists[0].First);
                }
            }
            break;

            case MahjongOpCode.MoPai:
            case MahjongOpCode.DaPai:
            case MahjongOpCode.ChaPai:
            case MahjongOpCode.SortPai:
            case MahjongOpCode.BuHuaPai:
            case MahjongOpCode.HuPai:
            case MahjongOpCode.PengChiGangPai:
            case MahjongOpCode.TuiDaoPai:
            {
                MahjongPaiOpCmd cmd = (MahjongPaiOpCmd)curtOpCmd;
                playerActionOpCmdLists[cmd.seatIdx].AddLast(opCmdNode);
                curtOpCmd = null;

                if (playerActionOpCmdLists[cmd.seatIdx].Count == 1)
                {
                    CmdOp(playerActionOpCmdLists[cmd.seatIdx].First);
                }
            }
            break;


            case MahjongOpCode.QiDongDiceMachine:
            {
                QiDongDiceMachineCmd cmd = (QiDongDiceMachineCmd)curtOpCmd;
                playerActionOpCmdLists[cmd.seatIdx].AddLast(opCmdNode);
                curtOpCmd = null;

                if (playerActionOpCmdLists[cmd.seatIdx].Count == 1)
                {
                    CmdOp(playerActionOpCmdLists[cmd.seatIdx].First);
                }
            }
            break;

            case MahjongOpCode.PlayEffectAudio:
            case MahjongOpCode.XiPai:
            case MahjongOpCode.FaPai:
            case MahjongOpCode.ShowScore:
            case MahjongOpCode.ShowSwapPaiHint:
            case MahjongOpCode.HideSwapPaiUI:
            {
                CmdOp(opCmdNode);
                curtOpCmd = null;
            }
            break;

            case MahjongOpCode.SwapPai:
            {
                MahjongSwapPaiCmd cmd = (MahjongSwapPaiCmd)curtOpCmd;
                playerActionOpCmdLists[cmd.fromSeatIdx].AddLast(opCmdNode);
                curtOpCmd = null;

                if (playerActionOpCmdLists[cmd.fromSeatIdx].Count == 1)
                {
                    CmdOp(playerActionOpCmdLists[cmd.fromSeatIdx].First);
                }
            }
            break;

            case MahjongOpCode.QueMen:
            {
                CmdOp(opCmdNode);
                curtOpCmd = null;
            }
            break;


            case MahjongOpCode.SwapPaiGroup:
            {
                MahjongSwapPaiGroupCmd cmd = (MahjongSwapPaiGroupCmd)curtOpCmd;
                curtOpCmd = null;

                for (int i = 0; i < 4; i++)
                {
                    cmd.cmdSeats[i].isBlock     = cmd.isBlock;
                    cmd.cmdSeats[i].swapMjCount = cmd.SwapMjCount;
                    playerActionOpCmdLists[i].AddLast(CreateCmdNode(cmd.cmdSeats[i]));

                    if (playerActionOpCmdLists[i].Count == 1)
                    {
                        CmdOp(playerActionOpCmdLists[i].First);
                    }
                }

                ReleaseCmd(cmd);
                ReleaseCmdNode(opCmdNode);
            }
            break;
            }

            return(true);
        }