少年修仙传客户端代码仓库
10408 【BT】【GM】【英语】【越南】【砍树】红装分解(支持根据品质额外再给奖励)
1个文件已修改
39 ■■■■■ 已修改文件
System/KnapSack/Logic/EquipDevourWin.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/EquipDevourWin.cs
@@ -3,7 +3,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using LitJson;
using System.Collections;
namespace vnxbqy.UI
@@ -36,6 +36,7 @@
        [SerializeField] Text getMatProgressText;
        [SerializeField] ButtonEx gotoShenfj;
        [SerializeField] ItemCell devItemCell;
        [SerializeField] ItemCell devItemCell2;
        [SerializeField] int singleLineNum = 5;
        [SerializeField] int sumGridNum = 100;
@@ -46,8 +47,11 @@
        bool isOpen = true;
        int getMatCycle = 0;
        int devItemID;//分解装备获得的材料ID
        int devItemID2;//红装分解装备获得的材料ID
        string devourFormula;   //分解公式
        string devourFormula2;   //红装分解公式
        int preViewDevItemCnt; //分解获得的材料数量
        int preViewDevItemCnt2; //红装分解获得的材料数量
        protected override void BindController()
        {
            colorlistObj.SetActive(true);
@@ -73,6 +77,11 @@
                getMatCycle = int.Parse(config.Numerical1);
                devItemID = int.Parse(config.Numerical4);
                devourFormula = config.Numerical5;
                //{"5":[3017,"1+itemClass"]}
                var json = JsonMapper.ToObject(FuncConfigConfig.Get("EquipDecomposeAward2").Numerical1);
                devItemID2 = int.Parse(json["5"][0].ToString());
                devourFormula2 = json["5"][1].ToString();
            }
            isOpen = true;
            playerPack.selectDevourlist.Clear();
@@ -355,6 +364,7 @@
            equipAddExpPreview = 0;
            EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(playerPack.decomposeLv);
            devItemCell.SetActive(false);
            devItemCell2.SetActive(false);
            if (playerPack.selectDevourlist.Count > 0)
            {
                equipAddExpPreview = GetPreviewExpByDevour();
@@ -386,6 +396,15 @@
                    devItemCell.Init(new ItemCellModel(devItemID, false, (ulong)preViewDevItemCnt));
                    devItemCell.button.AddListener(() => { 
                        ItemTipUtility.Show(devItemID);
                    });
                }
                if (preViewDevItemCnt2 != 0)
                {
                    devItemCell2.SetActive(true);
                    devItemCell2.Init(new ItemCellModel(devItemID2, false, (ulong)preViewDevItemCnt2));
                    devItemCell2.button.AddListener(() => {
                        ItemTipUtility.Show(devItemID2);
                    });
                }
            }
@@ -477,7 +496,8 @@
        int GetPreviewExpByDevour()
        {
            int sumExp = 0;
            preViewDevItemCnt = 0;
            preViewDevItemCnt = 0;
            preViewDevItemCnt2 = 0;
            for (int i = 0; i < playerPack.selectDevourlist.Count; i++)
            {
                int curExp = 0;
@@ -494,6 +514,7 @@
                        curExp = tagPet.Exp;
                    }
                    preViewDevItemCnt += GetDogzScoreById(itemModel);
                    preViewDevItemCnt2 += GetRedEquipDevourItemCnt(itemModel);
                }
                sumExp += curExp;
            }
@@ -521,5 +542,19 @@
            Equation.Instance.AddKeyValue("itemClass", itemModel.config.LV);
            return Equation.Instance.Eval<int>(devourFormula);
        }
        //红装分解可获得的材料数量
        public int GetRedEquipDevourItemCnt(ItemModel itemModel)
        {
            if (itemModel == null)
                return 0;
            if (itemModel.config.ItemColor < 5)
                return 0;
            Equation.Instance.Clear();
            Equation.Instance.AddKeyValue("itemColor", itemModel.config.ItemColor);
            Equation.Instance.AddKeyValue("isSuite", itemModel.config.SuiteiD == 0 ? 0 : 1);
            Equation.Instance.AddKeyValue("itemClass", itemModel.config.LV);
            return Equation.Instance.Eval<int>(devourFormula2);
        }
    }
}