public BundleInfo(string name) { Name = name; MemorySize = 0; MemorySizeFormat = EditorUtility.FormatBytes(MemorySize); _filePaths = new List <string>(); _sortMode = BundleAssetSortMode.FromBig; }
/// <summary> /// 改变排序方式 /// </summary> public void ChangeSortMode() { if (_sortMode == BundleAssetSortMode.FromBig) { _sortMode = BundleAssetSortMode.FromSmall; _filePaths.Sort((a, b) => { AssetFileInfo afile = AssetBundleEditorUtility.GetFileInfoByPath(a); AssetFileInfo bfile = AssetBundleEditorUtility.GetFileInfoByPath(b); if (afile.MemorySize > bfile.MemorySize) { return(1); } else if (afile.MemorySize == bfile.MemorySize) { return(0); } else { return(-1); } }); } else { _sortMode = BundleAssetSortMode.FromBig; _filePaths.Sort((a, b) => { AssetFileInfo afile = AssetBundleEditorUtility.GetFileInfoByPath(a); AssetFileInfo bfile = AssetBundleEditorUtility.GetFileInfoByPath(b); if (afile.MemorySize > bfile.MemorySize) { return(-1); } else if (afile.MemorySize == bfile.MemorySize) { return(0); } else { return(1); } }); } }