Skip to content

Commit

Permalink
feat: Remove redundant icons
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarianZ committed Oct 7, 2024
1 parent 65129de commit 19d738f
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions Editor/Scripts/AssetQuickAccessWindow.ListContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace GBG.AssetQuickAccess.Editor
public partial class AssetQuickAccessWindow
{
private const float AssetIconSize = 24f;
private const float CategoryIconSize = 16f;
private const double DoubleClickInterval = 0.4f;

private ReorderableList _assetList;
Expand Down Expand Up @@ -69,42 +68,31 @@ private void DrawAssetListItem(Rect rect, int index, bool isActive, bool isFocus
AssetHandle assetHandle = _filteredAssetHandles[index];
// string categoryIconTooltip;
Texture assetIconTex;
Texture categoryIconTex;
switch (assetHandle.Category)
{
case AssetCategory.ProjectAsset:
assetIconTex = TextureUtility.GetObjectIcon(assetHandle);
categoryIconTex = null;
// categoryIconTooltip = null;
break;

case AssetCategory.SceneObject:
assetIconTex = TextureUtility.GetObjectIcon(assetHandle);
categoryIconTex = TextureUtility.GetSceneObjectTexture(true);
// categoryIconTooltip = "Scene Object";
break;

case AssetCategory.ExternalFile:
string path = assetHandle.GetAssetPath();
assetIconTex = File.Exists(path) || Directory.Exists(path)
? TextureUtility.GetExternalFileTexture(false)
: TextureUtility.GetWarningTexture();
categoryIconTex = TextureUtility.GetExternalFileTexture(true);
// categoryIconTooltip = "External File of Folder";
break;

case AssetCategory.Url:
// string url = assetHandle.GetAssetPath();
assetIconTex = TextureUtility.GetUrlTexture();
categoryIconTex = assetIconTex;
// categoryIconTooltip = "URL";
break;

case AssetCategory.MenuItem:
// string url = assetHandle.GetAssetPath();
assetIconTex = TextureUtility.GetMenuItemTexture();
categoryIconTex = assetIconTex;
// categoryIconTooltip = "MenuItem";
break;

default:
Expand Down Expand Up @@ -141,9 +129,7 @@ private void DrawAssetListItem(Rect rect, int index, bool isActive, bool isFocus
{
x = rect.x + AssetIconSize,
y = rect.y,
width = categoryIconTex
? rect.width - AssetIconSize - CategoryIconSize - 2 // Margin right: 2
: rect.width - AssetIconSize,
width = rect.width - AssetIconSize,
height = rect.height
};
if (_assetItemStyle == null)
Expand All @@ -167,23 +153,6 @@ private void DrawAssetListItem(Rect rect, int index, bool isActive, bool isFocus
}

#endregion


#region Category icon

if (categoryIconTex)
{
Rect categoryIconRect = new Rect
{
x = rect.xMax - CategoryIconSize,
y = rect.y + (rect.height - CategoryIconSize) / 2f,
width = CategoryIconSize,
height = CategoryIconSize
};
GUI.DrawTexture(categoryIconRect, categoryIconTex);
}

#endregion
}
}

Expand Down

0 comments on commit 19d738f

Please sign in to comment.