Exemplo n.º 1
0
    public        SMsgTeamPropMember_SC[] SMsgTeamPropMembers; // ...wMemberNum个(SMsgPropMember_SC+队员的上下文)

    public static SMsgTeamMemberNum_SC ParsePackage(byte[] dataBuffer, int offset)
    {
        SMsgTeamMemberNum_SC sMsgTeamMemberNum = new SMsgTeamMemberNum_SC();

        sMsgTeamMemberNum.wMemberNum = BitConverter.ToUInt16(dataBuffer, offset);

        sMsgTeamMemberNum.SMsgTeamPropMembers = new SMsgTeamPropMember_SC[sMsgTeamMemberNum.wMemberNum];

        int memberBufferLength = 0;

        //sMsgTeamMemberNum.SMsgTeamPropMembers.ApplyAllItem(p =>
        //    {
        //        p = p.ParsePackage(dataBuffer, offset + 2 + memberBufferLength);

        //        //加上上次队员数据长度
        //        memberBufferLength += p.wContextLen;
        //    });
        for (int i = 0; i < sMsgTeamMemberNum.wMemberNum; i++)
        {
            //TraceUtil.Log("memberBufferLength====>"+memberBufferLength);
            sMsgTeamMemberNum.SMsgTeamPropMembers[i] = SMsgTeamPropMember_SC.ParsePackage(dataBuffer, offset + 2 + memberBufferLength);

            memberBufferLength += sMsgTeamMemberNum.SMsgTeamPropMembers[i].wContextLen + 1 + 2;     //+1+2是是否英雄和上下文数据的长度
        }

        return(sMsgTeamMemberNum);
    }
Exemplo n.º 2
0
    public SMsgTeamMemberNum_SC TeamMemberNum_SC; //队员信息

    public static SMsgTeamProp_SC ParsePackage(byte[] dataBuffer, int offset)
    {
        SMsgTeamProp_SC sMsgTeamProp = new SMsgTeamProp_SC();

        sMsgTeamProp.nIsHero     = dataBuffer[offset];
        sMsgTeamProp.wContextLen = BitConverter.ToUInt16(dataBuffer, offset + 1);

        byte[] teamContextBuffer = dataBuffer.Skip(offset + 1 + 2).Take(sMsgTeamProp.wContextLen).ToArray();
        sMsgTeamProp.TeamContext = STeamContext.ParsePackage(teamContextBuffer);

        sMsgTeamProp.TeamMemberNum_SC = SMsgTeamMemberNum_SC.ParsePackage(dataBuffer, offset + 1 + 2 + sMsgTeamProp.wContextLen);

        return(sMsgTeamProp);
    }