private static void Run()
        {
            AssetBundleBuilderController controller = new AssetBundleBuilderController();

            if (!controller.Load())
            {
                throw new GameFrameworkException("Load configuration failure.");
            }
            else
            {
                Debug.Log("Load configuration success.");
            }

            if (!controller.IsValidOutputDirectory)
            {
                throw new GameFrameworkException(string.Format("Output directory '{0}' is invalid.", controller.OutputDirectory));
            }

            if (!controller.BuildAssetBundles())
            {
                throw new GameFrameworkException("Build AssetBundles failure.");
            }
            else
            {
                Debug.Log("Build AssetBundles success.");
                controller.Save();
            }
        }
Example #2
0
        private void OnEnable()
        {
            m_Controller = new AssetBundleBuilderController();
            m_Controller.OnLoadingAssetBundle       += OnLoadingAssetBundle;
            m_Controller.OnLoadingAsset             += OnLoadingAsset;
            m_Controller.OnLoadCompleted            += OnLoadCompleted;
            m_Controller.OnAnalyzingAsset           += OnAnalyzingAsset;
            m_Controller.OnAnalyzeCompleted         += OnAnalyzeCompleted;
            m_Controller.ProcessingAssetBundle      += OnProcessingAssetBundle;
            m_Controller.ProcessAssetBundleComplete += OnProcessAssetBundleComplete;
            m_Controller.BuildAssetBundlesError     += OnBuildAssetBundlesError;

            m_OrderBuildAssetBundles = false;

            if (m_Controller.Load())
            {
                Debug.Log("Load configuration success.");
                m_BuildEventHandlerTypeNameIndex = 0;
                string[] buildEventHandlerTypeNames = m_Controller.GetBuildEventHandlerTypeNames();
                for (int i = 0; i < buildEventHandlerTypeNames.Length; i++)
                {
                    if (m_Controller.BuildEventHandlerTypeName == buildEventHandlerTypeNames[i])
                    {
                        m_BuildEventHandlerTypeNameIndex = i;
                        break;
                    }
                }

                m_Controller.RefreshBuildEventHandler();
            }
            else
            {
                Debug.LogWarning("Load configuration failure.");
            }
        }
Example #3
0
    public static void BuildIOSAssetBundle()
    {
        AssetBundleBuilderController controller = new AssetBundleBuilderController();

        if (!controller.Load())
        {
            throw new GameFrameworkException("Load configuration failure.");
        }
        else
        {
            Debug.Log("Load configuration success.");
        }

        if (controller.RefreshBuildEventHandler())
        {
            Debug.Log("Set build event success.");
        }
        else
        {
            Debug.LogWarning("Set build event failure.");
        }

        // 生成Directory
        string currentPath = Directory.GetCurrentDirectory();
        string workPath    = currentPath + "/AssetBundle";

        if (!Directory.Exists(workPath))
        {
            Directory.CreateDirectory(workPath);
        }

        controller.OutputDirectory = workPath;

        if (!controller.IsValidOutputDirectory)
        {
            throw new GameFrameworkException(string.Format("Output directory '{0}' is invalid.", controller.OutputDirectory));
        }

        if (!controller.BuildAssetBundles())
        {
            throw new GameFrameworkException("Build AssetBundles failure.");
        }
        else
        {
            Debug.Log("Build AssetBundles success.");
            controller.Save();
        }
    }
Example #4
0
        private static void Run(int?internalResourceVersion, Platform platforms, string outputDirectory, string buildEventHandlerTypeName)
        {
            AssetBundleBuilderController controller = new AssetBundleBuilderController();

            if (!controller.Load())
            {
                throw new GameFrameworkException("Load configuration failure.");
            }
            else
            {
                Debug.Log("Load configuration success.");
            }

            if (platforms != Platform.Undefined)
            {
                controller.Platforms = platforms;
            }

            if (internalResourceVersion.HasValue)
            {
                controller.InternalResourceVersion = internalResourceVersion.Value;
            }

            if (outputDirectory != null)
            {
                controller.OutputDirectory = outputDirectory;
            }

            if (buildEventHandlerTypeName != null)
            {
                controller.BuildEventHandlerTypeName = buildEventHandlerTypeName;
            }

            if (!controller.IsValidOutputDirectory)
            {
                throw new GameFrameworkException(Utility.Text.Format("Output directory '{0}' is invalid.", controller.OutputDirectory));
            }

            if (!controller.BuildAssetBundles())
            {
                throw new GameFrameworkException("Build AssetBundles failure.");
            }
            else
            {
                Debug.Log("Build AssetBundles success.");
                controller.Save();
            }
        }
Example #5
0
        private void OnEnable()
        {
            m_Controller = new AssetBundleBuilderController();
            m_Controller.OnLoadingAssetBundle       += OnLoadingAssetBundle;
            m_Controller.OnLoadingAsset             += OnLoadingAsset;
            m_Controller.OnLoadCompleted            += OnLoadCompleted;
            m_Controller.OnAnalyzingAsset           += OnAnalyzingAsset;
            m_Controller.OnAnalyzeCompleted         += OnAnalyzeCompleted;
            m_Controller.ProcessingAssetBundle      += OnProcessingAssetBundle;
            m_Controller.ProcessAssetBundleComplete += OnProcessAssetBundleComplete;
            m_Controller.BuildAssetBundlesError     += OnBuildAssetBundlesError;

            m_OrderBuildAssetBundles = false;

            if (m_Controller.Load())
            {
                Debug.Log("Load configuration success.");
            }
            else
            {
                Debug.LogWarning("Load configuration failure.");
            }
        }