Esempio n. 1
0
    private void OnSubOperateNotify(byte[] tmpBuf, int size)
    {
        var mm             = new MahjongMotion();
        var pOperateNotify = NetUtil.BytesToStruct <CMD_S_OperateNotify>(tmpBuf);

        MyDebug.Log("还原用户:" + pOperateNotify.wResumeUser);
        if (pOperateNotify.cbActionMask != (int)WIK.WIK_NULL)
        {
            MyDebug.Log(MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateNotify.cbActionCard) +
                        "操作命令llllllllllllllllllllllllllllllllllllllllllllllllllll:" + pOperateNotify.cbActionMask);
            mm.cardID = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateNotify.cbActionCard);
            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_CHI_HU)) > 0)
            {
                //胡
                mm.isChiHuMotion = true;
            }

            if ((pOperateNotify.cbActionMask & (byte)WIK.WIK_GANG) > 0)
            {
                mm.isGangMotion = true;
                //杠
            }

            if ((pOperateNotify.cbActionMask & (byte)WIK.WIK_PENG) > 0)
            {
                mm.isPengMotion = true;
                //碰
            }

            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_LEFT)) > 0)
            {
                //吃
                MyDebug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1Chi Type:WIK_LEFT");
                mm.isLeftMotion = true;
                mm.chiCount++;
                mm.type = pOperateNotify.cbActionMask;
            }

            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_CENTER)) > 0)
            {
                MyDebug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1Chi Type:WIK_CENTER");
                mm.isCenterMotion = true;
                mm.chiCount++;
                mm.type = pOperateNotify.cbActionMask;
            }

            if (((pOperateNotify.cbActionMask & (byte)WIK.WIK_RIGHT)) > 0)
            {
                MyDebug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1Chi Type:WIK_RIGHT");
                mm.isRightMotion = true;
                mm.chiCount++;
                mm.type = pOperateNotify.cbActionMask;
            }
        }

        SetClientResponse(APIS.RETURN_INFO_RESPONSE, NetUtil.ObjToJson(mm));
    }
Esempio n. 2
0
    private void OnSubOutCard(byte[] tmpBuf, int size)
    {
        var pOutCard = NetUtil.BytesToStruct <CMD_S_OutCard>(tmpBuf);
        var ocv      = new OutCardVO
        {
            cardID  = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOutCard.cbOutCardData),
            chairId = pOutCard.wOutCardUser
        };

        SetClientResponse(APIS.CHUPAI_RESPONSE, NetUtil.ObjToJson(ocv));
    }
Esempio n. 3
0
    private void OnSubSendCard(byte[] tmpBuf, int size)
    {
        MyDebug.Log("OnSubSendCard");
        var pSpendCard = NetUtil.BytesToStruct <CMD_S_SendCard>(tmpBuf);           //发送扑克?

        if (pSpendCard.wCurrentUser == GlobalDataScript.loginResponseData.chairID) //自己摸牌
        {
            var cvo = new CardVO
            {
                cardPoint = MaJiangHelper.MaJiangCardChange((MJ_PAI)pSpendCard.cbCardData)
            };
            SetClientResponse(APIS.PICKCARD_RESPONSE, NetUtil.ObjToJson(cvo));
            var mahjongMotion = new MahjongMotion();
            MyDebug.Log(pSpendCard.cbActionMask);
            MyDebug.Log((byte)WIK.WIK_GANG);
            MyDebug.Log((byte)WIK.WIK_CHI_HU);
            if (pSpendCard.cbActionMask != (int)WIK.WIK_NULL)
            {
                mahjongMotion.cardID = cvo.cardPoint;
                if ((pSpendCard.cbActionMask & (byte)WIK.WIK_GANG) > 0)
                {
                    mahjongMotion.isGangMotion = true;
                }

                if ((pSpendCard.cbActionMask & (Byte)WIK.WIK_CHI_HU) > 0)
                {
                    mahjongMotion.isChiHuMotion = true;
                }

                SetClientResponse(APIS.RETURN_INFO_RESPONSE, NetUtil.ObjToJson(mahjongMotion));
            }
        }
        else //他人摸牌
        {
            var cvo = new CardVO
            {
                avatarIndex = pSpendCard.wCurrentUser
            };
            MyDebug.Log("当前摸牌用户用户:" + cvo.avatarIndex);
            SetClientResponse(APIS.OTHER_PICKCARD_RESPONSE_NOTICE, NetUtil.ObjToJson(cvo));
        }
    }
Esempio n. 4
0
    private void OnSubOperateResult(byte[] tmpBuf, int size)
    {
        var pOperateResult = NetUtil.BytesToStruct <CMD_S_OperateResult>(tmpBuf);
        var wOperateUser   = pOperateResult.wOperateUser;
        var cbOperateCard  = pOperateResult.cbOperateCard;

        if (pOperateResult.cbOperateCode == (byte)WIK.WIK_PENG)
        {
            var opgbv = new OtherPengGangBackVO
            {
                chairId     = pOperateResult.wOperateUser,
                provideUser = pOperateResult.wProvideUser,
                cardPoint   = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateResult.cbOperateCard)
            };
            SetClientResponse(APIS.PENGPAI_RESPONSE, NetUtil.ObjToJson(opgbv));
        }

        if (pOperateResult.cbOperateCode == (byte)WIK.WIK_LEFT ||
            pOperateResult.cbOperateCode == (byte)WIK.WIK_CENTER ||
            pOperateResult.cbOperateCode == (byte)WIK.WIK_RIGHT)
        {
            var ocbv = new OtherChiBackVO
            {
                chairId   = pOperateResult.wOperateUser,
                type      = pOperateResult.cbOperateCode,
                cardPoint = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateResult.cbOperateCard)
            };
            SetClientResponse(APIS.CHIPAI_RESPONSE, NetUtil.ObjToJson(ocbv));
        }

        if (pOperateResult.cbOperateCode == (byte)WIK.WIK_GANG &&
            pOperateResult.wOperateUser == GlobalDataScript.loginResponseData.chairID)
        {
            var gbv = new GangBackVO
            {
                wProvideUser = pOperateResult.wProvideUser
            };
            if (pOperateResult.wOperateUser == pOperateResult.wProvideUser)
            {
                gbv.type = 1;
            }
            else
            {
                gbv.type = 0;
            }

            gbv.cardPoint = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateResult.cbOperateCard);
            SetClientResponse(APIS.GANGPAI_RESPONSE, NetUtil.ObjToJson(gbv));
        }

        if (pOperateResult.cbOperateCode == (byte)WIK.WIK_GANG &&
            pOperateResult.wOperateUser != GlobalDataScript.loginResponseData.chairID)
        {
            var gnv = new GangNoticeVO();
            if (pOperateResult.wOperateUser == pOperateResult.wProvideUser)
            {
                gnv.type = 1;
            }
            else
            {
                gnv.type = 0;
            }

            gnv.cardPoint = MaJiangHelper.MaJiangCardChange((MJ_PAI)pOperateResult.cbOperateCard);
            gnv.chairId   = pOperateResult.wOperateUser;
            SetClientResponse(APIS.OTHER_GANGPAI_NOICE, NetUtil.ObjToJson(gnv));
        }

        if (pOperateResult.cbOperateCode == (byte)WIK.WIK_CHI_HU)
        {
            var gnv = new HupaiResponseVo();
            MyDebug.Log("操作用户座位ID:" + pOperateResult.wOperateUser);
            MyDebug.Log("供应用户座位ID:" + pOperateResult.wProvideUser);
            SetClientResponse(APIS.HUPAI_RESPONSE, NetUtil.ObjToJson(gnv));
        }
    }