コード例 #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:
                    LevelUp = new LevelUp();
                    LevelUp.ParseFrom(obj.Value);
                    break;

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

                case 3:
                    var vegetableUnlock = new VegetableUnlock();
                    vegetableUnlock.ParseFrom(obj.Value);
                    VegetableUnlockList.Add(vegetableUnlock);
                    break;

                case 4:
                    var skillUnlock = new SkillUnlock();
                    skillUnlock.ParseFrom(obj.Value);
                    SkillUnlockList.Add(skillUnlock);
                    break;

                case 5:
                    var majorLevelUnlock = new MajorLevelUnlockInfo();
                    majorLevelUnlock.ParseFrom(obj.Value);
                    MajorLevelUnlockList.Add(majorLevelUnlock);
                    break;

                case 6:
                    var subLevelUnlock = new SubLevelUnlockInfo();
                    subLevelUnlock.ParseFrom(obj.Value);
                    SubLevelUnlockList.Add(subLevelUnlock);
                    break;

                case 7:
                    EquipAppear = new EquipAppear();
                    EquipAppear.ParseFrom(obj.Value);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #2
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;
                }
            }
        }