/** 创建一个bundle数据信息 */ private void createBundleData(string bundleName) { int id = getResourceId(); checkBundleRepeat(bundleName); _bundleInfoDataList[bundleName] = new BundleInfoData { id = id }; _bundleInfoExDataList[bundleName] = new BundleInfoExData { id = id, name = bundleName }; _resourceInfoDataList[id] = new ResourceInfoData { id = id, name = "bundle/" + bundleName, type = ResourceType.Bundle }; ResourceInfoExData resourceInfoExData = new ResourceInfoExData { id = id, name = bundleName }; _resourceInfoExDataList[id] = resourceInfoExData; _resourceInfoExDataCache[resourceInfoExData.name] = resourceInfoExData; }
/** 执行单个 */ private void doSingleOne(string path, string bundleName) { if (path.StartsWith(ShineToolGlobal.gamePath)) { String tt = path.Substring(ShineToolGlobal.gamePath.Length + 1); //使用资源名 String useName = path.Substring(ShineToolGlobal.assetSourcePath.Length + 1); //取资源信息,并生产index int id = getResourceId(); _resourceInfoDataList[id] = new ResourceInfoData { id = id, name = useName, type = 0 }; ResourceInfoExData resourceInfoExData = new ResourceInfoExData { id = id, name = tt }; _resourceInfoExDataList[id] = resourceInfoExData; _resourceInfoExDataCache[resourceInfoExData.name] = resourceInfoExData; _bundleInfoExDataList[bundleName].assets.add(id); if (Path.GetExtension(path) == ".unity") { _resourceInfoDataList[_bundleInfoDataList[bundleName].id].type = ResourceType.Scene; } AssetImporter importer = AssetImporter.GetAtPath(tt); if (importer == null) { Ctrl.throwError("没有importer", tt); } else { importer.SetAssetBundleNameAndVariant(bundleName, ""); } } else { Ctrl.throwError("不该出现的情况", path); } }