mirror of https://github.com/tuyoogame/YooAsset
fix #410
parent
8944ec0e02
commit
75dd3d0e5e
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public sealed class AllAssetsHandle : HandleBase, IDisposable
|
public sealed class AllAssetsHandle : HandleBase
|
||||||
{
|
{
|
||||||
private System.Action<AllAssetsHandle> _callback;
|
private System.Action<AllAssetsHandle> _callback;
|
||||||
|
|
||||||
|
@ -47,23 +46,6 @@ namespace YooAsset
|
||||||
Provider.WaitForAsyncComplete();
|
Provider.WaitForAsyncComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Release()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子资源对象集合
|
/// 子资源对象集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public sealed class AssetHandle : HandleBase, IDisposable
|
public sealed class AssetHandle : HandleBase
|
||||||
{
|
{
|
||||||
private System.Action<AssetHandle> _callback;
|
private System.Action<AssetHandle> _callback;
|
||||||
|
|
||||||
|
@ -48,22 +46,6 @@ namespace YooAsset
|
||||||
Provider.WaitForAsyncComplete();
|
Provider.WaitForAsyncComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Release()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源对象
|
/// 资源对象
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public abstract class HandleBase : IEnumerator
|
public abstract class HandleBase : IEnumerator, IDisposable
|
||||||
{
|
{
|
||||||
private readonly AssetInfo _assetInfo;
|
private readonly AssetInfo _assetInfo;
|
||||||
internal ProviderOperation Provider { private set; get; }
|
internal ProviderOperation Provider { private set; get; }
|
||||||
|
@ -15,6 +15,25 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
internal abstract void InvokeCallback();
|
internal abstract void InvokeCallback();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void Release()
|
||||||
|
{
|
||||||
|
if (IsValidWithWarning == false)
|
||||||
|
return;
|
||||||
|
Provider.ReleaseHandle(this);
|
||||||
|
Provider = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.Release();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源信息
|
/// 获取资源信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -121,17 +140,6 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放句柄
|
|
||||||
/// </summary>
|
|
||||||
internal void ReleaseInternal()
|
|
||||||
{
|
|
||||||
if (IsValidWithWarning == false)
|
|
||||||
return;
|
|
||||||
Provider.ReleaseHandle(this);
|
|
||||||
Provider = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 异步操作相关
|
#region 异步操作相关
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步操作任务
|
/// 异步操作任务
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public class RawFileHandle : HandleBase, IDisposable
|
public class RawFileHandle : HandleBase
|
||||||
{
|
{
|
||||||
private System.Action<RawFileHandle> _callback;
|
private System.Action<RawFileHandle> _callback;
|
||||||
|
|
||||||
|
@ -48,22 +45,6 @@ namespace YooAsset
|
||||||
Provider.WaitForAsyncComplete();
|
Provider.WaitForAsyncComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Release()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取原生文件的二进制数据
|
/// 获取原生文件的二进制数据
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public sealed class SubAssetsHandle : HandleBase, IDisposable
|
public sealed class SubAssetsHandle : HandleBase
|
||||||
{
|
{
|
||||||
private System.Action<SubAssetsHandle> _callback;
|
private System.Action<SubAssetsHandle> _callback;
|
||||||
|
|
||||||
|
@ -47,22 +46,6 @@ namespace YooAsset
|
||||||
Provider.WaitForAsyncComplete();
|
Provider.WaitForAsyncComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Release()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
this.ReleaseInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子资源对象集合
|
/// 子资源对象集合
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace YooAsset
|
||||||
for (int i = _handles.Count - 1; i >= 0; i--)
|
for (int i = _handles.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var handle = _handles[i];
|
var handle = _handles[i];
|
||||||
handle.ReleaseInternal();
|
handle.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (sceneHandle.SceneObject == scene)
|
if (sceneHandle.SceneObject == scene)
|
||||||
{
|
{
|
||||||
sceneHandle.ReleaseInternal();
|
sceneHandle.Release();
|
||||||
removeList.Add(sceneHandle);
|
removeList.Add(sceneHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue