private void CellGUI(Rect cellRect, AssetBundleModel.AssetTreeItem item, int column, ref RowGUIArgs args) { Color oldColor = GUI.color; CenterRectUsingSingleLineHeight(ref cellRect); if (column != 3) { GUI.color = item.itemColor; } switch (column) { case (int)SortOption.Asset: { var iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); if (item.icon != null) { GUI.DrawTexture(iconRect, item.icon, ScaleMode.ScaleToFit); } DefaultGUI.Label( new Rect(cellRect.x + iconRect.xMax + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height), item.displayName, args.selected, args.focused); } break; case (int)SortOption.Bundle: DefaultGUI.Label(cellRect, item.asset.bundleName, args.selected, args.focused); break; case (int)SortOption.AssetType: { string tempType = item.asset.assetType.ToString(); tempType = tempType.Substring(tempType.LastIndexOf('.') + 1); DefaultGUI.Label(cellRect, tempType, args.selected, args.focused); } break; case (int)SortOption.Size: DefaultGUI.Label(cellRect, item.asset.GetSizeString(), args.selected, args.focused); break; case (int)SortOption.Message: var icon = item.MessageIcon(); if (icon != null) { var iconRect = new Rect(cellRect.x, cellRect.y, cellRect.height, cellRect.height); GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); } break; case (int)SortOption.USize: DefaultGUI.Label(cellRect, item.asset.GetUSizeString(), args.selected, args.focused); break; } GUI.color = oldColor; }
private void CellGUI(Rect cellRect, AssetBundleModel.AssetTreeItem item, int column, ref RowGUIArgs args) { Color oldColor = GUI.color; CenterRectUsingSingleLineHeight(ref cellRect); if (column != 3) { GUI.color = item.itemColor; } switch (column) { case 0: { var iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); if (item.icon != null) { GUI.DrawTexture(iconRect, item.icon, ScaleMode.ScaleToFit); } DefaultGUI.Label( new Rect(cellRect.x + iconRect.xMax + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height), item.displayName, args.selected, args.focused); } break; case 1: DefaultGUI.Label(cellRect, item.asset.bundleName, args.selected, args.focused); break; case 2: DefaultGUI.Label(cellRect, item.asset.GetSizeString(), args.selected, args.focused); break; case 3: var icon = item.MessageIcon(); if (icon != null) { var iconRect = new Rect(cellRect.x, cellRect.y, cellRect.height, cellRect.height); GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); } break; case 4: if (item.asset.isSameName) { DefaultGUI.Label(cellRect, "同名", args.selected, args.focused); } else { DefaultGUI.Label(cellRect, "", args.selected, args.focused); } break; } GUI.color = oldColor; }