| | |
| | | [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
|
| | |
| | | model.treasureSkillRefresh += TreasureSkillRefresh;
|
| | | model.selectRefresh += SelectRefresh;
|
| | | model.skillLevelUpRefresh += SkillLevelUpRefresh;
|
| | | packModel.refreshItemCountEvent += RefreshItemCountEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | 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()
|
| | |
| | | {
|
| | | DisplaySkills();
|
| | | DisplaySkillDetial();
|
| | | DisplayPotentials();
|
| | | }
|
| | |
|
| | | private void DisplaySkills()
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | 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)
|
| | |
| | | {
|
| | | 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();
|
| | | }
|
| | | }
|
| | | }
|