少年修仙传客户端代码仓库
client_linchunjie
2018-11-02 3ea77bcede501037ec86c8afd28268ee16a35437
System/Pet/PetAttributeMethods.cs
@@ -85,8 +85,10 @@
        PetInfoConfig petInfoConfig;
        bool isAutoTrain = false;
        List<GameObject> Skillimage = new List<GameObject>();
        private bool IsZidong = false;
        private void OnEnable()
        {
            IsZidong = false;
            timePlay = 0;
            Skillimage.Clear();
            Skillimage.Add(Skillimage1);
@@ -494,16 +496,13 @@
            {
                if (petmodel._DicPetBack.ContainsKey(petInfoConfig.ID))
                {
                    petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, 1);
                    petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, 1,0);
                }
            }
            else
            {
                ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(petmodel.petUpgradeToolId);
            }
            // petTrainBtn.RemoveAllListeners();
        }
        private void ClickPetAutoTrainBtn()
@@ -511,7 +510,20 @@
            int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, petmodel.petUpgradeToolId);
            if (haveCnt < costNum)
            {
                ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(petmodel.petUpgradeToolId);
                if (!isAutoTrain)
                {
                    WindowCenter.Instance.Open<AutoTrainTipsPWin>();
                }
                else
                {
                    AutoTrainTipsPWin.IsFairy = false;
                    isAutoTrain = false;
                    IsZidong = false;
                    petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                    StopCoroutine("FairyJadeD");
                }
                return;
            }
            isAutoTrain = !isAutoTrain;
@@ -548,7 +560,7 @@
                        if (petmodel.Wait)
                        {
                            petmodel.Wait = false;
                            petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, NeedNum);
                            petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, NeedNum,0);
                        }
                    }
                    else
@@ -556,7 +568,7 @@
                        if (petmodel.Wait)
                        {
                            petmodel.Wait = false;
                            petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, haveCnt);
                            petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, haveCnt,0);
                        }
                    }
@@ -565,9 +577,12 @@
            }
            else
            {
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                isAutoTrain = false;
                if (!IsZidong)
                {
                    petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                    isAutoTrain = false;
                }
            }
        }
        #endregion
@@ -644,8 +659,6 @@
                    ridingModel.property = PropertyTip.Pet;
                    ridingModel.RidingId = PetID;
                    WindowCenter.Instance.Open<TargetPetAttrWin>();
                    //  WindowCenter.Instance.Get<TargetPetAttrWin>().PropertyMountAndPet(PropertyTip.Pet, PetID);
                });
                if (petmodel._DicPetBack[PetID].PetClass >= PetModel.MaxRank)//满阶
                {
@@ -697,6 +710,53 @@
            FragmentUnlockTip.SetActive(false);
            FullAttTip.SetActive(true);
        }
        public void FairyJadeDomesticate()//仙玉驯养
        {
            int NumberLv = AutoTrainTipsPWin._Lvnumber;//等级所需的等级
            if (NumberLv > petmodel._DicPetBack[typePetID].PetClass && !WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>() && AutoTrainTipsPWin.IsFairy)
            {
                isAutoTrain = true;
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_7");
                IsZidong = true;
                StartCoroutine("FairyJadeD");
            }
        }
        IEnumerator FairyJadeD()//仙玉驯养
        {
            int number = AutoTrainTipsPWin.DomesticateNumber;//所需的颗数
            int NumberLv = AutoTrainTipsPWin._Lvnumber;//等级所需的等级
            while (NumberLv > petmodel._DicPetBack[typePetID].PetClass)
            {
                if (WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>())
                {
                    isAutoTrain = false;
                    IsZidong =false;
                    petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                    StopCoroutine("FairyJadeD");
                    yield break;
                }
                if (petmodel.Wait)
                {
                    petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_7");
                    int exp = PetClassCostConfig.GetPetIdAndRank(typePetID, petmodel._DicPetBack[typePetID].PetClass).NeedExpTotal;
                    int NeedNum = ridingModel.PetAndHorseNeedDanNum(exp);
                    petmodel.SendPetTrainQuest(petmodel._DicPetBack[typePetID].ItemPlace, NeedNum, 1);//向服务端发包坐骑经验单
                    petmodel.Wait = false;
                }
                yield return null;
            }
            if (isAutoTrain)
            {
                AutoTrainTipsPWin.IsFairy = false;
                isAutoTrain = false;
                IsZidong = false;
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                StopCoroutine("FairyJadeD");
                yield break;
            }
            yield break;
        }
    }
}