Exemplo n.º 1
0
        /// <summary>
        /// 把excel生成对应的Class文件,editor环境下用
        /// </summary>
        /// <param name="excelDir"></param>
        /// <param name="classDir"></param>
        static void Excel2Class(string excelDir, string classDir)
        {
            List <SheetData> sheetDataAll = GetAllSheets(excelDir, true);

            if (Directory.Exists(classDir))
            {
                Directory.Delete(classDir, true);
            }
            Directory.CreateDirectory(classDir);
            ClassGenerator.CreateClass(sheetDataAll, classDir);
            ConfigToolLog.LogInfo("Excel2Class complete");
        }
Exemplo n.º 2
0
 /// <summary>
 /// 读取所有配置到configMgr,运行时
 /// </summary>
 /// <param name="configDir"></param>
 /// <param name="configGenerator"></param>
 static void ReadAllConfig(string configDir, IConfigUnSerialize configUnSerialize, string suffixName)
 {
     ConfigMgr.Instance.Init(configUnSerialize);
     ConfigMgr.Instance.CreatData();
     string[] configArr = ConfigMgr.Instance.ConfigNamesArr;
     foreach (var configName in configArr)
     {
         byte[]        content       = File.ReadAllBytes(string.Format(configDir + "{0}.{1}", configName, suffixName));
         SerializeData serializeData = new SerializeData(content, configName);
         ConfigMgr.Instance.UnSerializeConfig(serializeData);
         //ConfigToolLog.LogInfo(ConfigMgr.Instance.m_CardConfig.getValue("100007").name);
         ConfigToolLog.LogInfo("All config readCompleted");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 把excel转为对应的config,editor环境下用
        /// </summary>
        /// <param name="excelDir"></param>
        /// <param name="configDir"></param>
        /// <param name="configGenerator"></param>
        static void Excel2Configs(string excelDir, string configDir, IConfigGenerator configGenerator, string suffixName)
        {
            List <SheetData> sheetDataAll = GetAllSheets(excelDir, false);

            if (Directory.Exists(configDir))
            {
                Directory.Delete(configDir, true);
            }
            Directory.CreateDirectory(configDir);
            foreach (var item in sheetDataAll)
            {
                configGenerator.Excel2Config(item, string.Format(configDir + "{0}.{1}", item.SheetName, suffixName));
            }
            ConfigToolLog.LogInfo("Excel2Configs complete");
        }