少年修仙传客户端代码仓库
client_Zxw
2019-03-13 dbad47aa0e0d34d257311209e351efdb0bd432eb
3335 强化
6个文件已修改
199 ■■■■ 已修改文件
System/EquipGem/EquipStrengthFull.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthModel.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthRein.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthSelectBehaviour.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthUpper.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthWin.cs 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthFull.cs
@@ -16,13 +16,14 @@
        [SerializeField] Text m_AttributesText1;
        [SerializeField] Text m_AttributesText2;
        [SerializeField] Text m_AttributesText3;
        [SerializeField] Text m_TextNumber;
        [SerializeField] Text m_TextMaxLv;
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        public void SetEquipStrengthFull(string equipGuid, int level, int equipPlace)
        {
            //ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(3));
            int equipIndex = level * 10 + equipPlace;
            int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
            int equipLv = 0;
            EquipStrengthClass equipStrength = new EquipStrengthClass();
            if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
@@ -37,6 +38,13 @@
                return;
            }
            NeedMoney.text = SetMoneyText(itemPlus);
            m_TextNumber.text = "+" + equipLv;
            int equipType = strengthModel.GetEquipStrengthType(equipPlace);
            var equipMaxLv = strengthModel.EquipLevelMaxDic[equipType];
            if (equipMaxLv != null)
            {
                m_TextMaxLv.text = Language.Get("ZBQH_02", equipMaxLv.MaxStar, equipMaxLv.MaxLv);
            }
            var item = packModel.GetItemByGuid(equipGuid);
            if (item != null)
            {
System/EquipGem/EquipStrengthModel.cs
@@ -24,10 +24,15 @@
    public int AttValue;
    public string StrName;
}
public class EquipMaxLvClass
{
    public int MaxLv;
    public int MaxStar;
}
public class EquipStrengthModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    public  Dictionary<int, EquipStrengthClass> EquipStrengthDic = new Dictionary<int, EquipStrengthClass>();//强化数据
    public  Dictionary<int, int> EquipLevelMaxDic = new Dictionary<int, int>();//强化类型的最大等级上限
    public  Dictionary<int, EquipMaxLvClass> EquipLevelMaxDic = new Dictionary<int, EquipMaxLvClass>();//强化类型的最大等级上限
    public  Dictionary<int, int> PartTypeDic = new Dictionary<int, int>();//强化的部位类型
    public event Action EquipStrengthUpdate;//强化数据刷新
    public event Action SelectEquipRefresh;//二级页签刷新
@@ -134,15 +139,19 @@
        {
            if (EquipLevelMaxDic.ContainsKey(value.EquipType))
            {
                var lv = EquipLevelMaxDic[value.EquipType];
                var lv = EquipLevelMaxDic[value.EquipType].MaxLv;
                if (value.levelMax > lv)
                {
                    EquipLevelMaxDic[value.EquipType] = value.levelMax;
                    EquipLevelMaxDic[value.EquipType].MaxLv = value.levelMax;
                    EquipLevelMaxDic[value.EquipType].MaxStar = value.equipStar;
                }
            }
            else
            {
                EquipLevelMaxDic.Add(value.EquipType, value.levelMax);
                EquipMaxLvClass equipMaxLvClass = new EquipMaxLvClass();
                equipMaxLvClass.MaxStar = value.equipStar;
                equipMaxLvClass.MaxLv = value.levelMax;
                EquipLevelMaxDic.Add(value.EquipType, equipMaxLvClass);
            }
        }
    }
@@ -162,7 +171,7 @@
        int lv = 0;
        if (EquipLevelMaxDic.ContainsKey(type))
        {
            lv = EquipLevelMaxDic[type];
            lv = EquipLevelMaxDic[type].MaxLv;
        }
        return lv;
    }
