From 7fac13da114c3990383fa4b76a46fd82cdf0bf6f Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期四, 01 十一月 2018 22:31:00 +0800
Subject: [PATCH] 4539 子 【优化】【1.1.0】灵宠新增仙玉自动培养 / 【前端】【1.1.0】灵宠新增仙玉自动培养

---
 System/Pet/PetAttributeMethods.cs |   84 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 72 insertions(+), 12 deletions(-)

diff --git a/System/Pet/PetAttributeMethods.cs b/System/Pet/PetAttributeMethods.cs
index 6484513..a6523e6 100644
--- a/System/Pet/PetAttributeMethods.cs
+++ b/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;
+        }
     }
 }
 

--
Gitblit v1.8.0