public void Init()
        {
            var configPath = SystemPreset.GetConfigPath <HeroCfg>();
            var heroCfgs   = ResourceSys.Instance.LoadAll <HeroCfg>(configPath);

            for (var i = 0; i < heroCfgs.Length; i++)
            {
                heroCfgs[i].BuildDerivedData();
            }

            mHeroCfgs.AddRange(heroCfgs);
            mHeroCfgs.Sort((a, b) =>
            {
                if (a.mId < b.mId)
                {
                    return(-1);
                }
                if (a.mId > b.mId)
                {
                    return(1);
                }
                return(0);
            });

            mIdToHeroCfg = ConfigToolkit.ListToDictionary(heroCfgs, (v) => v.mId);
        }
Exemplo n.º 2
0
        public SkillConfigMgr()
        {
            var skillCfgs = ResourceSys.Instance.LoadAll <SkillCfg>(SystemPreset.GetConfigPath <SkillCfg>());

            foreach (var skillCfg in skillCfgs)
            {
                skillCfg.OnCreate();
                mIdToSkillCfg.Add(skillCfg.mId, skillCfg);
            }
        }