public static void ProjectAnalyzerView() { UnityEngine.Object asset = Selection.activeGameObject; string assetPath = AssetDatabase.GetAssetPath(asset); ResInfo refInfo = null; if (asset is Texture) { refInfo = new TextureInfo(asset as Texture, assetPath); } else { ModelImporter mi = AssetImporter.GetAtPath(assetPath) as ModelImporter; if (mi != null) { refInfo = new ModelInfo(mi, assetPath); } } if (refInfo != null) { EditorUtility.DisplayDialog("Tips", refInfo.GetResInfoDetails(), "OK"); } }
public void SortTexture(TextureInfo.SortType sortType) { switch (sortType) { case TextureInfo.SortType.Name: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo1.name.CompareTo(tInfo2.name); }); break; case TextureInfo.SortType.MemorySize: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.size.CompareTo(tInfo1.size); }); break; case TextureInfo.SortType.PixWidth: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.width.CompareTo(tInfo1.width); }); break; case TextureInfo.SortType.PixHeigh: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.height.CompareTo(tInfo1.height); }); break; case TextureInfo.SortType.IsRW: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.isRW.CompareTo(tInfo1.isRW); }); break; case TextureInfo.SortType.Mipmap: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.isMipmap.CompareTo(tInfo1.isMipmap); }); break; case TextureInfo.SortType.IsLightmap: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.isLightmap.CompareTo(tInfo1.isLightmap); }); break; case TextureInfo.SortType.AnisoLevel: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.anisoLevel.CompareTo(tInfo1.anisoLevel); }); break; case TextureInfo.SortType.Propose: textures.Sort(delegate(TextureInfo tInfo1, TextureInfo tInfo2) { return tInfo2.proposeTipCount.CompareTo(tInfo1.proposeTipCount); }); break; } }
public void DrawTextures() { GUILayout.Space(10); actSubTypeTexture = (ActiveSubType)GUILayout.Toolbar((int)actSubTypeTexture, textureToolStrings, GUILayout.MaxWidth(200)); GUILayout.Space(10); scrollPosTexture = EditorGUILayout.BeginScrollView(scrollPosTexture); if (actSubTypeTexture == ActiveSubType.Details) { GUILayout.BeginHorizontal(); GUILayout.Label(string.Format(LanguageCfg.PROJECT_TEXTURES_LIST, ProjectResource.Instance.textures.Count), GUILayout.Width(150)); if (GUILayout.Button(LanguageCfg.TEXTURE_SETTING_NO_MINMAP, GUILayout.Width(120))) { ProjectResource.Instance.SetTextureNoMinmap(); } DrawPageCnt(ProjectResource.Instance.textures.Count); GUILayout.EndHorizontal(); GUILayout.Space(10); //绘制title GUILayout.BeginHorizontal(); if (GUILayout.Button(LanguageCfg.NAME, GUILayout.Width(150))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.Name); } if (GUILayout.Button(LanguageCfg.MemorySize, GUILayout.Width(100))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.MemorySize); } if (GUILayout.Button(LanguageCfg.PIX_W, GUILayout.Width(50))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.PixWidth); } if (GUILayout.Button(LanguageCfg.PIX_H, GUILayout.Width(50))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.PixHeigh); } if (GUILayout.Button(LanguageCfg.IsRW, GUILayout.Width(50))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.IsRW); } if (GUILayout.Button(LanguageCfg.OverridePlat, GUILayout.Width(100))) { mCurPage = 0; } if (GUILayout.Button(LanguageCfg.Mipmap, GUILayout.Width(100))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.Mipmap); } if (GUILayout.Button(LanguageCfg.IsLightmap, GUILayout.Width(80))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.IsLightmap); } if (GUILayout.Button(LanguageCfg.AnisoLevel, GUILayout.Width(80))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.AnisoLevel); } if (GUILayout.Button(LanguageCfg.PROPOSE, GUILayout.Width(100))) { mCurPage = 0; ProjectResource.Instance.SortTexture(TextureInfo.SortType.Propose); } GUILayout.EndHorizontal(); int start = mPageCnt * mCurPage; int end = mPageCnt * (mCurPage + 1); end = end >= ProjectResource.Instance.textures.Count ? ProjectResource.Instance.textures.Count : end; for (int i = start; i < end; i++) { TextureInfo textureInfo = ProjectResource.Instance.textures[i]; GUILayout.BeginHorizontal(); if (GUILayout.Button(textureInfo.name, GUILayout.Width(150))) { EditTools.PingAssetInProject(textureInfo.path); //Selection.activeObject = textureInfo.texture; } GUILayout.Space(10); GUILayout.Label(textureInfo.GetSize(), GUILayout.MaxWidth(100)); GUILayout.Label(textureInfo.width + "x" + textureInfo.height, GUILayout.MaxWidth(100)); GUILayout.Label(textureInfo.isRW.ToString(), GUILayout.MaxWidth(50)); GUILayout.Label(textureInfo.IsOverridePlatform(), GUILayout.MaxWidth(100)); GUILayout.Label(textureInfo.isMipmap.ToString(), GUILayout.MaxWidth(100)); GUILayout.Label(textureInfo.isLightmap.ToString(), GUILayout.MaxWidth(80)); GUILayout.Label(textureInfo.anisoLevel.ToString(), GUILayout.MaxWidth(80)); DrawProposeTips(textureInfo); GUILayout.EndHorizontal(); } } else if (actSubTypeTexture == ActiveSubType.Settings) { GUILayout.BeginHorizontal(); SettingCfgUI.textureCheckMemSize = GUILayout.Toggle(SettingCfgUI.textureCheckMemSize, "检查内存大小", GUILayout.MaxWidth(100)); SettingCfgUI.textureCheckMemSizeValue = GUILayout.TextField(SettingCfgUI.textureCheckMemSizeValue, GUILayout.MaxWidth(80)); GUILayout.Label("kb", GUILayout.MaxWidth(20)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); SettingCfgUI.textureCheckPix = GUILayout.Toggle(SettingCfgUI.textureCheckPix, "检查分辨率", GUILayout.MaxWidth(100)); SettingCfgUI.textureCheckPixW = GUILayout.TextField(SettingCfgUI.textureCheckPixW, GUILayout.MaxWidth(80)); GUILayout.Label("x", GUILayout.MaxWidth(20)); SettingCfgUI.textureCheckPixH = GUILayout.TextField(SettingCfgUI.textureCheckPixH, GUILayout.MaxWidth(80)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); SettingCfgUI.textureCheckPix2Pow = GUILayout.Toggle(SettingCfgUI.textureCheckPix2Pow, "检查2N次幂", GUILayout.MaxWidth(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); SettingCfgUI.textureCheckIsRW = GUILayout.Toggle(SettingCfgUI.textureCheckIsRW, "检查可读写", GUILayout.MaxWidth(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); SettingCfgUI.textureCheckPlatSetting = GUILayout.Toggle(SettingCfgUI.textureCheckPlatSetting, "检查平台设置", GUILayout.MaxWidth(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); SettingCfgUI.textureCheckIsLightmap = GUILayout.Toggle(SettingCfgUI.textureCheckIsLightmap, "检查lightmap格式", GUILayout.MaxWidth(150)); GUILayout.EndHorizontal(); if (GUILayout.Button("应用", GUILayout.MaxWidth(100))) { SettingCfg.Apply(true); ProjectResource.Instance.ReCheckTextures(); } } else { DrawHelpTips(LanguageCfg.HELP_TEXTURE); } EditorGUILayout.EndScrollView(); }