少年修仙传客户端代码仓库
6567 子 【2.0】【开发】强化、镶嵌、洗炼、升星排序规则、红点规则、选中规则 / 【2.0】【前端】强化、镶嵌、洗炼、升星排序规则、红点规则、选中规则
2个文件已修改
216 ■■■■■ 已修改文件
System/EquipGem/EquipStrengthModel.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthWin.cs 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthModel.cs
@@ -54,6 +54,8 @@
    public event Action SelectEquipRefresh;//二级页签刷新
    public event Action SelectLevelRefresh;//一级页签刷新
    public List<int> equipPlaces { get; private set; }
    private bool isChangeBool = true;
    public bool IsChangeBool {
        get { return isChangeBool; }
@@ -92,12 +94,22 @@
    public Int2 jumpEquipPosition { get; set; }
    PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
    EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
    EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
    public override void Init()
    {
        var strengthenLevelLimit = FuncConfigConfig.Get("StrengthenLevelLimit").Numerical1;
        PartTypeDic = ConfigParse.GetDic<int, int>(strengthenLevelLimit);
        GetEquipLevelMax();
        GetEvolutionTypeMax();
        equipPlaces = new List<int>(12);
        for (int i = 1; i <= 12; i++)
        {
            equipPlaces.Add(i);
        }
    }
    public void OnBeforePlayerDataInitialize()
@@ -350,6 +362,49 @@
        return lv;
    }
    public int GetEquipStrengthState(Int2 position)
    {
        var equipGuid = equipModel.GetEquip(position);
        if (string.IsNullOrEmpty(equipGuid))
        {
            return 3;
        }
        var serverPlace = EquipPlaceMapConfig.GetServerPlace(position.x, position.y);
        var item = packModel.GetItemByGuid(equipGuid);
        var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, position.x);
        int star = Mathf.Min(maxStar, equipStarModel.GetStarLevel(position));
        int equipLevel = 0;
        int advancedLevel = 0;
        if (EquipStrengthDic.ContainsKey(serverPlace))//获取当前强化等级
        {
            equipLevel = EquipStrengthDic[serverPlace].StrengthLevel;
            advancedLevel = EquipStrengthDic[serverPlace].EvolveLV;
        }
        int equipType = EquipStrengthModel.GetEquipStrengthType(position.y);
        var itemPlusMaxConfig = ItemPlusMaxConfig.GetEquipTypeAndEquipStar(equipType, star);//获取强化等级上限值
        if (itemPlusMaxConfig == null)
        {
            return 2;
        }
        int maxLevel = GetEquipLevelMax(equipType, maxStar);//获取最大强化等级
        if (equipLevel >= maxLevel)//满级
        {
            return 2;
        }
        if (maxLevel > equipLevel && equipLevel >= itemPlusMaxConfig.levelMax)//强化上限
        {
            return 1;
        }
        return 0;
    }
}
System/EquipGem/EquipStrengthWin.cs
@@ -34,7 +34,6 @@
        [SerializeField] UIEffect m_UIEffect1C;
        EquipStrengthModel model { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
@@ -42,6 +41,9 @@
        private bool IsAutomaticBool = false;
        private float WaitTime = 0.1f;
        private float Times = 0f;
        List<int> m_Sorts = new List<int>();
        #region Built-in
        protected override void BindController()
        {
@@ -135,23 +137,18 @@
                }
                if (equipSet.unLocked)
                {
                    var slotCount = equipGemModel.GetUnlockEquipSlotCount(level);
                    if (slotCount > 0)
                    jumpIndex++;
                    if (model.SelectLevel == level)
                    {
                        jumpIndex++;
                        if (equipGemModel.selectLevel == level)
                        foreach (var place in m_Sorts)
                        {
                            var places = equipGemModel.GetMosaicEquipPlaces();
                            foreach (var place in places)
                            if (equipSet.IsSlotUnLocked(place))
                            {
                                if (equipSet.IsSlotUnLocked(place))
                                if (selectLevel == level && selectPlace == place)
                                {
                                    if (selectLevel == level && selectPlace == place)
                                    {
                                        return jumpIndex;
                                    }
                                    jumpIndex++;
                                    return jumpIndex;
                                }
                                jumpIndex++;
                            }
                        }
                    }
@@ -221,19 +218,17 @@
                }
                if (equipSet.unLocked)
                {
                    var slotCount = equipGemModel.GetUnlockEquipSlotCount(level);
                    if (slotCount > 0)
                    m_Sorts.Clear();
                    m_Controller.AddCell(ScrollerDataType.Header, level);
                    if (model.SelectLevel == level)
                    {
                        m_Controller.AddCell(ScrollerDataType.Header, level);
                        if (model.SelectLevel == level)
                        m_Sorts.AddRange(model.equipPlaces);
                        m_Sorts.Sort(EquipCompare);
                        foreach (var place in m_Sorts)
                        {
                            var places = equipGemModel.GetMosaicEquipPlaces();
                            foreach (var place in places)
                            if (equipSet.IsSlotUnLocked(place))
                            {
                                if (equipSet.IsSlotUnLocked(place))
                                {
                                    m_Controller.AddCell(ScrollerDataType.Normal, level * 1000 + place);
                                }
                                m_Controller.AddCell(ScrollerDataType.Normal, level * 1000 + place);
                            }
                        }
                    }
@@ -241,6 +236,18 @@
            }
            m_Controller.Restart();
        }
        private int EquipCompare(int x, int y)
        {
            var x_state = model.GetEquipStrengthState(new Int2(model.SelectLevel, x));
            var y_state = model.GetEquipStrengthState(new Int2(model.SelectLevel, y));
            if (x_state != y_state)
            {
                return x_state.CompareTo(y_state);
            }
            return x.CompareTo(y);
        }
        private void SelectEquipRefresh()
        {
            m_Controller.m_Scorller.RefreshActiveCellViews();
@@ -292,70 +299,44 @@
                m_ContainerStrength.gameObject.SetActive(false);
                return;
            }
            m_ContainerEmpty.gameObject.SetActive(false);
            m_ContainerStrength.gameObject.SetActive(true);
            m_NotEquipped.SetActive(false);
            m_EquipStrengthFull.gameObject.SetActive(false);
            m_EquipStrengthUpper.gameObject.SetActive(false);
            m_EquipStrengthRein.gameObject.SetActive(false);
            m_EquipEvolution.gameObject.SetActive(false);
            int equipLevel = model.SelectLevel;
            int equipPlace = model.SelectEquipPlace;
            var equipSet = equipModel.GetEquipSet(equipLevel);
            string equipGuid = string.Empty;
            equipGuid = equipSet.GetEquip(equipPlace);
            var equiped = !string.IsNullOrEmpty(equipGuid);
            if (equiped)
            var equipGuid = equipModel.GetEquip(new Int2(model.SelectLevel, model.SelectEquipPlace));
            var state = model.GetEquipStrengthState(new Int2(model.SelectLevel, model.SelectEquipPlace));
            m_NotEquipped.SetActive(state == 3);
            m_EquipStrengthFull.gameObject.SetActive(state == 2);
            m_EquipStrengthUpper.gameObject.SetActive(state == 1);
            m_EquipStrengthRein.gameObject.SetActive(state == 0);
            m_EquipEvolution.gameObject.SetActive(state != 3);
            m_BottomFrame.gameObject.SetActive(state == 1 || state == 0);
            if (state != 3)
            {
                int equipIndex = EquipPlaceMapConfig.GetServerPlace(equipLevel, equipPlace);
                var item = packModel.GetItemByGuid(equipGuid);
                var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, equipLevel);
                int star = Mathf.Min(maxStar, equipStarModel.GetStarLevel(new Int2(equipLevel, equipPlace)));
                int equipLv = 0;
                int advancedLv = 0;
                if (model.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
                var advancedLv = 0;
                var serverPlace = EquipPlaceMapConfig.GetServerPlace(model.SelectLevel, model.SelectEquipPlace);
                if (model.EquipStrengthDic.ContainsKey(serverPlace))
                {
                    equipLv = model.EquipStrengthDic[equipIndex].StrengthLevel;
                    advancedLv = model.EquipStrengthDic[equipIndex].EvolveLV;
                    advancedLv = model.EquipStrengthDic[serverPlace].EvolveLV;
                }
                int equipType = EquipStrengthModel.GetEquipStrengthType(equipPlace);
                var itemPlusMaxConfig = ItemPlusMaxConfig.GetEquipTypeAndEquipStar(equipType, star);//获取强化等级上限值
                if (itemPlusMaxConfig == null)
                {
                    DebugEx.LogError("未查找到表数据");
                    return;
                }
                int maxLv = model.GetEquipLevelMax(equipType, maxStar);//获取最大强化等级
                m_EquipEvolution.gameObject.SetActive(true);
                m_EquipEvolution.SetEquipEvolution(equipPlace, advancedLv);
                if (equipLv >= maxLv)//满级
                {
                    m_BottomFrame.SetActive(false);
                    m_EquipStrengthFull.gameObject.SetActive(true);
                    m_EquipStrengthFull.SetEquipStrengthFull(equipGuid, equipLevel, equipPlace);
                }
                else if (maxLv > equipLv && equipLv >= itemPlusMaxConfig.levelMax)//强化上限
                {
                    m_BottomFrame.SetActive(true);
                    m_EquipStrengthUpper.gameObject.SetActive(true);
                    m_EquipStrengthUpper.SetEquipStrengthUpper(equipGuid, equipLevel, equipPlace);
                }
                else if (itemPlusMaxConfig.levelMax > equipLv)//可强化过
                {
                    m_BottomFrame.SetActive(true);
                    m_EquipStrengthRein.gameObject.SetActive(true);
                    m_EquipStrengthRein.SetEquipStrengthRein(equipGuid, equipLevel, equipPlace);
                }
                m_EquipEvolution.SetEquipEvolution(model.SelectEquipPlace, advancedLv);
            }
            else
            switch (state)
            {
                m_BottomFrame.SetActive(false);
                m_NotEquipped.SetActive(true);
                case 0:
                    m_EquipStrengthRein.SetEquipStrengthRein(equipGuid, model.SelectLevel, model.SelectEquipPlace);
                    break;
                case 1:
                    m_EquipStrengthUpper.SetEquipStrengthUpper(equipGuid, model.SelectLevel, model.SelectEquipPlace);
                    break;
                case 2:
                    m_EquipStrengthFull.SetEquipStrengthFull(equipGuid, model.SelectLevel, model.SelectEquipPlace);
                    break;
            }
        }
@@ -382,22 +363,18 @@
                }
                if (equipSet.unLocked)
                {
                    var slotCount = equipGemModel.GetUnlockEquipSlotCount(level);
                    if (slotCount > 0)
                    if (model.SelectLevel == -1)
                    {
                        if (model.SelectLevel == -1)
                        model.SelectLevel = level;
                    }
                    if (model.SelectLevel == level)
                    {
                        var places = model.equipPlaces;
                        foreach (var place in places)
                        {
                            model.SelectLevel = level;
                        }
                        if (model.SelectLevel == level)
                        {
                            var places = equipGemModel.GetMosaicEquipPlaces();
                            foreach (var place in places)
                            if (model.SelectEquipPlace == -1)
                            {
                                if (model.SelectEquipPlace == -1)
                                {
                                    model.SelectEquipPlace = place;
                                }
                                model.SelectEquipPlace = place;
                            }
                        }
                    }