public void Modify(AssetConfigController assetConfigController) { HashSet <string> activityResSet = new HashSet <string>(assetConfigController.ActivityResPaths); string root = "Assets/Export/"; for (int i = 0; i < Groups.Length; i++) { BundleGroup group = Groups[i]; var newGroup = new BundleGroup(); newGroup.GroupName = group.GroupName; newGroup.Version = group.Version; newGroup.GroupIndex = group.GroupIndex; newGroup.Paths = new List <BundleState>(); newGroup.UpdateWholeAB = group.UpdateWholeAB; var dict = new Dictionary <string, BundleState>(); var datas = new List <BundleState>(group.Paths); datas.Sort((a, b) => Convert.ToInt32(a.InInitialPacket) - Convert.ToInt32(b.InInitialPacket)); foreach (var data in datas) { string dir = Path.GetDirectoryName(data.Path); string name = Path.GetFileName(data.Path); string[] subDirs = FilePathTools.GetDirectories(root + dir, "^" + name + "$"); foreach (string subDir in subDirs) { string path = subDir.Replace(root, ""); if (activityResSet.Contains(path) || FilePathTools.GetFiles(subDir, "^(?!\\.)").Length == 0) { continue; } BundleState bundleState = new BundleState { Path = path, InInitialPacket = data.InInitialPacket }; dict[bundleState.Path] = bundleState; } } newGroup.Paths.AddRange(dict.Values); newGroup.Paths.Sort((a, b) => string.Compare(a.Path, b.Path)); if (i < assetConfigController.Groups.Length) { assetConfigController.Groups[i] = newGroup; } } }
static void GenerateAssetConfigABConfig() { BundleGroup bundleGroup = new BundleGroup(); bundleGroup.GroupName = "MapRes"; bundleGroup.Version = "1.0.0"; bundleGroup.Paths = new List <BundleState>(); int groupIndex = -1; for (int i = 0; i < AssetConfigController.Instance.Groups.Length; i++) { if (AssetConfigController.Instance.Groups[i].GroupName.Equals(bundleGroup.GroupName)) { groupIndex = i; break; } } if (groupIndex == -1) { DebugUtil.LogError("AssetConfigController中没有的MapRes,请添加"); return; } bundleGroup.GroupIndex = groupIndex; var bs = new BundleState(); foreach (var path in CookingGameConfigController.Instance.FolderPaths) { foreach (var mapInfo in CookingGameConfigController.Instance.MapInfos) { var localPath = path.LocalPath.Replace("*", mapInfo.LocalId.ToString()); bs = new BundleState(); bs.Path = localPath; bs.InInitialPacket = mapInfo.InInitialPacket; bundleGroup.Paths.Add(bs); } } AssetConfigController.Instance.Groups[groupIndex] = bundleGroup; DebugUtil.LogError("AssetConfigController的MapRes打包配置已重新生成"); AssetDatabase.Refresh(); }
static void GenerateThumbnailResAssetConfigABConfig() { // ThumbnailColorData BundleGroup bundleGroup = new BundleGroup(); bundleGroup.GroupName = "ThumbnailColorData"; bundleGroup.Version = "1.0.0"; bundleGroup.GroupIndex = 4; bundleGroup.Paths = new List <BundleState>(); int sceneIndex = -1; for (int i = 0; i < AssetConfigController.Instance.Groups.Length; i++) { if (AssetConfigController.Instance.Groups[i].GroupName.Equals(bundleGroup.GroupName)) { sceneIndex = i; break; } } if (sceneIndex == -1) { DebugUtil.LogError("AssetConfigController中没有的ThumbnailColorData,请添加"); return; } var bs = new BundleState(); foreach (var baseInfo in ColorResConfigController.Instance.ThumbnailResFolderInfos) { DebugUtil.LogError("开始构建" + baseInfo.Path); bs = new BundleState(); bs.Path = baseInfo.Path; bs.InInitialPacket = baseInfo.InInitialPacket; bundleGroup.Paths.Add(bs); } AssetConfigController.Instance.Groups[sceneIndex] = bundleGroup; DebugUtil.LogError("AssetConfigController的ThumbnailColorData打包配置已重新生成"); AssetDatabase.Refresh(); }
static void GenerateAssetConfigABConfig() { BundleGroup bundleGroup = new BundleGroup(); bundleGroup.GroupName = "Scene"; bundleGroup.Version = "1.0.0"; bundleGroup.GroupIndex = 2; bundleGroup.Paths = new List <BundleState>(); int sceneIndex = -1; for (int i = 0; i < AssetConfigController.Instance.Groups.Length; i++) { if (AssetConfigController.Instance.Groups[i].GroupName.Equals(bundleGroup.GroupName)) { sceneIndex = i; break; } } if (sceneIndex == -1) { DebugUtil.LogError("AssetConfigController中没有的Scene,请添加"); return; } var bs = new BundleState(); bs.Path = "Scene/Effect/Animator"; bs.InInitialPacket = true; bundleGroup.Paths.Add(bs); bs = new BundleState(); bs.Path = "Scene/Effect/Gfx"; bs.InInitialPacket = true; bundleGroup.Paths.Add(bs); bs = new BundleState(); bs.Path = "DummyMaterial"; bs.InInitialPacket = true; bundleGroup.Paths.Add(bs); foreach (var baseInfo in HomeRoomConfigController.Instance.RoomFolderInfos) { DebugUtil.LogError("开始构建" + baseInfo.Path); bs = new BundleState(); bs.Path = baseInfo.Path + "/BGM"; bs.InInitialPacket = baseInfo.InInitialPacket; bundleGroup.Paths.Add(bs); bs = new BundleState(); bs.Path = baseInfo.Path + "/Animation"; bs.InInitialPacket = baseInfo.InInitialPacket; bundleGroup.Paths.Add(bs); foreach (string childFolder in HomeRoomConfigController.Instance.RoomChildFolders) { bs = new BundleState(); bs.Path = baseInfo.Path + "/" + childFolder; bs.InInitialPacket = baseInfo.InInitialPacket; bundleGroup.Paths.Add(bs); } } AssetConfigController.Instance.Groups[sceneIndex] = bundleGroup; DebugUtil.LogError("AssetConfigController的Scene打包配置已重新生成"); AssetDatabase.Refresh(); }