static bool BuildMachineAssets(PlatformType platformType)
    {
        bool        result = false;
        BuildTarget target = BuildAssetBundleHelper.GetBuildTarget(platformType);

        if (target != BuildTarget.NoTarget)
        {
            //Note: Important fix. If don't switch platform, everytime before building AssetBundle,
            //it will take much time to switch to the particular platform.
            PerformBuild.SwitchBuildPlatform(target);

            string path = BuildAssetBundleHelper.GetAssetBundlePath(platformType);
            BuildAssetBundleHelper.DeleteAllFilesInDir(path);

            foreach (SingleMachineAssetConfig config in _machineConfig._machineConfigs)
            {
                if (config._selected)
                {
                    string   bundleName  = config._name.ToLower();
                    string[] assetNames  = AssetDatabase.GetAssetPathsFromAssetBundle(bundleName);
                    bool     buildResult = BuildAssetBundles.BuildBundlesFromMap(path, "", platformType, target,
                                                                                 false, bundleName, assetNames);
                    Debug.Log("Build MachineAsset result:" + buildResult.ToString());
                    Debug.Assert(buildResult);

                    WriteMachineVersionToFile(path, bundleName, config._version);
                }
            }

            result = true;
        }
        return(result);
    }
예제 #2
0
    static bool BuildLiveUpdateAssets()
    {
        bool        result = false;
        BuildTarget target = BuildAssetBundleHelper.GetBuildTarget(_liveUpdateConfig._platformType);

        if (target != BuildTarget.NoTarget)
        {
            //Note: Important fix. If don't switch platform, everytime before building AssetBundle,
            //it will take much time to switch to the particular platform.
            PerformBuild.SwitchBuildPlatform(target);

            string path = BuildAssetBundleHelper.GetAssetBundlePath(_liveUpdateConfig._platformType);
            BuildAssetBundleHelper.DeleteAllFilesInDir(path);

            ExcelDirType  dirType     = BuildAssetBundleHelper.GetExcelDirType(target);
            List <string> allResPaths = BuildAssetBundleHelper.GetAllExcelResourcePaths(dirType, _liveUpdateConfig._excelFileNames);
            allResPaths.AddRange(_liveUpdateConfig._resourcePaths);

            result = BuildAssetBundles.BuildBundlesFromMap(path, _liveUpdateConfig._version, _liveUpdateConfig._platformType, target,
                                                           true, _liveUpdateConfig._bundleName, allResPaths);
        }
        return(result);
    }
예제 #3
0
    static bool BuildABTestAssets()
    {
        bool        result = false;
        BuildTarget target = BuildAssetBundleHelper.GetBuildTarget(_abTestConfig._platformType);

        if (target != BuildTarget.NoTarget)
        {
            //Note: Important fix. If don't switch platform, everytime before building AssetBundle,
            //it will take much time to switch to the particular platform.
            PerformBuild.SwitchBuildPlatform(target);

            ExcelDirType dirType = BuildAssetBundleHelper.GetExcelDirType(target);
            result = true;
            foreach (string abVersion in _abTestConfig._abVersions)
            {
                string path = BuildAssetBundleHelper.GetAssetBundlePath(_abTestConfig._platformType);
                BuildAssetBundleHelper.DeleteAllFilesInDir(path);

                BuildABTestHelper.CopyABToProject(abVersion, dirType);

                string version = _abTestConfig._version + "." + abVersion;

                List <string> allResPaths = BuildAssetBundleHelper.GetAllExcelResourcePaths(dirType, _abTestConfig._excelFileNames);
                allResPaths.AddRange(_abTestConfig._resourcePaths);

                bool r = BuildAssetBundles.BuildBundlesFromMap(path, version, _abTestConfig._platformType, target,
                                                               true, _abTestConfig._bundleName, allResPaths);

                if (!r)
                {
                    result = false;
                }
            }
        }
        return(result);
    }