少年修仙传客户端代码仓库
client_linchunjie
2019-05-16 68013ce961d2c7e8ffc024771b411e658f113882
6803 【前端】【2.0】坐骑、灵宠开启自动激活
1个文件已修改
30 ■■■■■ 已修改文件
System/Pet/PetModel.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Pet/PetModel.cs
@@ -60,6 +60,7 @@
        public int curPetId { get; set; }
        public int petUpgradeToolId { get; set; }
        public int autoActivePetId { get; private set; }
        public bool hasSendAutoActive { get; private set; }
        public event Action PlayerLoginOkData;
        private Dictionary<int, int> DicDefaultPet = new Dictionary<int, int>();
@@ -153,6 +154,7 @@
        {
            Wait = true;
            isServerPrepare = false;
            hasSendAutoActive = false;
            _TagPetItem.Clear();
            _DicPetBack.Clear();
            PetNow = 0;
@@ -237,6 +239,11 @@
                PetActivateRedPoint();
                GetCultivateRedPoint();
                var config = PetInfoConfig.Get(autoActivePetId);
                if (config != null && id == config.UnLockNeedItemID)
                {
                    TryAutoActivePet();
                }
            }
        }
@@ -248,25 +255,24 @@
                PetActivateRedPoint();
                GetCultivateRedPoint();
                if (isServerPrepare && FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Pet))
                {
                    Clock.AlarmAfter(0.5f, () =>
                    {
                        TryAutoActivePet();
                    });
                }
                TryAutoActivePet();
            }
        }
        private void TryAutoActivePet()
        {
            var petConfig = PetInfoConfig.Get(autoActivePetId);
            if (petConfig != null)
            if (isServerPrepare && FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Pet)
                && !_DicPetBack.ContainsKey(autoActivePetId) && !hasSendAutoActive)
            {
                var itemCount = playerPack.GetItemCountByID(PackType.Item, petConfig.UnLockNeedItemID);
                if (itemCount >= petConfig.UnLockNeedItemCnt)
                var petConfig = PetInfoConfig.Get(autoActivePetId);
                if (petConfig != null)
                {
                    SendBreakPetLockQuest(autoActivePetId);
                    var itemCount = playerPack.GetItemCountByID(PackType.Item, petConfig.UnLockNeedItemID);
                    if (itemCount >= petConfig.UnLockNeedItemCnt)
                    {
                        hasSendAutoActive = true;
                        SendBreakPetLockQuest(autoActivePetId);
                    }
                }
            }
        }