mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
释放资源判断资源是否有效、支持YooAssets日志重定向
释放资源判断资源是否有效、支持YooAssets日志重定向
This commit is contained in:
@@ -62,7 +62,7 @@ namespace TEngine
|
|||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
if (_operationHandle != null)
|
if (_operationHandle is { IsValid: true })
|
||||||
{
|
{
|
||||||
_operationHandle.Release();
|
_operationHandle.Release();
|
||||||
_operationHandle = null;
|
_operationHandle = null;
|
||||||
|
@@ -0,0 +1,28 @@
|
|||||||
|
namespace TEngine
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 资源管理日志实现器。
|
||||||
|
/// </summary>
|
||||||
|
internal class AssetsLogger : YooAsset.ILogger
|
||||||
|
{
|
||||||
|
public void Log(string message)
|
||||||
|
{
|
||||||
|
TEngine.Log.Info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Warning(string message)
|
||||||
|
{
|
||||||
|
TEngine.Log.Warning(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Error(string message)
|
||||||
|
{
|
||||||
|
TEngine.Log.Error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Exception(System.Exception exception)
|
||||||
|
{
|
||||||
|
TEngine.Log.Fatal(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fb010b07ce0e492dae9f04e18a1af2e2
|
||||||
|
timeCreated: 1698250627
|
@@ -2,7 +2,6 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using YooAsset;
|
using YooAsset;
|
||||||
|
|
||||||
namespace TEngine
|
namespace TEngine
|
||||||
@@ -369,7 +368,7 @@ namespace TEngine
|
|||||||
while (iter.MoveNext())
|
while (iter.MoveNext())
|
||||||
{
|
{
|
||||||
AssetOperationHandle handle = iter.Current;
|
AssetOperationHandle handle = iter.Current;
|
||||||
if (handle != null)
|
if (handle is { IsValid: true })
|
||||||
{
|
{
|
||||||
handle.Dispose();
|
handle.Dispose();
|
||||||
handle = null;
|
handle = null;
|
||||||
@@ -882,30 +881,4 @@ namespace TEngine
|
|||||||
return cancelOrFailed ? null : handle.GetSubAssetObjects<T>();
|
return cancelOrFailed ? null : handle.GetSubAssetObjects<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 资源管理日志实现器。
|
|
||||||
/// </summary>
|
|
||||||
internal class AssetsLogger : YooAsset.ILogger
|
|
||||||
{
|
|
||||||
public void Log(string message)
|
|
||||||
{
|
|
||||||
TEngine.Log.Info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Warning(string message)
|
|
||||||
{
|
|
||||||
TEngine.Log.Warning(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Error(string message)
|
|
||||||
{
|
|
||||||
TEngine.Log.Error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Exception(System.Exception exception)
|
|
||||||
{
|
|
||||||
TEngine.Log.Fatal(exception.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user