Пример #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:
                    CurrentVegetable = new UserVegetable();
                    CurrentVegetable.ParseFrom(obj.Value);
                    break;

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

                default:
                    break;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 加速蔬菜升级成功。
 /// </summary>
 public SpeedUpVegetableUpgradeOk
 (
     UserVegetable currentVegetable
 ) : this()
 {
     CurrentVegetable = currentVegetable;
 }
Пример #3
0
 /// <summary>
 /// 升级蔬菜成功。
 /// </summary>
 public UpgradeVegetableOk
 (
     UserVegetable currentVegetable,
     User currentUser
 ) : this()
 {
     CurrentVegetable = currentVegetable;
     CurrentUser      = currentUser;
 }
Пример #4
0
        public void SetAndRefresh(UserVegetable userVegetable)
        {
            _userVegetable = userVegetable;

            Destroy(VegetableArtContent);

            Shadow.SetActive(true);
            VegetableArtContent =
                CandyBAPool.Dequeue(new CandyInfo(Candy.CandyType.Normal,
                                                  VegetableUtil.VegetableCodeToPrefabIndex(_userVegetable.VegetableCode)));
            VegetableArtContent.transform.ResetTransform(VegetableArtContentContainer);

            LblLevel.text = string.Format("{0}级", _userVegetable.CurrentLevel);

            var vegetableConfig = ConfigManager.GetConfig(ConfigManager.ConfigType.VegetableConfig) as VegetableConfig;

            if (vegetableConfig != null)
            {
                var vegetable = vegetableConfig.VegetableList.Find(x => x.VegetableCode == _userVegetable.VegetableCode);
                if (vegetable != null)
                {
                    LblDescription.text = "能量 " + vegetable.LevelEnergyList[_userVegetable.CurrentLevel - 1];
                }
            }

            var matureInfo = CommonData.MyVegetableMatureInfoList.Find(x => x.Code == _userVegetable.VegetableCode);

            BtnUpgrade.SetActive(_userVegetable.CurrentLevel < _userVegetable.CurrentUpgradeLimit && matureInfo == null);
            if (matureInfo == null)
            {
                _dateTimeMature = null;
                BtnPrompt.SetActive(false);
            }
            else
            {
                _dateTimeMature = DateTime.Now +
                                  TimeSpan.FromSeconds(Mathf.Max(0, matureInfo.MatureTime - Time.realtimeSinceStartup));
                BtnPrompt.SetActive(true);
            }
        }
Пример #5
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;
                }
            }
        }