mirror of https://github.com/tuyoogame/YooAsset
Update AssetSystem
parent
873d873194
commit
8d02406211
|
@ -23,7 +23,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
throw new System.Exception($"{nameof(AssetOperationHandle)} is invalid");
|
||||
if (_provider.IsDone)
|
||||
if (Provider.IsDone)
|
||||
value.Invoke(this);
|
||||
else
|
||||
_callback += value;
|
||||
|
@ -45,7 +45,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return null;
|
||||
return _provider.AssetObject;
|
||||
return Provider.AssetObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return;
|
||||
_provider.WaitForAsyncComplete();
|
||||
Provider.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -114,22 +114,22 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return null;
|
||||
if (_provider.AssetObject == null)
|
||||
if (Provider.AssetObject == null)
|
||||
return null;
|
||||
|
||||
if (setPositionRotation)
|
||||
{
|
||||
if (parent == null)
|
||||
return UnityEngine.Object.Instantiate(_provider.AssetObject as GameObject, position, rotation);
|
||||
return UnityEngine.Object.Instantiate(Provider.AssetObject as GameObject, position, rotation);
|
||||
else
|
||||
return UnityEngine.Object.Instantiate(_provider.AssetObject as GameObject, position, rotation, parent);
|
||||
return UnityEngine.Object.Instantiate(Provider.AssetObject as GameObject, position, rotation, parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parent == null)
|
||||
return UnityEngine.Object.Instantiate(_provider.AssetObject as GameObject);
|
||||
return UnityEngine.Object.Instantiate(Provider.AssetObject as GameObject);
|
||||
else
|
||||
return UnityEngine.Object.Instantiate(_provider.AssetObject as GameObject, parent);
|
||||
return UnityEngine.Object.Instantiate(Provider.AssetObject as GameObject, parent);
|
||||
}
|
||||
}
|
||||
private InstantiateOperation InstantiateAsyncInternal(Vector3 position, Quaternion rotation, Transform parent, bool setPositionRotation)
|
||||
|
|
|
@ -5,11 +5,11 @@ namespace YooAsset
|
|||
public abstract class OperationHandleBase : IEnumerator
|
||||
{
|
||||
private readonly string _cachedAssetPath;
|
||||
internal ProviderBase _provider { private set; get; }
|
||||
internal ProviderBase Provider { private set; get; }
|
||||
|
||||
internal OperationHandleBase(ProviderBase provider)
|
||||
{
|
||||
_provider = provider;
|
||||
Provider = provider;
|
||||
_cachedAssetPath = provider.AssetPath;
|
||||
}
|
||||
internal abstract void InvokeCallback();
|
||||
|
@ -23,9 +23,9 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return EOperationStatus.None;
|
||||
if (_provider.Status == ProviderBase.EStatus.Fail)
|
||||
if (Provider.Status == ProviderBase.EStatus.Fail)
|
||||
return EOperationStatus.Failed;
|
||||
else if (_provider.Status == ProviderBase.EStatus.Success)
|
||||
else if (Provider.Status == ProviderBase.EStatus.Success)
|
||||
return EOperationStatus.Succeed;
|
||||
else
|
||||
return EOperationStatus.None;
|
||||
|
@ -41,7 +41,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return string.Empty;
|
||||
return _provider.LastError;
|
||||
return Provider.LastError;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return 0;
|
||||
return _provider.Progress;
|
||||
return Provider.Progress;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return false;
|
||||
return _provider.IsDone;
|
||||
return Provider.IsDone;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,15 +78,15 @@ namespace YooAsset
|
|||
{
|
||||
get
|
||||
{
|
||||
if (_provider != null && _provider.IsDestroyed == false)
|
||||
if (Provider != null && Provider.IsDestroyed == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_provider == null)
|
||||
if (Provider == null)
|
||||
YooLogger.Warning($"Operation handle is released : {_cachedAssetPath}");
|
||||
else if (_provider.IsDestroyed)
|
||||
else if (Provider.IsDestroyed)
|
||||
YooLogger.Warning($"Provider is destroyed : {_cachedAssetPath}");
|
||||
return false;
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return;
|
||||
_provider.ReleaseHandle(this);
|
||||
_provider = null;
|
||||
Provider.ReleaseHandle(this);
|
||||
Provider = null;
|
||||
}
|
||||
|
||||
#region 异步操作相关
|
||||
|
@ -110,7 +110,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public System.Threading.Tasks.Task Task
|
||||
{
|
||||
get { return _provider.Task; }
|
||||
get { return Provider.Task; }
|
||||
}
|
||||
|
||||
// 协程相关
|
||||
|
@ -123,7 +123,7 @@ namespace YooAsset
|
|||
}
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get { return _provider; }
|
||||
get { return Provider; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
throw new System.Exception($"{nameof(SceneOperationHandle)} is invalid");
|
||||
if (_provider.IsDone)
|
||||
if (Provider.IsDone)
|
||||
value.Invoke(this);
|
||||
else
|
||||
_callback += value;
|
||||
|
@ -45,7 +45,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return new Scene();
|
||||
return _provider.SceneObject;
|
||||
return Provider.SceneObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,14 +76,14 @@ namespace YooAsset
|
|||
if (IsValid == false)
|
||||
return false;
|
||||
|
||||
if (_provider is DatabaseSceneProvider)
|
||||
if (Provider is DatabaseSceneProvider)
|
||||
{
|
||||
var temp = _provider as DatabaseSceneProvider;
|
||||
var temp = Provider as DatabaseSceneProvider;
|
||||
return temp.SceneMode == LoadSceneMode.Single;
|
||||
}
|
||||
else if (_provider is BundledSceneProvider)
|
||||
else if (Provider is BundledSceneProvider)
|
||||
{
|
||||
var temp = _provider as BundledSceneProvider;
|
||||
var temp = Provider as BundledSceneProvider;
|
||||
return temp.SceneMode == LoadSceneMode.Single;
|
||||
}
|
||||
else
|
||||
|
@ -118,7 +118,7 @@ namespace YooAsset
|
|||
|
||||
// 卸载子场景
|
||||
Scene sceneObject = SceneObject;
|
||||
AssetSystem.UnloadSubScene(_provider);
|
||||
AssetSystem.UnloadSubScene(Provider);
|
||||
{
|
||||
var operation = new UnloadSceneOperation(sceneObject);
|
||||
OperationSystem.ProcessOperaiton(operation);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
throw new System.Exception($"{nameof(SubAssetsOperationHandle)} is invalid");
|
||||
if (_provider.IsDone)
|
||||
if (Provider.IsDone)
|
||||
value.Invoke(this);
|
||||
else
|
||||
_callback += value;
|
||||
|
@ -44,7 +44,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return null;
|
||||
return _provider.AllAssetObjects;
|
||||
return Provider.AllAssetObjects;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace YooAsset
|
|||
{
|
||||
if (IsValid == false)
|
||||
return;
|
||||
_provider.WaitForAsyncComplete();
|
||||
Provider.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -77,7 +77,7 @@ namespace YooAsset
|
|||
if (IsValid == false)
|
||||
return null;
|
||||
|
||||
foreach (var asset in _provider.AllAssetObjects)
|
||||
foreach (var asset in Provider.AllAssetObjects)
|
||||
{
|
||||
if (asset.name == assetName)
|
||||
return asset as TObject;
|
||||
|
|
Loading…
Reference in New Issue