示例#1
0
        public void ParseFrom(byte[] buffer, int offset, int size)
        {
            if (buffer == null)
            {
                return;
            }
            ProtoBufferReader reader = new ProtoBufferReader(buffer, offset, size);

            foreach (ProtoBufferObject obj in reader.ProtoBufferObjs)
            {
                switch (obj.FieldNumber)
                {
                case 1:
                    CurrentUser = new User();
                    CurrentUser.ParseFrom(obj.Value);
                    break;

                case 2:
                    NewCharacter = new UserCharacter();
                    NewCharacter.ParseFrom(obj.Value);
                    break;

                default:
                    break;
                }
            }
        }
示例#2
0
 /// <summary>
 /// 购买角色成功。
 /// </summary>
 public BuyCharacterOk
 (
     User currentUser,
     UserCharacter newCharacter
 ) : this()
 {
     CurrentUser  = currentUser;
     NewCharacter = newCharacter;
 }
示例#3
0
        public void ParseFrom(byte[] buffer, int offset, int size)
        {
            if (buffer == null)
            {
                return;
            }
            ProtoBufferReader reader = new ProtoBufferReader(buffer, offset, size);

            foreach (ProtoBufferObject obj in reader.ProtoBufferObjs)
            {
                switch (obj.FieldNumber)
                {
                case 1:
                    MyUserInfo = new User();
                    MyUserInfo.ParseFrom(obj.Value);
                    break;

                case 2:
                    var mySkill = new UserSkill();
                    mySkill.ParseFrom(obj.Value);
                    MySkillList.Add(mySkill);
                    break;

                case 3:
                    var myVegetable = new UserVegetable();
                    myVegetable.ParseFrom(obj.Value);
                    MyVegetableList.Add(myVegetable);
                    break;

                case 4:
                    var myCharacter = new UserCharacter();
                    myCharacter.ParseFrom(obj.Value);
                    MyCharacterList.Add(myCharacter);
                    break;

                case 5:
                    var myEquip = new UserEquip();
                    myEquip.ParseFrom(obj.Value);
                    MyEquipList.Add(myEquip);
                    break;

                case 20:
                    var challengeUnlockInfo = new MajorLevelUnlockInfo();
                    challengeUnlockInfo.ParseFrom(obj.Value);
                    ChallengeUnlockInfoList.Add(challengeUnlockInfo);
                    break;

                case 30:
                    ConfigHash = new ConfigHash();
                    ConfigHash.ParseFrom(obj.Value);
                    break;

                case 40:
                    FirstTimeGuide = obj.Value;
                    break;

                case 50:
                    var snsFriendUnlockInfo = new SNSFriendUnlockInfo();
                    snsFriendUnlockInfo.ParseFrom(obj.Value);
                    SnsFriendUnlockInfoList.Add(snsFriendUnlockInfo);
                    break;

                case 60:
                    IsFirstCharge = obj.Value;
                    break;

                default:
                    break;
                }
            }
        }