From 09d250ff3df339b247fbae52b0d0c131f6bce340 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期二, 21 五月 2019 11:13:49 +0800
Subject: [PATCH] 6863 【2.0】【开发】灵根激活界面优化

---
 System/Skill/ExpertSkillSelectWin.cs |  126 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 112 insertions(+), 14 deletions(-)

diff --git a/System/Skill/ExpertSkillSelectWin.cs b/System/Skill/ExpertSkillSelectWin.cs
index ac1cdf2..6a3c3b7 100644
--- a/System/Skill/ExpertSkillSelectWin.cs
+++ b/System/Skill/ExpertSkillSelectWin.cs
@@ -21,13 +21,17 @@
         [SerializeField] Text m_SkillName;
         [SerializeField] Image m_ReikiIcon;
         [SerializeField] Text m_ReikiPoint;
+        [SerializeField] Transform m_ContainerReikiIcon;
+        [SerializeField] Image[] m_ReikiIcons;
+        [SerializeField] FunctionUnlockFlyObjectTarget m_FlyTarget;
+        [SerializeField] Image m_SkillIconSelect;
         [SerializeField] ExpertSkillCyclicScroll m_CyclicScroll;
         [SerializeField] LayoutElement m_LayoutElement;
         [SerializeField] Button m_Active;
         [SerializeField] Text m_ActiveLabel;
         [SerializeField] UIEffect m_ActiveEffect;
-        [SerializeField] Button m_Select;
-        [SerializeField] UIEffect m_SelectEffect;
+        //[SerializeField] Button m_Select;
+        //[SerializeField] UIEffect m_SelectEffect;
         [SerializeField] Button m_Close1;
         [SerializeField] Button m_Close2;
 
@@ -61,6 +65,10 @@
 
         List<int> datas = new List<int>();
 
+        FunctionUnlockFlyObject flyObject = null;
+
+        bool flying = false;
+
         TreasureSkillModel model { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
         #region Built-in
         protected override void BindController()
@@ -70,7 +78,7 @@
         protected override void AddListeners()
         {
             //m_Controller.OnRefreshCell += OnRefreshCell;
-            m_Select.AddListener(OnSelect);
+            //m_Select.AddListener(OnSelect);
             m_Close1.AddListener(CloseClick);
             m_Close2.AddListener(CloseClick);
             m_Active.AddListener(OnActiveSkill);
@@ -87,9 +95,18 @@
 
             m_CyclicScroll.enabled = false;
 
+            if (flyObject != null)
+            {
+                GameObject.Destroy(flyObject);
+                flyObject = null;
+            }
+
+            flying = false;
+
             Display();
 
             model.expertActiveRefresh += ExpertActiveRefresh;
+            model.expertSkillRefresh += ExpertSkillRefresh;
         }
 
         protected override void OnAfterOpen()
@@ -103,6 +120,7 @@
             StopAllCoroutines();
 
             model.expertActiveRefresh -= ExpertActiveRefresh;
+            model.expertSkillRefresh -= ExpertSkillRefresh;
         }
 
         protected override void OnAfterClose()
@@ -116,6 +134,7 @@
             DisplayExperts();
             DisplaySelect();
             DisplayDetail();
+            DisplaySelectReiki();
         }
 
         void SetDefaultSelect()
@@ -229,7 +248,7 @@
 
             var used = selectExpertSkill == selectExpert;
 
-            m_SelectEffect.StopImediatly();
+            //m_SelectEffect.StopImediatly();
 
             TreasurePotential expert;
             if (model.TryGetPotential(selectExpert, out expert))
@@ -238,16 +257,16 @@
                 var satisfyActive = model.SatisfyActiveExpert(selectExpert, out error);
                 var activeLevel = 0;
                 model.TryGetExpertActiveLevel(selectExpert, out activeLevel);
-                m_Select.gameObject.SetActive(activeLevel > 0 && !satisfyActive && !used);
+                //m_Select.gameObject.SetActive(activeLevel > 0 && !satisfyActive && !used);
                 m_Active.gameObject.SetActive(satisfyActive || error == 3);
 
-                if (m_Select.gameObject.activeSelf)
-                {
-                    if (selectExpertSkill == 0)
-                    {
-                        m_SelectEffect.Play();
-                    }
-                }
+                //if (m_Select.gameObject.activeSelf)
+                //{
+                //    if (selectExpertSkill == 0)
+                //    {
+                //        m_SelectEffect.Play();
+                //    }
+                //}
 
                 //m_Active.SetColorful(m_ActiveLabel, satisfyActive);
 
@@ -265,6 +284,29 @@
             }
         }
 
