private void OnEnable()
        {
            m_Controller = new ResourceBuilderController();
            m_Controller.OnLoadingResource       += OnLoadingResource;
            m_Controller.OnLoadingAsset          += OnLoadingAsset;
            m_Controller.OnLoadCompleted         += OnLoadCompleted;
            m_Controller.OnAnalyzingAsset        += OnAnalyzingAsset;
            m_Controller.OnAnalyzeCompleted      += OnAnalyzeCompleted;
            m_Controller.ProcessingAssetBundle   += OnProcessingAssetBundle;
            m_Controller.ProcessingBinary        += OnProcessingBinary;
            m_Controller.ProcessResourceComplete += OnProcessResourceComplete;
            m_Controller.BuildResourceError      += OnBuildResourceError;

            m_OrderBuildResources = false;

            if (m_Controller.Load())
            {
                Debug.Log("Load configuration success.");

                m_CompressionHelperTypeNameIndex = 0;
                string[] compressionHelperTypeNames = m_Controller.GetCompressionHelperTypeNames();
                for (int i = 0; i < compressionHelperTypeNames.Length; i++)
                {
                    if (m_Controller.CompressionHelperTypeName == compressionHelperTypeNames[i])
                    {
                        m_CompressionHelperTypeNameIndex = i;
                        break;
                    }
                }

                m_Controller.RefreshCompressionHelper();

                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 #2
0
        private static void Run(int?internalResourceVersion, Platform platforms, string outputDirectory, string buildEventHandlerTypeName)
        {
            ResourceBuilderController controller = new ResourceBuilderController();

            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.BuildResources())
            {
                throw new GameFrameworkException("Build resources failure.");
            }
            else
            {
                Debug.Log("Build resources success.");
                controller.Save();
            }
        }
Example #3
0
        private void OnEnable()
        {
            m_Controller = new ResourceBuilderController();
            m_Controller.OnLoadingResource       += OnLoadingResource;
            m_Controller.OnLoadingAsset          += OnLoadingAsset;
            m_Controller.OnLoadCompleted         += OnLoadCompleted;
            m_Controller.OnAnalyzingAsset        += OnAnalyzingAsset;
            m_Controller.OnAnalyzeCompleted      += OnAnalyzeCompleted;
            m_Controller.ProcessingAssetBundle   += OnProcessingAssetBundle;
            m_Controller.ProcessingBinary        += OnProcessingBinary;
            m_Controller.ProcessResourceComplete += OnProcessResourceComplete;
            m_Controller.BuildResourceError      += OnBuildResourceError;

            AssetBundleFileCalculate.AssetBundleFileLength = AssetBundleFileCalculate.GetDirectoryLength(ConfigPath.AssetBundleFilePath);

            AssetBundleFileCalculate.AssetBundleFileLenString = AssetBundleFileCalculate.GetResourceVersion(AssetBundleFileCalculate.AssetBundleFileLength);

            m_Controller.ResourceUpdating    = AssetBundleFileCalculate.AssetBundleFileLenString;
            m_Controller.ApplicationUpdating = "";

            m_OrderBuildResources = false;

            //加载核心Dll前缀
            Utility.Assembly.LoadAssembly("DBD");

            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.");
            }
        }