少年修仙传客户端代码仓库
client_linchunjie
2018-09-25 78bfe524ea4776c47f6314e56e97f39970b00fce
System/Dungeon/TrialExchangeWin.cs
@@ -82,6 +82,7 @@
            model.SelectEquipClassEvent += SelectEquipClassEvent;
            packModel.RefreshItemCountAct += RefreshItemCountAct;
            Display();
            JumpToRedpoint();
        }
        protected override void OnAfterOpen()
@@ -170,10 +171,18 @@
        private void RefreshItemCountAct(PackType packtype, int arg2, int itemId)
        {
            if (packtype == PackType.rptItem && model.trialTokens.Contains(itemId))
            var config = Config.Instance.Get<ItemConfig>(itemId);
            if (config == null)
            {
                m_Controller.m_Scorller.RefreshActiveCellViews();
                DisplayTokens();
                return;
            }
            if (packtype == PackType.rptItem)
            {
                if (model.trialTokens.Contains(itemId) || config.EquipPlace > 0)
                {
                    m_Controller.m_Scorller.RefreshActiveCellViews();
                    DisplayTokens();
                }
            }
            else if (packtype == PackType.rptEquip)
            {
@@ -215,6 +224,62 @@
            DisplayTokens();
            bool _up = m_SelectClassBehaviour.gameObject.activeSelf;
            m_SelectClassUp.transform.localEulerAngles = Vector3.zero.SetZ(_up ? 0 : 180);
            JumpToRedpoint();
        }
        private void JumpToRedpoint()
        {
            if (model.selectEquipClass == 1)
            {
                var trialClasses = model.GetTotalClass();
                var index = 0;
                for (int i = 0; i < trialClasses.Count; i++)
                {
                    var line = 0;
                    index += 1;
                    if (JumpToRedpoint(trialClasses[i], out line))
                    {
                        m_Controller.JumpIndex(index + line);
                        return;
                    }
                    else
                    {
                        List<TrialExchangeConfig> list;
                        if (model.TryGetTrialExchanges(trialClasses[i], out list))
                        {
                            index += Mathf.CeilToInt((float)list.Count / 3);
                        }
                    }
                }
            }
            else
            {
                var line = 0;
                JumpToRedpoint(model.selectEquipClass, out line);
                m_Controller.JumpIndex(line);
            }
        }
        private bool JumpToRedpoint(int _class, out int line)
        {
            var itemId = 0;
            line = 0;
            if (model.IsAnySatisfyExchangeBetterEquip(_class, out itemId))
            {
                List<TrialExchangeConfig> list;
                if (model.TryGetTrialExchanges(_class, out list))
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].id == itemId)
                        {
                            line = i / 3;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
    }