少年修仙传客户端代码仓库
client_linchunjie
2018-11-21 18dcdff7d758809422172032067bb551971a3d64
4736 【1.3】【前端】神兵系统修改
4个文件已修改
150 ■■■■■ 已修改文件
System/Role/AutoHammerWin.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/GodWeaponPreviewWin.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/MagicianModel.cs 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/MagicianWin.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/AutoHammerWin.cs
@@ -146,10 +146,14 @@
                requireExp -= (int)godWeaponInfo.exp;
                requireExp = Mathf.Max(0, requireExp);
            }
            var count = Mathf.CeilToInt((float)requireExp / model.autoHammerSingleExp);
            count = Mathf.Max(1, count);
            cost = count * model.autoHammerSingleCost;
            m_Cost.text = cost.ToString();
            AutoHammerCost autoHammerCost;
            if (model.TryGetAutoHammerCost(selectGodWeaponType, out autoHammerCost))
            {
                var count = Mathf.CeilToInt((float)requireExp / autoHammerCost.exp);
                count = Mathf.Max(1, count);
                cost = count * autoHammerCost.cost;
                m_Cost.text = cost.ToString();
            }
        }
        private void Confirm()
System/Role/GodWeaponPreviewWin.cs
@@ -85,7 +85,7 @@
        private void DisplayRequireLevel()
        {
            var requireLevel = model.GetGodWeaponStageRequireLevel(selectStage);
            var requireLevel = model.GetGodWeaponStageRequireLevel(selectGodWeaponType, selectStage);
            var config = GodWeaponConfig.GetConfig(selectGodWeaponType, 1);
            m_RequireLevel.text = Language.Get("GodWeaponStageRequireLevel", config.Name, requireLevel);
        }
System/Role/MagicianModel.cs
@@ -71,7 +71,8 @@
        public Dictionary<int, Dictionary<int, int>> godWeaponSkillDict = new Dictionary<int, Dictionary<int, int>>();
        Dictionary<int, List<GodWeaponCondition>> godWeaponConditions = new Dictionary<int, List<GodWeaponCondition>>();
        public List<int> godWeaponSorts = new List<int>();
        Dictionary<int, AutoHammerCost> autoHammerCostDict = new Dictionary<int, AutoHammerCost>();
        Dictionary<int, int[]> godWeaponStageDict = new Dictionary<int, int[]>();
        int[] autoHammerExpArea { get; set; }
        int[] autoHammerCount { get; set; }
@@ -96,10 +97,6 @@
        public int gotoType = 0;
        public int autoHammerLevel { get; set; }
        public int autoHammerSingleCost { get; private set; }
        public int autoHammerSingleExp { get; private set; }
        public int[] godWeaponStages { get; private set; }
        void ParseConfig()
        {
            godWeaponTypes = GodWeaponConfig.GetGodWeaponType();
@@ -185,10 +182,27 @@
                autoHammerCount = ConfigParse.GetMultipleStr<int>(autoHammerConfig.Numerical2);
            }
            autoHammerSingleCost = 10;
            autoHammerSingleExp = 10;
            var funcConfig = Config.Instance.Get<FuncConfigConfig>("GodMagicExp");
            json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                var array = LitJson.JsonMapper.ToObject<int[]>(json[key].ToJson());
                autoHammerCostDict.Add(type, new AutoHammerCost()
                {
                    cost = array[0],
                    exp = array[1],
                });
            }
            godWeaponStages = new int[] { 100, 200, 300 };
            funcConfig = Config.Instance.Get<FuncConfigConfig>("GodMagicEffect");
            json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                var array = LitJson.JsonMapper.ToObject<int[]>(json[key].ToJson());
                godWeaponStageDict.Add(type, array);
            }
        }
        public int[] GetLevelUpItemByType(int type)
