示例#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));
    }
示例#2
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));
        }
    }