void SortByMethod(TexSortMethod method) { if (method == TexSortMethod.size) { texturesResult.Sort(delegate(LsyTextureInfo x, LsyTextureInfo y) { int sizeA = x.GetLsyTextureInfoPlatform(platform.ToString()).size; int sizeB = y.GetLsyTextureInfoPlatform(platform.ToString()).size; return(sizeB - sizeA); }); } if (method == TexSortMethod.size_rev) { texturesResult.Sort(delegate(LsyTextureInfo x, LsyTextureInfo y) { int sizeA = x.GetLsyTextureInfoPlatform(platform.ToString()).size; int sizeB = y.GetLsyTextureInfoPlatform(platform.ToString()).size; return(sizeA - sizeB); }); } if (method == TexSortMethod.name) { texturesResult.Sort(delegate(LsyTextureInfo x, LsyTextureInfo y) { string nameA = x.tex.name; string nameB = y.tex.name; return(nameA.CompareTo(nameB)); }); } if (method == TexSortMethod.name_rev) { texturesResult.Sort(delegate(LsyTextureInfo x, LsyTextureInfo y) { string nameA = x.tex.name; string nameB = y.tex.name; return(nameB.CompareTo(nameA)); }); } }
void LocalHeader() { GUILayout.Space(30); ShowTitle("逐个设置"); GUILayout.BeginHorizontal(); GUILayout.Label("总大小", GUILayout.Width(buttonWidth)); ShowSize(overallSize); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20); string simbol = ""; if (texSortMethod == TexSortMethod.name) { simbol = "▽"; GUI.backgroundColor = highLightColor; } else if (texSortMethod == TexSortMethod.name_rev) { simbol = "△"; GUI.backgroundColor = highLightColor; } else { simbol = "▽"; GUI.backgroundColor = Color.white; } if (GUILayout.Button(simbol, GUILayout.Width(70))) { if (texSortMethod == TexSortMethod.name) { texSortMethod = TexSortMethod.name_rev; } else { texSortMethod = TexSortMethod.name; } LocalSort(); } GUILayout.Space(240); if (texSortMethod == TexSortMethod.size) { simbol = "▽"; GUI.backgroundColor = highLightColor; } else if (texSortMethod == TexSortMethod.size_rev) { simbol = "△"; GUI.backgroundColor = highLightColor; } else { simbol = "▽"; GUI.backgroundColor = Color.white; } if (GUILayout.Button(simbol, GUILayout.Width(70))) { if (texSortMethod == TexSortMethod.size) { texSortMethod = TexSortMethod.size_rev; } else { texSortMethod = TexSortMethod.size; } LocalSort(); } GUI.backgroundColor = Color.white; GUILayout.Space(115); searchText = GUILayout.TextField(searchText, GUILayout.Width(200)); if (GUILayout.Button("Search", GUILayout.Width(70))) { LocalSearch(); } GUILayout.EndHorizontal(); }