Пример #1
0
        /// <summary>
        /// 打包资源
        /// </summary>
        public void BuildAsset()
        {
            RuntimePlatform platform    = RuntimePlatform.Android;
            BuildTarget     buildTarget = BuildTarget.Android;

            // if (isSelectWindows)
            // {
            //     platform    = RuntimePlatform.WindowsPlayer;
            //     buildTarget = BuildTarget.StandaloneWindows;
            // }
            // else
            if (isSelectAndroid)
            {
                platform    = RuntimePlatform.Android;
                buildTarget = BuildTarget.Android;
            }
            else if (isSelectIOS)
            {
                platform    = RuntimePlatform.IPhonePlayer;
                buildTarget = BuildTarget.iOS;
            }
            AssetBundleEditorTools.GenAssetBundle(exportPath + "/" + BApplication.GetPlatformPath(platform), buildTarget,
                                                  options);

            AssetDatabase.Refresh();
            Debug.Log("资源打包完毕");
        }
Пример #2
0
        /// <summary>
        /// 打包资源
        /// </summary>
        public void BuildAsset()
        {
            RuntimePlatform platform    = RuntimePlatform.Android;
            BuildTarget     buildTarget = BuildTarget.Android;

            if (isSelectAndroid)
            {
                platform    = RuntimePlatform.Android;
                buildTarget = BuildTarget.Android;
            }
            else if (isSelectIOS)
            {
                platform    = RuntimePlatform.IPhonePlayer;
                buildTarget = BuildTarget.iOS;
            }


            var outPath = exportPath + "/" + BApplication.GetPlatformPath(platform);
            var config  = GameObject.Find("BDFrame").GetComponent <Config>();

            //根据版本进入不同打包模式
            if (config.Data.AssetBundleManagerVersion == AssetBundleManagerVersion.V1)
            {
                AssetBundleEditorTools.GenAssetBundle(outPath, buildTarget, options);
            }
            else if (config.Data.AssetBundleManagerVersion == AssetBundleManagerVersion.V2_experiment)
            {
                AssetBundleEditorToolsV2.GenAssetBundle(outPath, buildTarget, options, AES: AES);
            }


            AssetDatabase.Refresh();
            Debug.Log("资源打包完毕");
        }
        /// <summary>
        /// 最新包
        /// </summary>
        void LastestGUI()
        {
            GUILayout.BeginVertical();

            if (GUILayout.Button("检测资源", GUILayout.Width(100)))
            {
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath, "");


                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }

                if (isSelectAndroid)
                {
                    AssetBundleEditorTools.CheackAssets(rootResourceDir, exportPath + "/Android", BuildTarget.Android);
                }
                if (isSelectIOS)
                {
                    AssetBundleEditorTools.CheackAssets(rootResourceDir, exportPath + "/iOS", BuildTarget.iOS);
                }

                AssetDatabase.Refresh();
                Debug.Log("资源打包完毕");
            }

            if (GUILayout.Button("收集Shader keyword", GUILayout.Width(200)))
            {
                ShaderCollection.GenShaderVariant();
            }

            if (GUILayout.Button("一键打包[美术资源]", GUILayout.Width(380), GUILayout.Height(30)))
            {
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }

                //开始打包
                BuildAsset();
            }

            if (GUILayout.Button("AssetBundle还原目录", GUILayout.Width(380), GUILayout.Height(30)))
            {
                exportPath = EditorUtility.OpenFolderPanel("选择资源目录", Application.dataPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }

                AssetBundleEditorTools.HashName2AssetName(exportPath);
            }
            GUILayout.EndVertical();
        }
        /// <summary>
        /// 打包资源
        /// </summary>
        public void BuildAsset()
        {
            if (isSelectAndroid)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir,
                                                      exportPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.Android), BuildTarget.Android, options);
            }
            if (isSelectIOS)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir,
                                                      exportPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.IPhonePlayer), BuildTarget.iOS, options);
            }

            AssetDatabase.Refresh();
            Debug.Log("资源打包完毕");
        }
Пример #5
0
        /// <summary>
        /// 最新包
        /// </summary>
        void LastestGUI()
        {
            GUILayout.BeginVertical();

            if (GUILayout.Button("检测资源", GUILayout.Width(100)))
            {
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath, "");


                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }

                RuntimePlatform rp = RuntimePlatform.Lumin;
                BuildTarget     bt = BuildTarget.Lumin;
                // if (isSelectWindows)
                // {
                //     AssetBundleEditorTools.CheackAssets(rootResourceDir,
                //                                         exportPath + "/" +
                //                                         BApplication.GetPlatformPath(RuntimePlatform.WindowsPlayer),
                //                                         BuildTarget.StandaloneWindows);
                // }

                if (isSelectAndroid)
                {
                    AssetBundleEditorTools.CheackAssets(rootResourceDir,
                                                        exportPath + "/" +
                                                        BApplication.GetPlatformPath(RuntimePlatform.Android),
                                                        BuildTarget.Android);
                }

                if (isSelectIOS)
                {
                    AssetBundleEditorTools.CheackAssets(rootResourceDir,
                                                        exportPath + "/" +
                                                        BApplication.GetPlatformPath(RuntimePlatform.IPhonePlayer),
                                                        BuildTarget.iOS);
                }


                AssetDatabase.Refresh();
                Debug.Log("资源打包完毕");
            }

            if (GUILayout.Button("收集Shader keyword", GUILayout.Width(200)))
            {
                ShaderCollection.GenShaderVariant();
            }

            if (GUILayout.Button("一键打包[美术资源]", GUILayout.Width(380), GUILayout.Height(30)))
            {
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }

                //搜集keyword
                ShaderCollection.GenShaderVariant();
                //开始打包
                BuildAsset();
            }

            if (GUILayout.Button("AssetBundle还原目录", GUILayout.Width(380), GUILayout.Height(30)))
            {
                exportPath = EditorUtility.OpenFolderPanel("选择资源目录", Application.dataPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }

                AssetBundleEditorTools.HashName2AssetName(exportPath);
            }

            GUILayout.EndVertical();
        }