少年修仙传客户端代码仓库
client_linchunjie
2019-04-26 5f1e5c0fdabb5021846b05ff9dd54705c517b4e5
System/Skill/TreasureSkillModel.cs
@@ -10,6 +10,7 @@
    {
        Dictionary<int, TreasureSkill> treasureSkills = new Dictionary<int, TreasureSkill>();
        Dictionary<int, List<int>> jobTreasureSkills = new Dictionary<int, List<int>>();
        Dictionary<int, int> m_ExpertSkills = new Dictionary<int, int>();
        public List<int> skillLevelUpItems = new List<int>();
@@ -44,6 +45,7 @@
        public event Action<int> treasureSkillRefresh;
        public event Action<int> skillLevelUpRefresh;
        public event Action<int, int> potentialLevelRefresh;
        public event Action<int> expertSkillRefresh;
        public override void Init()
        {
            ParseConfig();
@@ -58,6 +60,7 @@
            {
                skill.Reset();
            }
            m_ExpertSkills.Clear();
            serverInited = false;
        }
@@ -107,8 +110,7 @@
                    treasureSkills.Add(config.limitSkillId, treasureSkill);
                    index++;
                }
                treasureSkill.potentials.Add(new TreasurePotential(config.id, 0,
                    config.limitLevel, treasureSkill.redpoint.id));
                treasureSkill.potentials.Add(new TreasurePotential(config.id, 0, treasureSkill.redpoint.id));
                var skillConfig = SkillConfig.Get(config.limitSkillId);
                List<int> skills;
@@ -160,6 +162,11 @@
            return treasureSkills.TryGetValue(skillId, out treasureSkill);
        }
        public bool TryGetExpertSkill(int skillId,out int _skill)
        {
            return m_ExpertSkills.TryGetValue(skillId, out _skill);
        }
        public bool TryGetPotential(int skillId, out TreasurePotential potential)
        {
            var treasureSkillId = 0;
@@ -172,21 +179,6 @@
                    return x.id == skillId;
                });
                return potential != null;
            }
            return false;
        }
        public bool IsPotentialUnlock(int skillId)
        {
            var treasureSkillId = 0;
            if (ContainsSkill(skillId, out treasureSkillId))
            {
                var treasureSkill = treasureSkills[treasureSkillId];
                TreasurePotential potential;
                if (TryGetPotential(skillId, out potential))
                {
                    return treasureSkill.level >= potential.openLevel;
                }
            }
            return false;
        }
@@ -249,6 +241,19 @@
                }
                UpdateRedpoint();
            }
        }
        public void OnReceivePackage(HA309_tagMCSkillElementInfo package)
        {
            for (int i = 0; i < package.Cnt; i++)
            {
                var data = package.InfoList[i];
                m_ExpertSkills[(int)data.MainSkillID] = (int)data.ElementSkillID;
                if (expertSkillRefresh != null)
                {
                    expertSkillRefresh((int)data.MainSkillID);
                }
            }
        }
@@ -369,20 +374,6 @@
                {
                    skill.levelUpRedpoint.state = RedPointState.None;
                }
                foreach (var potential in skill.potentials)
                {
                    if (requireRemind && funcOpen && IsPotentialUnlock(potential.id) &&
                        TryLevelUpPotential(potential.id, out error)
                        && skill.level > 0)
                    {
                        potential.levelUpRedpoint.state = RedPointState.Simple;
                    }
                    else
                    {
                        potential.levelUpRedpoint.state = RedPointState.None;
                    }
                }
            }
        }
    }
@@ -456,23 +447,16 @@
    public class TreasurePotential
    {
        public readonly int id;
        public readonly int openLevel;
        public readonly int maxLevel;
        public int level { get; private set; }
        public Redpoint levelUpRedpoint { get; private set; }
        public TreasurePotential(int id, int level, int openLevel, int redpointBase)
        public TreasurePotential(int id, int level, int redpointBase)
        {
            this.id = id;
            this.level = level;
            this.openLevel = openLevel;
            var config = SkillConfig.Get(id);
            maxLevel = config.SkillMaxLV;
            levelUpRedpoint = new Redpoint(redpointBase,
                TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
        }
        public SkillConfig GetSkillConfig(int level)