public bool IsMatch(TextureInfo texInfo) { switch (Mode) { case TextureOverviewMode.ReadWrite: return(ReadWriteEnable == texInfo.ReadWriteEnable); case TextureOverviewMode.MipMap: return(MipmapEnable == texInfo.MipmapEnable); case TextureOverviewMode.Type: return(ImportType == texInfo.ImportType); case TextureOverviewMode.Size: return(SizeIndex == OverviewTableConst.GetTextureSizeIndex(texInfo.Width, texInfo.Height)); case TextureOverviewMode.WidthVSHeight: return(WidthAndHeight == (texInfo.Width == texInfo.Height)); case TextureOverviewMode.AndroidFormat: return(AndroidFormat == texInfo.AndroidFormat); case TextureOverviewMode.iOSFormat: return(IosFormat == texInfo.IosFormat); } return(false); }
public static TextureOverviewData CreateNew(TextureOverviewMode mode, TextureInfo texInfo) { TextureOverviewData retData = new TextureOverviewData(); retData.Mode = mode; retData.ReadWriteEnable = texInfo.ReadWriteEnable; retData.MipmapEnable = texInfo.MipmapEnable; retData.ImportType = texInfo.ImportType; retData.AndroidFormat = texInfo.AndroidFormat; retData.IosFormat = texInfo.IosFormat; retData.WidthAndHeight = texInfo.Width == texInfo.Height; retData.SizeIndex = OverviewTableConst.GetTextureSizeIndex(texInfo.Width, texInfo.Height); retData.SizeStr = OverviewTableConst.TextureSizeStr[retData.SizeIndex]; return(retData); }
private static string GenerateTextureSizeData(List <TextureInfo> texInfoList) { Dictionary <int, KeyValuePair <int, long> > dict = new Dictionary <int, KeyValuePair <int, long> >(); for (int i = 0; i < texInfoList.Count; ++i) { TextureInfo texInfo = texInfoList[i]; var key = OverviewTableConst.GetTextureSizeIndex(texInfo.Width, texInfo.Height); var value = texInfoList[i].MemSize; if (!dict.ContainsKey(key)) { dict.Add(key, new KeyValuePair <int, long>()); } KeyValuePair <int, long> rwData = dict[key]; dict[key] = new KeyValuePair <int, long>(rwData.Key + 1, rwData.Value + value); } StringBuilder sb = new StringBuilder(); List <KeyValuePair <int, KeyValuePair <int, long> > > list = new List <KeyValuePair <int, KeyValuePair <int, long> > >(dict); list.Sort((x, y) => { return(x.Key.CompareTo(y.Key)); }); sb.AppendLine("####Texture Size"); sb.AppendLine("|Range|Count|Size|"); sb.AppendLine("|-|-|-|"); foreach (var itor in list) { sb.AppendFormat("|{0}|", OverviewTableConst.TextureSizeStr[(int)itor.Key]); sb.AppendFormat("{0}|{1}|", itor.Value.Key, EditorUtility.FormatBytes(itor.Value.Value)); sb.AppendLine(); } return(sb.ToString()); }