コード例 #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);
        }
コード例 #2
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;
            }
        }