Пример #1
0
    public static void ReadLocalConfig()
    {
        StaticCnf.Clear();
        int length = 0;
        Dictionary <string, BaseCsvInfo> csv_infos = CnfHelper.LoadFileContent();
        BaseCsvInfo info = null;

        info = csv_infos["BuffCnf"];
        Dictionary <int, BuffCnf> buffcnf = new Dictionary <int, BuffCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            BuffCnf tmp = new BuffCnf();
            tmp.ToLocalRead(info._datas[i]);
            buffcnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(buffcnf);

        info = csv_infos["BuffEffectCnf"];
        Dictionary <int, BuffEffectCnf> buffeffectcnf = new Dictionary <int, BuffEffectCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            BuffEffectCnf tmp = new BuffEffectCnf();
            tmp.ToLocalRead(info._datas[i]);
            buffeffectcnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(buffeffectcnf);

        info = csv_infos["HeroInfoCnf"];
        Dictionary <int, HeroInfoCnf> heroinfocnf = new Dictionary <int, HeroInfoCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            HeroInfoCnf tmp = new HeroInfoCnf();
            tmp.ToLocalRead(info._datas[i]);
            heroinfocnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(heroinfocnf);

        info = csv_infos["SpellInfoCnf"];
        Dictionary <int, SpellInfoCnf> spellinfocnf = new Dictionary <int, SpellInfoCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            SpellInfoCnf tmp = new SpellInfoCnf();
            tmp.ToLocalRead(info._datas[i]);
            spellinfocnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(spellinfocnf);
    }
Пример #2
0
        // 创建数据结构类
        public static List <EClassDefine> CreateClass(Dictionary <string, BaseCsvInfo> csv_infos)
        {
            List <EClassDefine> class_map = new List <EClassDefine>();
            List <BaseCsvInfo>  csv_list  = new List <BaseCsvInfo>(csv_infos.Values);
            int length = csv_list.Count;

            for (int i = 0; i < length; i++)
            {
                BaseCsvInfo  csv_info   = csv_list[i];
                EClassDefine class_info = new EClassDefine();
                // 4.根据内容生成data
                class_info.AddProp(csv_info._propDes, csv_info._propType, csv_info._propName);
                class_info.file_path  = csv_info._classPath;
                class_info.class_name = csv_info._className;
                class_info.comment    = string.Empty;
                class_map.Add(class_info);
            }

            return(class_map);
        }