コード例 #1
0
    public void OnGUI_OneKeyExprot()
    {
        GUILayout.BeginVertical();
        {
            GUILayout.Label("注:上面按钮操作,会默认生成到StreamingAssets", GUILayout.Width(500), GUILayout.Height(30));
            isGenWindowsAssets = GUILayout.Toggle(isGenWindowsAssets, "生成Windows资源");
            isGenIosAssets     = GUILayout.Toggle(isGenIosAssets, "生成Ios资源");
            isGenAndroidAssets = GUILayout.Toggle(isGenAndroidAssets, "生成Android资源");
            //
            GUILayout.Label("导出地址:" + exportPath, GUILayout.Width(500));
            //
            if (GUILayout.Button("一键导出[自动转hash]", GUILayout.Width(350), GUILayout.Height(30)))
            {
                //选择目录
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", exportPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }
                //开始生成资源
                {
                    //生成windows资源
                    if (isGenWindowsAssets)
                    {
                        var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.WindowsPlayer);
                        //1.编译脚本
                        ScriptBuildTools.GenDllByMono(Application.dataPath, outPath);
                        //2.打包资源
                        AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.StandaloneWindows);
                        //3.打包表格
                        Excel2SQLiteTools.GenSQLite(outPath);
                    }

                    //生成android资源
                    if (isGenAndroidAssets)
                    {
                        var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.Android);
                        //1.编译脚本
                        ScriptBuildTools.GenDllByMono(Application.dataPath, outPath);
                        //2.打包资源
                        AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.Android);
                        //3.打包表格
                        Excel2SQLiteTools.GenSQLite(outPath);
                    }

                    //生成ios资源
                    if (isGenIosAssets)
                    {
                        var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.IPhonePlayer);
                        //1.编译脚本
                        ScriptBuildTools.GenDllByMono(Application.dataPath, outPath);
                        //2.打包资源
                        AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.iOS);
                        //3.打包表格
                        Excel2SQLiteTools.GenSQLite(outPath);
                    }
                }

                //自动转hash
                AssetUploadToServer.Assets2Hash(exportPath, "");

                EditorUtility.DisplayDialog("提示", "资源导出完成", "OK");
            }
            //
            if (GUILayout.Button("上传到文件服务器[内网测试]", GUILayout.Width(350), GUILayout.Height(30)))
            {
                //先不实现,暂时没空
            }
        }
        GUILayout.EndVertical();
    }
コード例 #2
0
    public void OnGUI()
    {
        GUILayout.BeginVertical();
        {
            GUILayout.Label("1.脚本打包", EditorGUIHelper.TitleStyle);
            GUILayout.Space(5);
            //第二排
            GUILayout.BeginHorizontal();
            {
                //
                if (GUILayout.Button("1.编译dll (.net版)", GUILayout.Width(200), GUILayout.Height(30)))
                {
                    string source  = Application.dataPath;
                    string outpath = Application.streamingAssetsPath + "/" +
                                     Utils.GetPlatformPath(Application.platform);
                    //
                    var hotfix = outpath + "/hotfix";
                    if (Directory.Exists(hotfix))
                    {
                        Directory.Delete(hotfix, true);
                    }

                    //
                    ScriptBuildTools.BuildDLL_DotNet(source, outpath);
                    AssetDatabase.Refresh();
                }

                if (GUILayout.Button("[mono版]", GUILayout.Width(100), GUILayout.Height(30)))
                {
                    //
                    //u3d的 各种dll
                    ScriptBuildTools.GenDllByMono(Application.dataPath, Application.streamingAssetsPath + "/" + Utils.GetPlatformPath(Application.platform));
                    Debug.Log("脚本打包完毕");
                }
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("2.生成CLRBinding · one for all", GUILayout.Width(305), GUILayout.Height(30)))
            {
                GenCLRBindingByAnalysis();
            }

            if (GUILayout.Button("3.生成跨域Adapter[没事别瞎点]", GUILayout.Width(305), GUILayout.Height(30)))
            {
                GenCrossBindAdapter();
            }

            if (GUILayout.Button("4.生成Link.xml", GUILayout.Width(305), GUILayout.Height(30)))
            {
                StripCode.GenLinkXml();
            }

            GUI.color = Color.green;
            GUILayout.Label(
                @"注意事项:
     1.编译服务使用codedom,请放心使用
     2.如编译出现报错,请仔细看报错信息,和报错的代码行列,
       一般均为语法错
     3.语法报错原因可能有:主工程访问hotfix中的类, 使用宏
       编译时代码结构发生变化..等等,需要细心的你去发现
"
                );
            GUI.color = GUI.backgroundColor;
        }
        GUILayout.EndVertical();
    }