static void HandleResourceBundle(EResType eResType) { EResType kResGroup = eResType; string path = ResDefine.GetResPath(kResGroup); if (string.IsNullOrEmpty(path) || !Directory.Exists(path)) { return; } string ResName = ResDefine.GetResourceType(kResGroup); string ResFolderName = ResName + "/"; string Dirpath = ""; List <string> kExtList = new List <string>(); ResDefine.GetResTypeFileExtList(kResGroup, ref kExtList); string[] dirs = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); for (int j = 0; j < dirs.Length; j++) { string fPath = path; if (target == BuildTarget.iOS) { fPath = path + "/"; } string name = dirs[j].Replace(fPath, string.Empty).TrimStart(new char[] { '\\' }); name = name.Replace('\\', '_').Replace('/', '_'); name = name.ToLower() + ResDefine.ExtName; Dirpath = "Assets" + dirs[j].Replace(Application.dataPath, ""); AddBuildMap(ResFolderName + name, kExtList, Dirpath); } if (kResGroup != EResType.eResScene) //资源根目录打包 { string DirName = Path.GetFileName(path); AddBuildMap(ResFolderName + DirName + ResDefine.ExtName, kExtList, "Assets" + path.Replace(Application.dataPath, "")); } }
void FillContents() { int index = 0; SortedList <int, MapResProperty> Lists = MapDataProccess.instance.ResList; IList <int> ilistValues = MapDataProccess.instance.ResList.Keys; for (int i = ilistValues.Count - 1; i > -1; --i) { MapResProperty resProp = Lists[ilistValues[i]]; if (resProp.GetEid() == currentProp.GetEid()) { continue; //排除自身 } index = GetIdFormType(resProp.GetResType()); AddResToolItem(resProp, index); } string path = ResDefine.GetResPath(EResType.eResScene); List <string> kExtList = new List <string>(); ResDefine.GetResTypeFileExtList(EResType.eResScene, ref kExtList); DirectoryInfo dir = new DirectoryInfo(path); string[] dirs = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); index = 10101; for (int k = 0; k < dirs.Length; k++) { ArrayList ArraryFiles = ResDefine.GetResourceFiles(dirs[k].ToString(), kExtList); string[] files = new string[ArraryFiles.Count]; ArraryFiles.CopyTo(files); for (int i = 0; i < files.Length; i++) { FileInfo fi = new FileInfo(files[i]); MapResProperty resProp = new MapResProperty(); resProp.SetName(fi.Name.Replace(".unity", "")); resProp.SetEid(index++); AddResToolItem(resProp, 4); } } }