+        void DisplaySelectReiki()
+        {
+            var selectExpertSkill = 0;
+            model.TryGetExpertSkill(selectSkillId, out selectExpertSkill);
+
+            m_ContainerReikiIcon.gameObject.SetActive(selectExpertSkill != 0);
+            m_SkillIconSelect.gameObject.SetActive(selectExpertSkill != 0);
+            if (selectExpertSkill != 0)
+            {
+                var skillConfig = SkillConfig.Get(selectExpertSkill);
+
+                m_SkillIconSelect.SetSprite(skillConfig.IconName);
+
+                var property = skillConfig.RequireProperty();
+
+                m_ReikiIcons[0].gameObject.SetActive(property == (int)PropertyType.Mater);
+                m_ReikiIcons[1].gameObject.SetActive(property == (int)PropertyType.Wood);
+                m_ReikiIcons[2].gameObject.SetActive(property == (int)PropertyType.Water);
+                m_ReikiIcons[3].gameObject.SetActive(property == (int)PropertyType.Fire);
+                m_ReikiIcons[4].gameObject.SetActive(property == (int)PropertyType.Earth);
+            }
+        }
+
         void DisplayAnimation()
         {
             m_PositionTween.Play();
@@ -277,6 +319,7 @@
             {
                 var pak = new CA516_tagCMSelectSkillElement();
                 pak.SkillTypeID = (uint)selectExpert;
+                pak.DoType = 1;
                 GameNetSystem.Instance.SendInfo(pak);
             }
             CloseImmediately();
@@ -298,16 +341,29 @@
             }
             var pak = new CA516_tagCMSelectSkillElement();
             pak.SkillTypeID = (uint)selectExpert;
+            pak.DoType = 0;
             GameNetSystem.Instance.SendInfo(pak);
         }
 
         private void OnSelect(int skillId)
         {
-            if (m_CyclicScroll.IsPlaying)
+            if (m_CyclicScroll.IsPlaying || flying)
             {
                 return;
             }
             selectExpert = skillId;
+
+            var level = 0;
+            var selectExpertSkill = 0;
+            if (model.TryGetExpertSkill(selectSkillId, out selectExpertSkill)
+                && selectExpertSkill != selectExpert && model.TryGetExpertActiveLevel(selectExpert, out level)
+                && level > 0)
+            {
+                var pak = new CA516_tagCMSelectSkillElement();
+                pak.SkillTypeID = (uint)selectExpert;
+                pak.DoType = 1;
+                GameNetSystem.Instance.SendInfo(pak);
+            }
         }
 
         private void ExpertActiveRefresh(int id)
@@ -319,7 +375,7 @@
                 {
                     if (level > selectActiveLevel && level > 1)
                     {
-                        m_CyclicScroll.DisplayAnimation(()=> 
+                        m_CyclicScroll.DisplayAnimation(() =>
                         {
                             DisplayDetail(true);
                         });
@@ -327,6 +383,43 @@
                 }
                 DisplayButtonState();
                 DisplayExperts();
+            }
+        }
+
+        private void ExpertSkillRefresh()
+        {
+            var selectExpertSkill = 0;
+            if (model.serverInited && model.TryGetExpertSkill(selectSkillId, out selectExpertSkill)
+                && selectExpertSkill == selectExpert)
+            {
+                if (flyObject != null)
+                {
+                    GameObject.Destroy(flyObject);
+                    flyObject = null;
+                }
+
+                Transform parent = null;
+                for (int i = 0; i < m_SkillExperts.Length; i++)
+                {
+                    if (m_SkillExperts[i].skillId == selectExpert)
+                    {
+                        parent = m_SkillExperts[i].flyContainer;
+                    }
+                }
+
+                m_FlyTarget.IdList = new int[1] { selectExpert };
+                FunctionUnlockFlyObjectTargetCenter.Register(FunctionUnlockType.Skill, new int[] { selectExpert }, m_FlyTarget);
+                var instance = UIUtility.CreateWidget("SkillUnlockFlyObject", "SkillUnlockFlyObject");
+                instance.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
+                flyObject = instance.GetComponent<FunctionUnlockFlyObject>();
+                flyObject.SetContent(FunctionUnlockType.Skill, selectExpert);
+
+                flying = true;
+                flyObject.Begin(() =>
+                {
+                    flying = false;
+                    DisplaySelectReiki();
+                });
             }
         }
 
@@ -347,6 +440,11 @@
 
             public int skillId { get; private set; }
 
+            public Transform flyContainer
+            {
+                get { return m_Icon.transform; }
+            }
+
             TreasureSkillModel model { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
 
             public void Display(int skillId, bool unlock, Action<int> func)

--
Gitblit v1.8.0