@@ -172,7 +181,7 @@
        List<EquipTypeClass> EquipTypeList = new List<EquipTypeClass>();
        int type = GetEquipStrengthType(equipPlace);
        int equiplv = 0;
        int equipIndex = level * 10 + equipPlace;
        int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
        if (EquipStrengthDic.ContainsKey(equipIndex))
        {
            equiplv = EquipStrengthDic[equipIndex].EquipPartStarLV;
@@ -204,7 +213,7 @@
        ItemPlusConfig itemPlusConfig = new ItemPlusConfig();
        int type = GetEquipStrengthType(equipPlace);
        int equiplv = 0;
        int equipIndex = level * 10 + equipPlace;
        int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
        if (EquipStrengthDic.ContainsKey(equipIndex))
        {
            equiplv = EquipStrengthDic[equipIndex].EquipPartStarLV;
System/EquipGem/EquipStrengthRein.cs
@@ -20,12 +20,13 @@
        [SerializeField] Text m_AttributesText2;
        [SerializeField] Text m_AttributesText3;
        [SerializeField] Text m_SliderText;
        [SerializeField] Text m_TextNumber;
        [SerializeField] Text m_TextMaxLv;
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        public void SetEquipStrengthRein(string equipGuid,int level,int equipPlace)
        {
            int equipIndex = level * 10 + equipPlace;
        {
            int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
            int equipLv = 0;
            EquipStrengthClass equipStrength=new EquipStrengthClass();
            if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
@@ -44,7 +45,14 @@
            {
                m_ItemEquip.Init(item);
            }
            m_TextNumber.text = "+" + (equipLv + 1);
            NeedMoney.text = SetMoneyText(itemPlus);
            int equipType = strengthModel.GetEquipStrengthType(equipPlace);
            var equipMaxLv = strengthModel.EquipLevelMaxDic[equipType];
            if (equipMaxLv != null)
            {
                m_TextMaxLv.text = Language.Get("ZBQH_02", equipMaxLv.MaxStar, equipMaxLv.MaxLv);
            }
            ItemCellModel cellModel = new ItemCellModel(2100, true, (ulong)1, 0);
            m_ItemMoney.Init(cellModel);
            var equipLvNowList = strengthModel.GetEquipValueList(level, equipPlace);
System/EquipGem/EquipStrengthSelectBehaviour.cs
@@ -61,11 +61,17 @@
        void DisplayBase()
        {
            int itemIndex = EquipPlaceMapConfig.GetServerPlace(equipLevel, equipPlace);
            var strengthLv = 0;
            if (strengthModel.EquipStrengthDic.ContainsKey(itemIndex))
            {
                strengthLv = strengthModel.EquipStrengthDic[itemIndex].EquipPartStarLV;
            }
            var item = packModel.GetItemByGuid(equipGuid);
            if (item != null)
            {
                m_Item.Init(item);
                m_ItemName.text = item.config.ItemName;
                m_Item.Init(item);
                m_ItemName.text = Language.Get("ZBQH_01", item.config.ItemName, strengthLv);
                m_ItemName.color = UIHelper.GetUIColor(item.config.ItemColor, true);
            }
        }
System/EquipGem/EquipStrengthUpper.cs
@@ -16,12 +16,13 @@
        [SerializeField] Text m_AttributesText1;
        [SerializeField] Text m_AttributesText2;
        [SerializeField] Text m_AttributesText3;
        [SerializeField] Text m_TextNumber;
        [SerializeField] Text m_TextMaxLv;
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        public void SetEquipStrengthUpper(string equipGuid, int level, int equipPlace)
        {
            //ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(3));
            int equipIndex = level * 10 + equipPlace;
            int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
            int equipLv = 0;
            EquipStrengthClass equipStrength = new EquipStrengthClass();
            if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
@@ -36,6 +37,13 @@
                return;
            }
            NeedMoney.text = SetMoneyText(itemPlus);
            m_TextNumber.text = "+" + (equipLv + 1);
            int equipType = strengthModel.GetEquipStrengthType(equipPlace);
            var equipMaxLv = strengthModel.EquipLevelMaxDic[equipType];
            if (equipMaxLv != null)
            {
                m_TextMaxLv.text = Language.Get("ZBQH_02", equipMaxLv.MaxStar, equipMaxLv.MaxLv);
            }
            var item = packModel.GetItemByGuid(equipGuid);
            if (item != null)
            {
System/EquipGem/EquipStrengthWin.cs
@@ -29,6 +29,10 @@
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
        private bool IsAutomaticBool = false;
        private float WaitTime = 0.1f;
        private float Times = 0f;
        #region Built-in
        protected override void BindController()
        {
@@ -44,10 +48,13 @@
        protected override void OnPreOpen()
        {
            OpenSelect();//默认选择
            strengthModel.IsChangeBool = true;
            IsAutomaticBool = false;
            Times = 0f;
            m_StopBtn.gameObject.SetActive(false);
            m_AutomaticBtn.gameObject.SetActive(true);
            OpenSelect();//默认选择
            DisplayEquips();
            SetStrengthenedState();
            strengthModel.SelectEquipRefresh += SelectEquipRefresh;
@@ -71,27 +78,65 @@
        protected override void OnAfterClose()
        {
        }
        protected override void LateUpdate()
        {
            if (IsAutomaticBool)
            {
                Times += Time.deltaTime;
                var isBool = StrengtheBool();
                var upperLimitBool = UpperLimitBool();
                if (Times >= WaitTime && isBool && upperLimitBool)
                {
                    Times = 0;
                    int itemIndex = EquipPlaceMapConfig.GetServerPlace(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
                    strengthModel.SendEquip(itemIndex);
                }
                else if (!isBool || !upperLimitBool)
                {
                    IsAutomaticBool = false;
                    OnClickStopBtn();
                }
            }
            else
            {
                Times = 0f;
            }
        }
        #endregion
        private void OnClickStrengBtn()
        {
            int itemIndex = strengthModel.SelectLevel * 10 + strengthModel.SelectEquipPlace;
            strengthModel.SendEquip(itemIndex);
            if (StrengtheBool())
            {
                int itemIndex = EquipPlaceMapConfig.GetServerPlace(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
                strengthModel.SendEquip(itemIndex);
            }
        }
        private void OnClickAutomaticBtn()
        {
            m_StopBtn.gameObject.SetActive(true);
            m_AutomaticBtn.gameObject.SetActive(false);
            if (StrengtheBool())
            {
                IsAutomaticBool = true;
                m_StopBtn.gameObject.SetActive(true);
                m_AutomaticBtn.gameObject.SetActive(false);
            }
        }
        private void OnClickStopBtn()
        {
            IsAutomaticBool = false;
            m_StopBtn.gameObject.SetActive(false);
            m_AutomaticBtn.gameObject.SetActive(true);
        }
        private void EquipStrengthUpdate()
        {
            SetStrengthenedState();
            if (strengthModel.SelectLevel != -1)
            {
                SetStrengthenedState();
                m_Controller.m_Scorller.RefreshActiveCellViews();
            }
        }
        void DisplayEquips()
        {
@@ -131,11 +176,29 @@
            m_Controller.m_Scorller.RefreshActiveCellViews();
            strengthModel.IsChangeBool = true;
            SetStrengthenedState();
            if (IsAutomaticBool)
            {
                Times = 0f;
                OnClickStopBtn();
                IsAutomaticBool = false;
            }
        }
        private void SelectLevelRefresh()
        {
            DisplayEquips();
            strengthModel.IsChangeBool = true;
            if (IsAutomaticBool)
            {
                Times = 0f;
                OnClickStopBtn();
                IsAutomaticBool = false;
            }
            DisplayEquips();
            if (strengthModel.SelectLevel != -1)
            {
                SetStrengthenedState();
            }
        }
        private void OnRefreshCell(ScrollerDataType type, CellView cell)
        {
@@ -168,7 +231,7 @@
            var equiped = !string.IsNullOrEmpty(equipGuid);
            if (equiped)
            {
                int equipIndex = equipLevel * 10 + equipPlace;
                int equipIndex = EquipPlaceMapConfig.GetServerPlace(equipLevel, equipPlace);
                int star = equipStarModel.GetEquipStarLevel(equipLevel, equipPlace);
                int equipLv = 0;
                if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
@@ -177,7 +240,7 @@
                }
                int equipType = strengthModel.GetEquipStrengthType(equipPlace);
                var itemPlusMaxConfig = ItemPlusMaxConfig.GetEquipTypeAndEquipStar(equipType, equipPlace);//获取强化等级上限值
                var itemPlusMaxConfig = ItemPlusMaxConfig.GetEquipTypeAndEquipStar(equipType, star);//获取强化等级上限值
                if (itemPlusMaxConfig == null)
                {
                    DebugEx.LogError("未查找到表数据");
@@ -196,6 +259,7 @@
                {
                    m_BottomFrame.SetActive(false);
                    m_EquipStrengthUpper.gameObject.SetActive(true);
                    m_EquipStrengthUpper.SetEquipStrengthUpper(equipGuid, equipLevel, equipPlace);
                }
                else if (itemPlusMaxConfig.levelMax > equipLv)//可强化过
@@ -248,6 +312,52 @@
                }
            }
        }
        private bool StrengtheBool()
        {
            bool isbool = false;
            var itemPlus = strengthModel.GetEquipConfig(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
            if (itemPlus == null)
            {
                return false;
            }
            ulong money = UIHelper.GetMoneyCnt(3);
            ulong needMoney = (ulong)itemPlus.costCount;
            if (money >= needMoney)
            {
                isbool = true;
            }
            else
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("Z1011"));
                isbool = false;
            }
            return isbool;
        }
        private bool UpperLimitBool()
        {
            bool isBool = false;
            int equipIndex = EquipPlaceMapConfig.GetServerPlace(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
            int star = equipStarModel.GetEquipStarLevel(strengthModel.SelectLevel, strengthModel.SelectEquipPlace);
            int equipLv = 0;
            if (strengthModel.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
            {
                equipLv = strengthModel.EquipStrengthDic[equipIndex].EquipPartStarLV;
            }
            int equipType = strengthModel.GetEquipStrengthType(strengthModel.SelectEquipPlace);
            var itemPlusMaxConfig = ItemPlusMaxConfig.GetEquipTypeAndEquipStar(equipType, star);//获取强化等级上限值
            if (itemPlusMaxConfig.levelMax > equipLv)
            {
                isBool = true;
            }
            else
            {
                isBool = false;
            }
            return isBool;
        }
    }
}