mirror of https://github.com/tuyoogame/YooAsset
parent
fe7f9bff08
commit
4f62b249b4
|
@ -196,6 +196,32 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导入单个报告对象
|
||||||
|
/// </summary>
|
||||||
|
public void ImportSingleReprotFile(ScanReport report)
|
||||||
|
{
|
||||||
|
_reportCombiner = new ScanReportCombiner();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_reportCombiner.Combine(report);
|
||||||
|
|
||||||
|
// 刷新页面
|
||||||
|
RefreshToolbar();
|
||||||
|
FillTableView();
|
||||||
|
RebuildView();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
_reportCombiner = null;
|
||||||
|
_titleLabel.text = "导入报告失败!";
|
||||||
|
_descLabel.text = e.Message;
|
||||||
|
UnityEngine.Debug.LogError(e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ImportSingleBtn_clicked()
|
private void ImportSingleBtn_clicked()
|
||||||
{
|
{
|
||||||
string selectFilePath = EditorUtility.OpenFilePanel("导入报告", _lastestOpenFolder, "json");
|
string selectFilePath = EditorUtility.OpenFilePanel("导入报告", _lastestOpenFolder, "json");
|
||||||
|
@ -446,15 +472,31 @@ namespace YooAsset.Editor
|
||||||
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
|
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
|
||||||
column.MakeCell = () =>
|
column.MakeCell = () =>
|
||||||
{
|
{
|
||||||
var label = new Label();
|
if (header.HeaderType == EHeaderType.AssetObject)
|
||||||
label.style.marginLeft = 3f;
|
{
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
var objectFiled = new ObjectField();
|
||||||
return label;
|
return objectFiled;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.style.marginLeft = 3f;
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
return label;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||||
{
|
{
|
||||||
var infoLabel = element as Label;
|
if (header.HeaderType == EHeaderType.AssetObject)
|
||||||
infoLabel.text = (string)cell.GetDisplayObject();
|
{
|
||||||
|
var objectFiled = element as ObjectField;
|
||||||
|
objectFiled.value = (UnityEngine.Object)cell.GetDisplayObject();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var infoLabel = element as Label;
|
||||||
|
infoLabel.text = (string)cell.GetDisplayObject();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
_elementTableView.AddColumn(column);
|
_elementTableView.AddColumn(column);
|
||||||
}
|
}
|
||||||
|
@ -480,6 +522,10 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
tableData.AddAssetPathCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
|
tableData.AddAssetPathCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
|
||||||
}
|
}
|
||||||
|
else if (header.HeaderType == EHeaderType.AssetObject)
|
||||||
|
{
|
||||||
|
tableData.AddAssetObjectCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
|
||||||
|
}
|
||||||
else if (header.HeaderType == EHeaderType.StringValue)
|
else if (header.HeaderType == EHeaderType.StringValue)
|
||||||
{
|
{
|
||||||
tableData.AddStringValueCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
|
tableData.AddStringValueCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
|
||||||
|
|
|
@ -8,6 +8,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AssetPath,
|
AssetPath,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源对象
|
||||||
|
/// </summary>
|
||||||
|
AssetObject,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字符串
|
/// 字符串
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -126,6 +126,12 @@ namespace YooAsset.Editor
|
||||||
if (string.IsNullOrEmpty(guid))
|
if (string.IsNullOrEmpty(guid))
|
||||||
throw new Exception($"{HeaderTitle} value is invalid asset path : {value}");
|
throw new Exception($"{HeaderTitle} value is invalid asset path : {value}");
|
||||||
}
|
}
|
||||||
|
else if (HeaderType == EHeaderType.AssetObject)
|
||||||
|
{
|
||||||
|
string guid = AssetDatabase.AssetPathToGUID(value);
|
||||||
|
if (string.IsNullOrEmpty(guid))
|
||||||
|
throw new Exception($"{HeaderTitle} value is invalid asset object : {value}");
|
||||||
|
}
|
||||||
else if (HeaderType == EHeaderType.DoubleValue)
|
else if (HeaderType == EHeaderType.DoubleValue)
|
||||||
{
|
{
|
||||||
if (double.TryParse(value, out double doubleValue) == false)
|
if (double.TryParse(value, out double doubleValue) == false)
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ScannerResult(e.Message);
|
return new ScannerResult(e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace YooAsset.Editor
|
||||||
if (Succeed)
|
if (Succeed)
|
||||||
{
|
{
|
||||||
var reproterWindow = AssetArtReporterWindow.OpenWindow();
|
var reproterWindow = AssetArtReporterWindow.OpenWindow();
|
||||||
reproterWindow.ImportSingleReprotFile(ReprotFilePath);
|
reproterWindow.ImportSingleReprotFile(Report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#if UNITY_2019_4_OR_NEWER
|
||||||
|
using UnityEditor;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class AssetObjectCell : ITableCell, IComparable
|
||||||
|
{
|
||||||
|
public string SearchTag { private set; get; }
|
||||||
|
public object CellValue { set; get; }
|
||||||
|
public string StringValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (string)CellValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssetObjectCell(string searchTag, string assetPath)
|
||||||
|
{
|
||||||
|
SearchTag = searchTag;
|
||||||
|
CellValue = assetPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object GetDisplayObject()
|
||||||
|
{
|
||||||
|
return AssetDatabase.LoadMainAssetAtPath(StringValue);
|
||||||
|
}
|
||||||
|
public int CompareTo(object other)
|
||||||
|
{
|
||||||
|
if (other is AssetObjectCell cell)
|
||||||
|
{
|
||||||
|
return this.StringValue.CompareTo(cell.StringValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 39db4a569a0f69443a7675e19c99c389
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -31,9 +31,14 @@ namespace YooAsset.Editor
|
||||||
var cell = new ButtonCell(searchTag);
|
var cell = new ButtonCell(searchTag);
|
||||||
Cells.Add(cell);
|
Cells.Add(cell);
|
||||||
}
|
}
|
||||||
public void AddAssetPathCell(string searchTag, string path)
|
public void AddAssetPathCell(string searchTag, string assetPath)
|
||||||
{
|
{
|
||||||
var cell = new AssetPathCell(searchTag, path);
|
var cell = new AssetPathCell(searchTag, assetPath);
|
||||||
|
Cells.Add(cell);
|
||||||
|
}
|
||||||
|
public void AddAssetObjectCell(string searchTag, string assetPath)
|
||||||
|
{
|
||||||
|
var cell = new AssetObjectCell(searchTag, assetPath);
|
||||||
Cells.Add(cell);
|
Cells.Add(cell);
|
||||||
}
|
}
|
||||||
public void AddStringValueCell(string searchTag, string value)
|
public void AddStringValueCell(string searchTag, string value)
|
||||||
|
|
Loading…
Reference in New Issue