Skip to content

Add file type label in configure panel #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Editor/AssetBundleModel/ABModelAssetInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor.IMGUI.Controls;

Expand Down Expand Up @@ -73,6 +74,7 @@ internal class AssetInfo
internal bool isScene { get; set; }
internal bool isFolder { get; set; }
internal long fileSize;
public readonly string fileType;

private HashSet<string> m_Parents;
private string m_AssetName;
Expand All @@ -87,6 +89,7 @@ internal AssetInfo(string inName, string bundleName="")
m_Parents = new HashSet<string>();
isScene = false;
isFolder = false;
fileType = Path.GetExtension(m_AssetName).Trim('.');
}

internal string fullAssetName
Expand Down
22 changes: 19 additions & 3 deletions Editor/AssetListTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private static MultiColumnHeaderState.Column[] GetColumns()
new MultiColumnHeaderState.Column(),
new MultiColumnHeaderState.Column(),
new MultiColumnHeaderState.Column(),
new MultiColumnHeaderState.Column(),
new MultiColumnHeaderState.Column()
};
retVal[0].headerContent = new GUIContent("Asset", "Short name of asset. For full name select asset and see message below");
Expand Down Expand Up @@ -58,28 +59,38 @@ private static MultiColumnHeaderState.Column[] GetColumns()
retVal[3].canSort = true;
retVal[3].autoResize = false;

retVal[4].headerContent = new GUIContent("Type", "Type of asset");
retVal[4].minWidth = 50;
retVal[4].width = 100;
retVal[4].maxWidth = 300;
retVal[4].headerTextAlignment = TextAlignment.Left;
retVal[4].canSort = true;
retVal[4].autoResize = true;
return retVal;
}
enum MyColumns
{
Asset,
Bundle,
Size,
Message
Message,
Type
}
internal enum SortOption
{
Asset,
Bundle,
Size,
Message
Message,
Type
}
SortOption[] m_SortOptions =
{
SortOption.Asset,
SortOption.Bundle,
SortOption.Size,
SortOption.Message
SortOption.Message,
SortOption.Type
};

internal AssetListTree(TreeViewState state, MultiColumnHeaderState mchs, AssetBundleManageTab ctrl ) : base(state, new MultiColumnHeader(mchs))
Expand Down Expand Up @@ -172,6 +183,9 @@ private void CellGUI(Rect cellRect, AssetBundleModel.AssetTreeItem item, int col
GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit);
}
break;
case 4:
DefaultGUI.Label(cellRect, item.asset.fileType, args.selected, args.focused);
break;
}
GUI.color = oldColor;
}
Expand Down Expand Up @@ -432,6 +446,8 @@ void SortByColumn()
return myTypes.Order(l => l.asset.fileSize, ascending);
case SortOption.Message:
return myTypes.Order(l => l.HighestMessageLevel(), ascending);
case SortOption.Type:
return myTypes.Order(l => l.asset.fileType, ascending);
case SortOption.Bundle:
default:
return myTypes.Order(l => l.asset.bundleName, ascending);
Expand Down