예제 #1
0
        public int fromBytes(byte[] data, int offset, int count)
        {
            int pos     = offset;
            int mycount = 0;

            while (mycount < count)
            {
                int fieldnumber = -1;
                int wt          = -1;
                ProtoUtil.GetTag(data, ref pos, ref fieldnumber, ref wt, ref mycount);
                switch (fieldnumber)
                {
                case 1:
                    this.roleId = ProtoUtil.IntMemberFromBytes(data, wt, ref pos, ref mycount);
                    break;

                case 2:
                    this.magicCode = ProtoUtil.IntMemberFromBytes(data, wt, ref pos, ref mycount);
                    break;

                case 3:
                    ProtoUtil.ListMemberFromBytes <SpriteHitedInnerData>(this.enemys, data, wt, ref pos, ref mycount);
                    break;

                default:
                    throw new ArgumentException("error!!!");
                }
            }
            return(pos);
        }