少年修仙传客户端代码仓库
client_linchunjie
2018-12-11 43552e338e97a14b7f1ad952b16425a88d64acc2
5389【前端】【1.3】【1.3.100】神兵特效展示界面新增战力与属性展示
3个文件已修改
129 ■■■■■ 已修改文件
System/Realm/ActivateShow.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/GodWeaponPreviewWin.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/MagicianModel.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Realm/ActivateShow.cs
@@ -148,7 +148,7 @@
            }
        }
        public static void GodWeaponStage(int _type, int _level, int _beforeLevel)
        public static void GodWeaponStage(int _type, int _level, int _beforeLevel,int stage)
        {
            activateType = ActivateFunc.GodWeaponEffect;
            currentLv = _level;
@@ -200,6 +200,10 @@
                    fightPower += skillConfig.FightPower;
                }
            }
            var dict = _model.GetEffectPropertyUpper(_type, stage);
            fightPower += UIHelper.GetFightPower(dict);
            var requireLevel = _model.GetGodWeaponStageRequireLevel(_type, stage);
            fightPower += _model.TryGetEffectFightPower(_type, requireLevel);
            titleIconKey = "GodWeaponEffectTitle";
System/Role/GodWeaponPreviewWin.cs
@@ -20,6 +20,8 @@
        [SerializeField] Button[] m_SelectStages;
        [SerializeField] Image m_Select;
        [SerializeField] RawImage m_RawModel;
        [SerializeField] PropertyBehaviour[] m_Propertys;
        [SerializeField] Text m_FightPower;
        [SerializeField] Button m_Close;
        int selectStage = 1;
@@ -79,6 +81,8 @@
            DisplayModel();
            DisplayStage();
            DisplayRequireLevel();
            DisplayProperty();
            DisplayFightPower();
        }
        private void DisplayStage()
@@ -94,6 +98,38 @@
            m_RequireLevel.text = Language.Get("GodWeaponStageRequireLevel", config.Name, requireLevel);
        }
        private void DisplayFightPower()
        {
            var requireLevel = model.GetGodWeaponStageRequireLevel(selectGodWeaponType, selectStage);
            var fightPower = 0;
            var dict = model.GetEffectPropertyUpper(selectGodWeaponType, selectStage);
            fightPower += model.TryGetEffectFightPower(selectGodWeaponType, requireLevel);
            if (dict != null)
            {
                fightPower += UIHelper.GetFightPower(dict);
            }
            m_FightPower.text = fightPower.ToString();
        }
        private void DisplayProperty()
        {
            var dict = model.GetEffectPropertyUpper(selectGodWeaponType, selectStage);
            var index = 0;
            foreach (var key in dict.Keys)
            {
                if (index < m_Propertys.Length)
                {
                    m_Propertys[index].gameObject.SetActive(true);
                    m_Propertys[index].DisplayUpper(key, dict[key]);
                }
                index++;
            }
            for (int i = index; i < m_Propertys.Length; i++)
            {
                m_Propertys[i].gameObject.SetActive(false);
            }
        }
        private void DisplayModel()
        {
            m_RawModel.gameObject.SetActive(true);
System/Role/MagicianModel.cs
@@ -88,6 +88,9 @@
        Dictionary<int, int> exteriorPowerDict = new Dictionary<int, int>();
        Dictionary<int, int> godWeaponSkillEffect = new Dictionary<int, int>();
        Dictionary<int, int> singleHarmmerExp = new Dictionary<int, int>();
        Dictionary<int, List<GodWeaponEffectProperty>> effectPropertyDict =
            new Dictionary<int, List<GodWeaponEffectProperty>>();
        Dictionary<int, Dictionary<int, int>> effectFightPower = new Dictionary<int, Dictionary<int, int>>();
        int[] autoHammerExpArea { get; set; }
        int[] autoHammerCount { get; set; }
@@ -229,6 +232,24 @@
                    godWeaponStageDict.Add(config.type, stages);
                }
                stages.Add(config.level);
                List<GodWeaponEffectProperty> list;
                if (!effectPropertyDict.TryGetValue(config.type, out list))
                {
                    list = new List<GodWeaponEffectProperty>();
                    effectPropertyDict.Add(config.type, list);
                }
                list.Add(new GodWeaponEffectProperty()
                {
                    level = config.level,
                    propertyDict = ConfigParse.GetDic<int, int>(config.attr),
                });
                Dictionary<int, int> dict;
                if (!effectFightPower.TryGetValue(config.type, out dict))
                {
                    dict = new Dictionary<int, int>();
                    effectFightPower.Add(config.type, dict);
                }
                dict.Add(config.level, config.fightPower);
            }
            funcConfig = Config.Instance.Get<FuncConfigConfig>("MagicExterior");
@@ -390,7 +411,7 @@
                        {
                            WindowCenter.Instance.CloseImmediately<HowToPlayWin>();
                        }
                        ActivateShow.GodWeaponStage(_type, _nowLv, _beforeLv);
                        ActivateShow.GodWeaponStage(_type, _nowLv, _beforeLv, stage);
                    }
                    return;
                }
@@ -675,6 +696,64 @@
            return godWeaponSkillEffect.TryGetValue(skillId, out effect);
        }
        public bool TryGetEffectProperty(int type, int level, out Dictionary<int, int> dict)
        {
            dict = null;
            if (effectPropertyDict.ContainsKey(type))
            {
                var effectProperty = effectPropertyDict[type].Find((x) =>
                  {
                      return x.level == level;
                  });
                if (!effectProperty.Equals(default(GodWeaponEffectProperty)))
                {
                    dict = effectProperty.propertyDict;
                    return true;
                }
            }
            return false;
        }
        public int TryGetEffectFightPower(int type, int level)
        {
            if (effectFightPower.ContainsKey(type))
            {
                if (effectFightPower[type].ContainsKey(level))
                {
                    return effectFightPower[type][level];
                }
            }
            return 0;
        }
        Dictionary<int, int> propertyCacheDict = new Dictionary<int, int>();
        public Dictionary<int, int> GetEffectPropertyUpper(int type, int stage)
        {
            propertyCacheDict.Clear();
            Dictionary<int, int> previousPropertyDict = null;
            if (stage - 1 > 0)
            {
                var level = GetGodWeaponStageRequireLevel(type, stage - 1);
                TryGetEffectProperty(type, level, out previousPropertyDict);
            }
            var requireLevel = GetGodWeaponStageRequireLevel(type, stage);
            Dictionary<int, int> dict;
            if (TryGetEffectProperty(type, requireLevel, out dict))
            {
                foreach (var key in dict.Keys)
                {
                    if (previousPropertyDict != null && previousPropertyDict.ContainsKey(key))
                    {
                        propertyCacheDict.Add(key, dict[key] - previousPropertyDict[key]);
                    }
                    else
                    {
                        propertyCacheDict.Add(key, dict[key]);
                    }
                }
            }
            return propertyCacheDict;
        }
    }
    public class GodWeaponInfo
@@ -695,5 +774,11 @@
        public int cost;
        public int exp;
    }
    public struct GodWeaponEffectProperty
    {
        public int level;
        public Dictionary<int, int> propertyDict;
    }
}