mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-07-01 19:33:47 +00:00
Compare commits
3 Commits
2.3.9
...
4f62b249b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f62b249b4 | ||
|
|
fe7f9bff08 | ||
|
|
e71077f294 |
@@ -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)
|
||||||
|
|||||||
@@ -34,6 +34,20 @@ namespace YooAsset
|
|||||||
return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test"
|
return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// URL地址是否包含双斜杠
|
||||||
|
/// 注意:只检查协议之后的部分
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasDoubleSlashes(string url)
|
||||||
|
{
|
||||||
|
if (url == null)
|
||||||
|
throw new ArgumentNullException();
|
||||||
|
|
||||||
|
int protocolIndex = url.IndexOf("://");
|
||||||
|
string partToCheck = protocolIndex == -1 ? url : url.Substring(protocolIndex + 3);
|
||||||
|
return partToCheck.Contains("//") || partToCheck.Contains(@"\\");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 合并路径
|
/// 合并路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -75,7 +75,14 @@ namespace YooAsset
|
|||||||
if (_driver != null)
|
if (_driver != null)
|
||||||
GameObject.Destroy(_driver);
|
GameObject.Destroy(_driver);
|
||||||
|
|
||||||
OnApplicationQuit(true);
|
// 终止并清空所有包裹的异步操作
|
||||||
|
ClearAllPackageOperation();
|
||||||
|
|
||||||
|
// 卸载所有AssetBundle
|
||||||
|
AssetBundle.UnloadAllAssetBundles(true);
|
||||||
|
|
||||||
|
// 清空资源包裹列表
|
||||||
|
_packages.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,25 +98,15 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用程序退出处理
|
/// 终止并清空所有包裹的异步操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static void OnApplicationQuit(bool unloadAllAssetBundles)
|
internal static void ClearAllPackageOperation()
|
||||||
{
|
{
|
||||||
// 说明:在编辑器下确保播放被停止时IO类操作被终止。
|
|
||||||
foreach (var package in _packages)
|
foreach (var package in _packages)
|
||||||
{
|
{
|
||||||
OperationSystem.ClearPackageOperation(package.PackageName);
|
OperationSystem.ClearPackageOperation(package.PackageName);
|
||||||
}
|
}
|
||||||
OperationSystem.DestroyAll();
|
OperationSystem.DestroyAll();
|
||||||
|
|
||||||
// 清空资源包裹列表
|
|
||||||
_packages.Clear();
|
|
||||||
|
|
||||||
// 卸载所有AssetBundle
|
|
||||||
if (unloadAllAssetBundles)
|
|
||||||
{
|
|
||||||
AssetBundle.UnloadAllAssetBundles(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ namespace YooAsset
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
void OnApplicationQuit()
|
void OnApplicationQuit()
|
||||||
{
|
{
|
||||||
YooAssets.OnApplicationQuit(false);
|
// 说明:在编辑器下确保播放被停止时IO类操作被终止。
|
||||||
|
YooAssets.ClearAllPackageOperation();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,15 @@ internal class WechatFileSystem : IFileSystem
|
|||||||
RemoteServices = new WebRemoteServices(webRoot);
|
RemoteServices = new WebRemoteServices(webRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查URL双斜杠
|
||||||
|
// 注意:双斜杠会导致微信插件加载文件失败,但网络请求又不返回失败!
|
||||||
|
{
|
||||||
|
var mainURL = RemoteServices.GetRemoteMainURL("test.bundle");
|
||||||
|
var fallbackURL = RemoteServices.GetRemoteFallbackURL("test.bundle");
|
||||||
|
if (PathUtility.HasDoubleSlashes(mainURL) || PathUtility.HasDoubleSlashes(fallbackURL))
|
||||||
|
throw new Exception($"{nameof(RemoteServices)} returned URL contains double slashes. !");
|
||||||
|
}
|
||||||
|
|
||||||
_fileSystemMgr = WX.GetFileSystemManager();
|
_fileSystemMgr = WX.GetFileSystemManager();
|
||||||
}
|
}
|
||||||
public virtual void OnDestroy()
|
public virtual void OnDestroy()
|
||||||
|
|||||||
Reference in New Issue
Block a user