Пример #1
0
        //生成配置文件
        public static void ExecuteCfg(BuildTarget target, string configName, string configVersion, bool doNotCompile = false, Action onFinish = null)
        {
            Defines.WorkDir = System.IO.Directory.GetCurrentDirectory();
            try
            {
                ExportMesssageString();

                //代码转移
                Transfer.ExecuteCfg(configName, configVersion, () =>
                {
                    UnityEngine.Debug.Log("配置数据代码生成完毕!,开始编译!" + doNotCompile);

                    PeekCHFromGameUIToLanguageConverter();

                    // 不需要编译项目
                    if (doNotCompile)
                    {
                        UnityEngine.Debug.Log("配置数据代码生成完毕!,跳过编译!");
                        return;
                    }

                    //代码编译
                    Complier.ExecuteCfg(target, () =>
                    {
                        UnityEngine.Debug.Log("配置数据编译完毕!!,开始分发!!");
                        //编译好的动态库分发
                        Publisher.ExecuteCfg(target);

                        //需要添加回调通知打包工具
                        if (onFinish != null)
                        {
                            onFinish();
                        }
                    });
                });
                // 生成IOS的配置文件
                if (string.IsNullOrEmpty(configName))
                {
                    GameCfgData.ToFile(IosToolEditor.Defines.CN_GAME_CFG_DATA_DIR, "CH");
                }
                else
                {
                    GameCfgData.ToFile(IosToolEditor.Defines.CN_GAME_CFG_DATA_DIR, configName);
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
Пример #2
0
        /// <summary>
        /// 单独导出一张表生成dll文件
        /// </summary>
        public static void ExcuteExportExcelSingle(string excelPath, string structDir, string dataDir)
        {
            try
            {
                _structDir = structDir;
                _dataDir   = dataDir;
                if (!File.Exists(excelPath))
                {
                    Debug.LogError(string.Format("Excel路径{0}不存在!!!", excelPath));
                    return;
                }
                if (!Directory.Exists(structDir))
                {
                    Debug.LogError(string.Format("Declare文件夹路径{0}不存在!!!", structDir));
                    return;
                }
                if (!Directory.Exists(dataDir))
                {
                    Debug.LogError(string.Format("传入的Data文件夹路径{0}有误!!!", dataDir));
                    return;
                }

                Debug.Log("导表开始!");
                int startTime = Environment.TickCount;
                // 读取配置表
                EditorUtility.DisplayProgressBar("配置信息", "读取配置表", 0);

                FileInfo fInfo = new FileInfo(excelPath);
                DeleteCsFile(fInfo);
                ExcelReader.LoadOneExcelEx(fInfo, _structDir, _dataDir);
                //代码编译
                Complier.ExecuteCfg(BuildTarget.Android, () =>
                {
                    Debug.Log("配置数据编译完毕!!,开始分发!!");
                    //编译好的动态库分发
                    Publisher.ExecuteCfg(BuildTarget.Android);
                });

                Debug.Log("导表完成!");
                int endTime = Environment.TickCount;
                int time    = (endTime - startTime) / 1000;
                Debug.LogError("导表共计用时:" + time + " 秒");
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }
Пример #3
0
 //只生成基础的dll
 public static void ExecuteBase(BuildTarget target)
 {
     Defines.WorkDir = System.IO.Directory.GetCurrentDirectory();
     try
     {
         UnityEngine.Debug.Log("开始编译Base解决方案!");
         //代码编译
         Complier.ExecuteBase(target, () =>
         {
             UnityEngine.Debug.Log("编译完毕!!,开始分发!!");
             //编译好的动态库分发
             Publisher.CopyToMain(target);
         });
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
Пример #4
0
 //生成所有的dll
 public static void Execute(BuildTarget target, string configName)
 {
     Defines.WorkDir = System.IO.Directory.GetCurrentDirectory();
     try
     {
         //代码转移
         Transfer.ExecuteAll(configName, () =>
         {
             UnityEngine.Debug.Log("代码转移完毕!,开始编译!");
             //代码编译
             Complier.Execute(target, () =>
             {
                 UnityEngine.Debug.Log("编译完毕!!,开始分发!!");
                 //编译好的动态库分发
                 Publisher.Execute(target);
             });
         });
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
        void OnGUI()
        {
            GUILayout.Width(_screenWidth);
            GUILayout.Height(_screenHeight);

            GUILayout.BeginVertical();
            //绘制标题
            GUILayout.Space(20);
            GUILayout.BeginHorizontal();
            GUILayout.Label("导表工具", GUILayout.Height(30));
            GUILayout.EndHorizontal();

            GUILayout.Space(30);
            EditorGUILayout.LabelField("请选择语言:", GUILayout.Height(20));
            GUILayout.BeginHorizontal();
            _lanIndex = EditorGUILayout.Popup(_lanIndex, CN_LANUAGE, GUILayout.Height(30));
            _lanuage  = CN_LANUAGE[_lanIndex];
            GUILayout.Space(50);
            GUILayout.EndHorizontal();

            GUILayout.Label(string.Format("当前选择语言为: {0} {1}", _lanuage, _lanuageDef[_lanIndex]), GUILayout.Height(40));

            GUILayout.BeginHorizontal();
            _version = EditorGUILayout.TextField("版本号", _version, GUILayout.Height(30));
            GUILayout.Space(20);
            GUILayout.EndHorizontal();

            GUILayout.Space(30);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(string.Format("导{0}_{1}配置表", _lanuage, _version), GUILayout.Height(30)))
            {
                Complier.UseProfiler = false;
                Main.ExecuteCfg(BuildTarget.Android, _lanuage, _version);
            }

            GUILayout.Space(5);
            if (GUILayout.Button("导默认无版本号配置表", GUILayout.Height(30)))
            {
                Complier.UseProfiler = false;
                Main.ExecuteCfg(BuildTarget.Android, string.Empty, string.Empty);
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            GUILayout.Space(50);

            if (GUILayout.Button("语言翻译调试(策划专用)", GUILayout.Height(30)))
            {
                //代码转移
                Transfer.ExecuteCfg("", "", () =>
                {
                    UnityEngine.Debug.Log("配置数据代码生成完毕!,开始编译!");

                    //转UI和StringDefine的语言
                    ChangeUIAndStringDefineLan(_lanuage);
                    //拷贝翻译后的UI到原始目录
                    CopyConvertedUIToSource(_lanuage);
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

                    //代码编译
                    Complier.ExecuteCfg(BuildTarget.Android, () =>
                    {
                        UnityEngine.Debug.Log("配置数据编译完毕!!,开始分发!!");
                        //编译好的动态库分发
                        Publisher.ExecuteCfg(BuildTarget.Android);
                    });
                });
            }
        }