少年修仙传客户端代码仓库
client_Hale
2018-09-18 bc49768eaf9757e20bd264dc6183b2497780ee08
System/Treasure/TreasureSoulWin.cs
@@ -26,7 +26,6 @@
        [SerializeField] UIEffect m_SoulEffect;
        [SerializeField] Button m_Active;
        [SerializeField] Text m_ActiveText;
        [SerializeField] Button m_GotoRealm;
        [SerializeField] List<TreasureSoulPattern> m_TreasureSouls;
@@ -35,9 +34,6 @@
        [SerializeField] RectTransform m_ContainerPreview;
        [SerializeField] Text m_PreviewTitle;
        [SerializeField] List<PropertyBehaviour> m_PreviewPropretys;
        [SerializeField] RectTransform m_ContainerCondition;
        [SerializeField] ScrollerController m_ConditonControl;
        TreasureSoulModel m_Model;
        TreasureSoulModel model
@@ -58,9 +54,9 @@
            }
        }
        AchievementModel achievementModel
        TreasureModel treasureModel
        {
            get { return ModelCenter.Instance.GetModel<AchievementModel>(); }
            get { return ModelCenter.Instance.GetModel<TreasureModel>(); }
        }
@@ -76,10 +72,8 @@
        protected override void AddListeners()
        {
            m_Active.onClick.AddListener(Active);
            m_GotoRealm.onClick.AddListener(GotoRealm);
            m_CloseBtn.onClick.AddListener(CloseClick);
            m_ScollerControl.OnRefreshCell += OnRefreshCell;
            m_ConditonControl.OnRefreshCell += OnRefreshConditionCell;
        }
        protected override void OnPreOpen()
@@ -87,7 +81,6 @@
            model.treasureSelectSoulChangeEvent += TreasureSelectSoulChangeEvent;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
            model.treasureSoulEvent += TreasureSoulEvent;
            achievementModel.achievementCompletedEvent += AchievementCompletedEvent;
            m_TreasureSoulBtn.state = TitleBtnState.Click;
            Display();
        }
@@ -115,7 +108,6 @@
            model.treasureSelectSoulChangeEvent -= TreasureSelectSoulChangeEvent;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent;
            model.treasureSoulEvent -= TreasureSoulEvent;
            achievementModel.achievementCompletedEvent -= AchievementCompletedEvent;
            for (int i = 0; i < m_TreasureSouls.Count; i++)
            {
                m_TreasureSouls[i].Dispose();
@@ -131,15 +123,6 @@
            }
        }
        #endregion
        private void AchievementCompletedEvent(int _id)
        {
            List<int> list;
            if (model.TryGetAchievements(model.selectSoul, out list) && list.Contains(_id))
            {
                DisplaySelect();
            }
        }
        private void Display()
        {
@@ -228,19 +211,16 @@
        private void Active()
        {
            model.ActiveTreasureSoul(model.selectSoul);
        }
        private void GotoRealm()
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.RealmFunc1);
            var config = Config.Instance.Get<TreasurePrivilegeConfig>(model.selectSoul);
            treasureModel.selectedTreasure = config.treasureId;
            treasureModel.currentCategory = TreasureCategory.Human;
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.TreasureCollectSoul);
        }
        private void DisplaySelect()
        {
            TreasureSpecialData special;
            model.TryGetTreasureSoul(model.selectSoul, out special);
            m_ContainerCondition.gameObject.SetActive(false);
            if (special != null)
            {
                var config = Config.Instance.Get<TreasurePrivilegeConfig>((int)special.type);
@@ -256,27 +236,8 @@
                    m_SelectSoulImg.material = special.active ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial();
                    m_SelectSoulImg.SetNativeSize();
                    if (special.active)
                    {
                        m_Active.gameObject.SetActive(false);
                        m_GotoRealm.gameObject.SetActive(false);
                    }
                    else
                    {
                        if (!model.IsCompleteLockAchievement(model.selectSoul))
                        {
                            m_Active.gameObject.SetActive(false);
                            m_GotoRealm.gameObject.SetActive(false);
                        }
                        else
                        {
                            m_Active.gameObject.SetActive(true);
                            m_GotoRealm.gameObject.SetActive(false);
                            m_Active.SetInteractable(m_ActiveText, model.IsCompleteAllAchievement(model.selectSoul));
                            m_ContainerCondition.gameObject.SetActive(true);
                            DisplayCondition();
                        }
                    }
                    m_Active.gameObject.SetActive(!special.active);
                    m_ContainerPreview.gameObject.SetActive(!special.active);
                    m_SoulEffect.StopImediatly();
                    if (!special.active)
@@ -458,33 +419,6 @@
                    }
                    break;
            }
        }
        private void DisplayCondition()
        {
            m_ContainerCondition.gameObject.SetActive(true);
            List<int> list;
            model.TryGetAchievements(model.selectSoul, out list);
            m_ConditonControl.Refresh();
            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    var config = Config.Instance.Get<SuccessConfig>(list[i]);
                    if (config != null && config.Type == 1)
                    {
                        continue;
                    }
                    m_ConditonControl.AddCell(ScrollerDataType.Header, list[i]);
                }
            }
            m_ConditonControl.Restart();
        }
        private void OnRefreshConditionCell(ScrollerDataType type, CellView cell)
        {
            var _cell = cell as TreasureSoulAchievementCell;
            _cell.Display(cell.index);
        }
        int Compare(int x, int y)