少年修仙传客户端代码仓库
client_Zxw
2019-03-14 d92d8f3647be894168959783a13a9dde2a7b00ae
3335 强化进阶
4个文件已修改
188 ■■■■ 已修改文件
System/EquipGem/EquipEvolution.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipEvolutionWin.cs 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthModel.cs 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthWin.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipEvolution.cs
@@ -13,13 +13,16 @@
        [SerializeField] Button m_EvolutionBtn;
        [SerializeField] RichText m_TexLv;
        [SerializeField] RichText m_TextConent;
        EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        private void Start()
        {
            m_EvolutionBtn.AddListener(OnClickEvolutionBtn);
        }
        public void SetEquipEvolution()
        public void SetEquipEvolution(int equipPlace, int equipLv)
        {
            var evolve = strengthModel.GetEquipPlusEvolve(equipPlace, equipLv);
            m_TexLv.text = Language.Get("Z1024", equipLv);
            m_TextConent.text = evolve.AttrName + "+" + evolve.AttrValue;
        }
        private void OnClickEvolutionBtn()
        {
System/EquipGem/EquipEvolutionWin.cs
@@ -9,7 +9,8 @@
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI {
namespace Snxxz.UI
{
    public class EquipEvolutionWin : Window
    {
@@ -23,34 +24,152 @@
        [SerializeField] RichText m_TextAttributesA;
        [SerializeField] RichText m_TextAttributesB;
        [SerializeField] ItemCell m_ItemCell;
        [SerializeField] ItemCell m_ItemCell;
        [SerializeField] GameObject m_AdvancedObj;
        [SerializeField] GameObject m_FullLevelObj;
        [SerializeField] RichText m_TextAttributesFull;
        [SerializeField] RichText m_TextLvFull;
        #region Built-in
        EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        int equipType;
        protected override void BindController()
        {
        }
        protected override void AddListeners()
        {
            m_CloseButton.AddListener(()=> { CloseImmediately(); });
            m_CloseButton.AddListener(() => { CloseImmediately(); });
            m_EvolutionBtn.AddListener(OnClickEvolutionBtn);
        }
        protected override void OnPreOpen()
        {
        {
            SetEquipEvolution();
        }
        protected override void OnAfterOpen()
        {
            strengthModel.EquipStrngthEvolutionLv += EquipStrngthEvolutionLv;
        }
        protected override void OnPreClose()
        {
        }
        {
            strengthModel.EquipStrngthEvolutionLv -= EquipStrngthEvolutionLv;
        }
        protected override void OnAfterClose()
        {
        }
        }
        #endregion
        private void OnClickEvolutionBtn()
        {
            var isBool = IsCarryOut();
            if (isBool)
            {
                int equipIndex = EquipPlaceMapConfig.GetServerPlace(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
                strengthModel.SendEquipPlusEvolve(equipIndex);
            }
        }
        private void EquipStrngthEvolutionLv()
        {
            SetEquipEvolution();
        }
        private void Reinforceable(int advancedLv)
        {
            m_AdvancedObj.SetActive(true);
            var evolve = strengthModel.GetEquipPlusEvolve(strengthModel.SelectEquipPlace, advancedLv);
            var evolveNext = strengthModel.GetEquipPlusEvolve(strengthModel.SelectEquipPlace, (advancedLv + 1));
            m_TextLvNow.text = Language.Get("Z1024", advancedLv);
            m_TextAttributes.text = evolve.AttrName + "+" + evolve.AttrValue;
            m_TextLvNext.text = Language.Get("Z1024", advancedLv + 1);
            m_TextAttribute2.text = evolveNext.AttrName + "+" + evolveNext.AttrValue;
            ItemCellModel cellModel = new ItemCellModel(evolve.CostItemID, true, (ulong)1);
            m_ItemCell.Init(cellModel);
            if (advancedLv == 0)
            {
                m_TextAttributesA.text = "装备强化等级到达" + evolveNext.NeedPlusLV + "级";
                m_TextAttributesB.text = "消耗" + evolveNext.CostItemCount + "个强化水晶";
            }
            else
            {
                m_TextAttributesA.text = "装备强化等级到达" + evolve.NeedPlusLV + "级";
                m_TextAttributesB.text = "消耗" + evolve.CostItemCount + "个强化水晶";
            }
        }
        private void FullLevel(int advancedLv)
        {
            m_FullLevelObj.SetActive(true);
            var evolve = strengthModel.GetEquipPlusEvolve(strengthModel.SelectEquipPlace, advancedLv);
            m_TextLvFull.text = Language.Get("Z1024", advancedLv);
            m_TextAttributesFull.text = evolve.AttrName + "+" + evolve.AttrValue;
        }
        private void SetEquipEvolution()
        {
            m_AdvancedObj.SetActive(false);
            m_FullLevelObj.SetActive(false);
            int equipLevel = strengthModel.SelectLevel;
            int equipPlace = strengthModel.SelectEquipPlace;
            int equipIndex = EquipPlaceMapConfig.GetServerPlace(equipLevel, equipPlace);
            equipType = strengthModel.GetEquipStrengthType(equipPlace);
            int equipLv = 0;
            int advancedLv = 0;
            if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
            {
                equipLv = strengthModel.EquipStrengthDic[equipIndex].EquipPartStarLV;
                advancedLv = strengthModel.EquipStrengthDic[equipIndex].EvolveLV;
            }
            int advancedMaxLv = 0;
            if (strengthModel.EvolutionTypeMaxDic.ContainsKey(equipType))
            {
                advancedMaxLv = strengthModel.EvolutionTypeMaxDic[equipType];
            }
            if (advancedLv < advancedMaxLv)
            {
                Reinforceable(advancedLv);
            }
            else
            {
                FullLevel(advancedLv);
            }
        }
        private bool IsCarryOut()
        {
            int equipLv = 0;
            int advancedLv = 0;
            int itemCount = 0;
            int equipIndex = EquipPlaceMapConfig.GetServerPlace(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
            if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
            {
                equipLv = strengthModel.EquipStrengthDic[equipIndex].EquipPartStarLV;
                advancedLv = strengthModel.EquipStrengthDic[equipIndex].EvolveLV;
            }
            var equipPlusEvolve = strengthModel.GetEquipPlusEvolve(strengthModel.SelectEquipPlace, advancedLv + 1);
            if (equipPlusEvolve == null)
            {
                DebugEx.LogError("没有找到表数据");
                return false;
            }
            itemCount = playerPack.GetItemCountByID(PackType.Item, equipPlusEvolve.CostItemID);
            if (equipPlusEvolve.NeedPlusLV > equipLv)
            {
                DebugEx.LogError("所需强化等级不足");
                return false;
            }
            if (equipPlusEvolve.CostItemCount > itemCount)
            {
                DebugEx.LogError("所需材料不足");
                return false;
            }
            return true;
        }
    }
}
System/EquipGem/EquipStrengthModel.cs
@@ -49,6 +49,8 @@
    public Dictionary<int, int> PartTypeDic = new Dictionary<int, int>();//强化的部位类型
    public Dictionary<int, int> EvolutionTypeMaxDic = new Dictionary<int, int>();
    public event Action EquipStrengthUpdate;//强化数据刷新
    public event Action EquipStrengthLvUpdate;//强化升级成功
    public event Action EquipStrngthEvolutionLv;//进阶成功
    public event Action SelectEquipRefresh;//二级页签刷新
    public event Action SelectLevelRefresh;//一级页签刷新
@@ -126,7 +128,16 @@
            equipStrength.EvolveLV = equipPartPlus.EvolveLV;
            if (EquipStrengthDic.ContainsKey(equipPartPlus.EquipIndex))
            {
                var equip = EquipStrengthDic[equipPartPlus.EquipIndex];
                EquipStrengthDic[equipPartPlus.EquipIndex] = equipStrength;
                if (equip.EquipPartStarLV != equipPartPlus.EquipPartStarLV && EquipStrengthLvUpdate!=null)
                {
                    EquipStrengthLvUpdate();
                }
                if (equip.EvolveLV != equipPartPlus.EvolveLV && EquipStrngthEvolutionLv != null)
                {
                    EquipStrngthEvolutionLv();
                }
            }
            else
            {
@@ -243,10 +254,15 @@
        return itemPlusConfig;
    }
    public EquipPlusEvolveClass GetEquipPlusEvolve(int equipType, int equipLv = 0)//获取装备进化数据
    public EquipPlusEvolveClass GetEquipPlusEvolve(int equipPlace, int equipLv)//获取装备进化数据
    {
        EquipPlusEvolveClass equipPlusEvolve = new EquipPlusEvolveClass();
        var equipPlusEvolveConfig = EquipPlusEvolveConfig.GetEquipPlaceAndEvolveLV(equipType, equipLv);
        int lvType = 1;
        if (equipLv != 0)
        {
            lvType = equipLv;
        }
        var equipPlusEvolveConfig = EquipPlusEvolveConfig.GetEquipPlaceAndEvolveLV(equipPlace, lvType);
        if (equipPlusEvolveConfig != null)
        {
            equipPlusEvolve.EquipType = equipPlusEvolveConfig.EquipPlace;
@@ -270,25 +286,25 @@
                    switch (config.ISPercentage)
                    {
                        case 0:
                            equipPlusEvolve.AttrValue = value.ToString();
                            if (equipLv == 0)
                            {
                                equipPlusEvolve.AttrValue = 0.ToString();
                            }
                            equipPlusEvolve.AttrValue = value.ToString();
                            }
                            break;
                        case 1:
                            equipPlusEvolve.AttrValue = (value / 100).ToString() + "%";
                            if (equipLv == 0)
                            {
                                equipPlusEvolve.AttrValue = 0.ToString() + "%";
                            }
                            equipPlusEvolve.AttrValue = (value / 100).ToString() + "%";
                            }
                            break;
                        case 2:
                            equipPlusEvolve.AttrValue = value.ToString() + "%";
                            if (equipLv == 0)
                            {
                                equipPlusEvolve.AttrValue = 0.ToString() + "%";
                            }
                            equipPlusEvolve.AttrValue = value.ToString() + "%";
                            }
                            break;
                    }
                }
System/EquipGem/EquipStrengthWin.cs
@@ -25,6 +25,9 @@
        [SerializeField] Button m_AutomaticBtn;
        [SerializeField] Button m_StopBtn;
        [SerializeField] UIEffect m_UIEffect1A;
        [SerializeField] UIEffect m_UIEffect1B;
        EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        EquipGemModel model { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
@@ -137,7 +140,7 @@
            {
                SetStrengthenedState();
                m_Controller.m_Scorller.RefreshActiveCellViews();
            }
            }
        }
        void DisplayEquips()
        {
@@ -194,7 +197,7 @@
                OnClickStopBtn();
                IsAutomaticBool = false;
            }
            DisplayEquips();
            DisplayEquips();
            if (strengthModel.SelectLevel != -1)
            {
                SetStrengthenedState();
@@ -236,9 +239,11 @@
                int equipIndex = EquipPlaceMapConfig.GetServerPlace(equipLevel, equipPlace);
                int star = equipStarModel.GetEquipStarLevel(equipLevel, equipPlace);
                int equipLv = 0;
                int advancedLv = 0;
                if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
                {
                    equipLv = strengthModel.EquipStrengthDic[equipIndex].EquipPartStarLV;
                    advancedLv = strengthModel.EquipStrengthDic[equipIndex].EvolveLV;
                }
                int equipType = strengthModel.GetEquipStrengthType(equipPlace);
@@ -251,10 +256,11 @@
                int maxLv = strengthModel.GetEquipLevelMax(equipType);//获取最大强化等级
                m_EquipEvolution.gameObject.SetActive(true);
                m_EquipEvolution.SetEquipEvolution(equipPlace, advancedLv);
                if (equipLv >= maxLv)//满级
                {
                    m_BottomFrame.SetActive(false);
                    m_EquipStrengthFull.gameObject.SetActive(true);
                    m_EquipStrengthFull.gameObject.SetActive(true);
                    m_EquipStrengthFull.SetEquipStrengthFull(equipGuid, equipLevel, equipPlace);
                }
                else if (maxLv > equipLv && equipLv >= itemPlusMaxConfig.levelMax)//强化上限