少年修仙传客户端代码仓库
client_Hale
2019-03-01 b04fc4bee9584af8ea0457aafe4cf1b6c19b36d2
System/Skill/TreasureSkillWin.cs
@@ -28,12 +28,20 @@
        [SerializeField] Button m_GetWay;
        [SerializeField] Button m_LevelUp;
        [SerializeField] RedpointBehaviour m_LevelRedpoint;
        [SerializeField] UIEffect m_LevelUpEffect;
        [SerializeField] Transform m_ContainerMax;
        [SerializeField] TreasurePotentialBehaviour[] m_TreasurePotentials;
        List<Clock> clocks = new List<Clock>();
        TreasureSkillModel model
        {
            get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); }
        }
        PackModel packModel
        {
            get { return ModelCenter.Instance.GetModel<PackModel>(); }
        }
        #region Built-in
@@ -56,6 +64,7 @@
            model.treasureSkillRefresh += TreasureSkillRefresh;
            model.selectRefresh += SelectRefresh;
            model.skillLevelUpRefresh += SkillLevelUpRefresh;
            packModel.refreshItemCountEvent += RefreshItemCountEvent;
        }
        protected override void OnAfterOpen()
@@ -67,7 +76,18 @@
            model.treasureSkillRefresh -= TreasureSkillRefresh;
            model.selectRefresh -= SelectRefresh;
            model.skillLevelUpRefresh -= SkillLevelUpRefresh;
            packModel.refreshItemCountEvent -= RefreshItemCountEvent;
            model.SetAlreadyRemind();
            for (int i = 0; i < m_TreasurePotentials.Length; i++)
            {
                m_TreasurePotentials[i].StopUnlock();
            }
            foreach (var clock in clocks)
            {
                clock.Stop();
            }
            clocks.Clear();
        }
        protected override void OnAfterClose()
@@ -108,6 +128,7 @@
        {
            DisplaySkills();
            DisplaySkillDetial();
            DisplayPotentials();
        }
        private void DisplaySkills()
@@ -156,19 +177,28 @@
                        WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.Daily_EmperorRelic);
                    });
                }
            }
        }
                for (int i = 0; i < m_TreasurePotentials.Length; i++)
                {
                    if (i < skill.potentials.Count)
                    {
                        m_TreasurePotentials[i].gameObject.SetActive(true);
                        m_TreasurePotentials[i].Display(skill.potentials[i].id);
                    }
                    else
                    {
                        m_TreasurePotentials[i].gameObject.SetActive(false);
                    }
                }
        private void DisplayPotentials()
        {
            for (int i = 0; i < m_TreasurePotentials.Length; i++)
            {
                DisplayPotential(i);
            }
        }
        private void DisplayPotential(int index)
        {
            TreasureSkill skill;
            if (!model.TryGetSkill(model.selectSkill, out skill))
            {
                return;
            }
            if (index < m_TreasurePotentials.Length)
            {
                m_TreasurePotentials[index].gameObject.SetActive(index < skill.potentials.Count);
                m_TreasurePotentials[index].Display(skill.potentials[index].id);
            }
        }
@@ -204,8 +234,18 @@
        private void SelectRefresh()
        {
            for (int i = 0; i < m_TreasurePotentials.Length; i++)
            {
                m_TreasurePotentials[i].StopUnlock();
            }
            foreach (var clock in clocks)
            {
                clock.Stop();
            }
            clocks.Clear();
            m_Controller.m_Scorller.RefreshActiveCellViews();
            DisplaySkillDetial();
            DisplayPotentials();
        }
        private void SkillLevelUpRefresh(int id)
@@ -214,6 +254,51 @@
            {
                m_Controller.m_Scorller.RefreshActiveCellViews();
                DisplaySkillDetial();
                m_LevelUpEffect.Play();
                TreasureSkill skill;
                if (model.TryGetSkill(model.selectSkill, out skill))
                {
                    for (int i = 0; i < skill.potentials.Count; i++)
                    {
                        var index = i;
                        if (index < m_TreasurePotentials.Length &&
                            skill.potentials[index].openLevel == skill.level)
                        {
                            m_TreasurePotentials[index].StartUnlock();
                            Clock clock = null;
                            clock = Clock.Create(1, () =>
                              {
                                  DisplayPotential(index);
                                  if (clock != null && clocks.Contains(clock))
                                  {
                                      clocks.Remove(clock);
                                  }
                              });
                            clocks.Add(clock);
                        }
                    }
                }
            }
            else
            {
                var skillId = 0;
                if (model.ContainsSkill(id, out skillId))
                {
                    if (skillId == model.selectSkill)
                    {
                        DisplayPotentials();
                    }
                }
            }
        }
        private void RefreshItemCountEvent(PackType packType, int arg2, int itemId)
        {
            if (packType == PackType.Item && model.skillLevelUpItems.Contains(itemId))
            {
                DisplaySkillDetial();
            }
        }
    }