@@ -408,32 +422,51 @@
        public int GetAutoHammerCount(int type)
        {
            ulong totalExp = 0;
            var godWeaponInfo = GetGodWeaponInfo(type);
            if (godWeaponInfo == null || autoHammerExpArea == null || autoHammerCount == null)
            {
                return 1;
            }
            totalExp += godWeaponInfo.exp;
            for (int i = 1; i < godWeaponInfo.level; i++)
            {
                var config = GodWeaponConfig.GetConfig(type, i);
                totalExp += (ulong)config.NeedExp;
            }
            var index = 0;
            for (int i = 0; i < autoHammerExpArea.Length; i++)
            {
                if (totalExp < (ulong)autoHammerExpArea[i])
                {
                    index = i;
                    break;
                }
            }
            if (index < autoHammerCount.Length)
            {
                return autoHammerCount[index];
            }
            return autoHammerCount[autoHammerCount.Length - 1];
            return 1;
            //ulong totalExp = 0;
            //var godWeaponInfo = GetGodWeaponInfo(type);
            //if (godWeaponInfo == null || autoHammerExpArea == null || autoHammerCount == null)
            //{
            //    return 1;
            //}
            //totalExp += godWeaponInfo.exp;
            //for (int i = 1; i < godWeaponInfo.level; i++)
            //{
            //    var config = GodWeaponConfig.GetConfig(type, i);
            //    totalExp += (ulong)config.NeedExp;
            //}
            //var index = 0;
            //for (int i = 0; i < autoHammerExpArea.Length; i++)
            //{
            //    if (totalExp < (ulong)autoHammerExpArea[i])
            //    {
            //        index = i;
            //        break;
            //    }
            //}
            //if (index < autoHammerCount.Length)
            //{
            //    return autoHammerCount[index];
            //}
            //return autoHammerCount[autoHammerCount.Length - 1];
        }
        public int GetAutoHammerCount(int type, int index)
        {
            return 1;
            //var items = GetLevelUpItemByType(type);
            //var moneyCount = GetAutoHammerCount(type);
            //AutoHammerCost autoHammerCost;
            //var totalExp = 0;
            //if (TryGetAutoHammerCost(type, out autoHammerCost))
            //{
            //    totalExp = moneyCount * autoHammerCost.exp;
            //}
            //var itemId = items[index];
            //var itemConfig = Config.Instance.Get<ItemConfig>(itemId);
            //var expCount = Mathf.CeilToInt((float)totalExp / itemConfig.EffectValueA1);
            //var packCount = packModel.GetItemCountByID(PackType.rptItem, itemId);
            //return Mathf.Min(expCount, packCount);
        }
        public bool ContainsCondition(int type)
@@ -451,6 +484,7 @@
            var godWeaponInfo = GetGodWeaponInfo(type);
            if (godWeaponInfo != null)
            {
                var godWeaponStages = godWeaponStageDict[type];
                for (int i = 0; i < godWeaponStages.Length; i++)
                {
                    if (godWeaponInfo.level >= godWeaponStages[i])
@@ -466,8 +500,9 @@
            return 0;
        }
        public int GetGodWeaponStageRequireLevel(int stage)
        public int GetGodWeaponStageRequireLevel(int type, int stage)
        {
            var godWeaponStages = godWeaponStageDict[type];
            if (stage > 0 && stage - 1 < godWeaponStages.Length)
            {
                return godWeaponStages[stage - 1];
@@ -490,6 +525,11 @@
            return false;
        }
        public bool TryGetAutoHammerCost(int type,out AutoHammerCost autoHammerCost)
        {
            return autoHammerCostDict.TryGetValue(type, out autoHammerCost);
        }
    }
    public class GodWeaponInfo
@@ -504,5 +544,11 @@
        public int type;
        public int level;
    }
    public struct AutoHammerCost
    {
        public int cost;
        public int exp;
    }
}
System/Role/MagicianWin.cs
@@ -354,8 +354,10 @@
            m_ContainerLock.gameObject.SetActive(!active);
            m_ContainerUnlock.gameObject.SetActive(active);
            m_ContainerSlider.gameObject.SetActive(active);
            m_AutoHammer.gameObject.SetActive(active);
            m_Hammer.gameObject.SetActive(active || model.SatisfyUnlockCondition(model.selectType));
            AutoHammerCost autoHammerCost;
            bool requireAutoHammer = model.TryGetAutoHammerCost(model.selectType, out autoHammerCost);
            m_AutoHammer.gameObject.SetActive(active && requireAutoHammer);
            if (!active)
            {
                m_CostItemTitle.text = Language.Get("L1049");
@@ -845,7 +847,7 @@
                    return;
                }
                var items = model.GetLevelUpItemByType(model.selectType);
                var count = model.GetAutoHammerCount(model.selectType, index);
                if (index != model.selectItemIndex)
                {
                    OnSelectItem(index);
@@ -856,7 +858,7 @@
                pak.ItemID = (uint)items[index];
                pak.WeaponType = (uint)model.selectType;
                pak.IsAutoBuy = 1;
                pak.ItemCount = 1;
                pak.ItemCount = (byte)Mathf.Min(byte.MaxValue, count);
                GameNetSystem.Instance.SendInfo(pak);
            }
            else
@@ -881,12 +883,18 @@
                requireExp -= (int)godWeaponInfo.exp;
                requireExp = Mathf.Max(0, requireExp);
                var count = model.GetAutoHammerCount(model.selectType);
                if (count * model.autoHammerSingleExp > requireExp)
                AutoHammerCost autoHammerCost;
                if (!model.TryGetAutoHammerCost(model.selectType, out autoHammerCost))
                {
                    count = Mathf.CeilToInt((float)requireExp / model.autoHammerSingleExp);
                    autoHammerState = AutoHammerState.None;
                    return;
                }
                if (count * autoHammerCost.exp > requireExp)
                {
                    count = Mathf.CeilToInt((float)requireExp / autoHammerCost.exp);
                }
                count = Mathf.Max(1, count);
                var cost = count * model.autoHammerSingleCost;
                var cost = count * autoHammerCost.cost;
                if (PlayerDatas.Instance.baseData.Gold < cost)
                {
                    autoHammerState = AutoHammerState.None;