init
This commit is contained in:
BIN
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README-IMG.png
vendored
Normal file
BIN
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README-IMG.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
153
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README-IMG.png.meta
vendored
Normal file
153
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README-IMG.png.meta
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d90b9b066363f08419ff51004479d5b7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README.md
vendored
Normal file
82
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README.md
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
# UniTask 扩展
|
||||
|
||||
### 代码示例
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
public class TestTask : MonoBehaviour
|
||||
{
|
||||
private async void Start()
|
||||
{
|
||||
var assetHandle = YooAssets.LoadAssetAsync<GameObject>("UIHome");
|
||||
await assetHandle.ToUniTask();
|
||||
Debug.Log($"{assetHandle.Status}");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 使用教程A
|
||||
|
||||
1. 下载 [UniTask](https://github.com/Cysharp/UniTask) 源码并导入到工程内。
|
||||
|
||||
2. 修改UniTask源码
|
||||
|
||||
UniTask/Runtime/_InternalVisibleTo.cs
|
||||
|
||||
```csharp
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("UniTask.Linq")]
|
||||
[assembly: InternalsVisibleTo("UniTask.Addressables")]
|
||||
[assembly: InternalsVisibleTo("UniTask.DOTween")]
|
||||
[assembly: InternalsVisibleTo("UniTask.TextMeshPro")]
|
||||
[assembly: InternalsVisibleTo("UniTask.YooAsset")] //增加此行代码
|
||||
```
|
||||
|
||||
3. 拷贝YOO提供的扩展脚本到工程内。
|
||||
|
||||
YooAssets/Samples/UniTask Sample/UniTask目录
|
||||
|
||||
4. 添加引擎里的宏定义(在宏定义未生效的情况下)
|
||||
|
||||
Project Settings --> Player --> Scripting Define Symbols
|
||||
|
||||
```
|
||||
UNITASK_YOOASSET_SUPPORT
|
||||
```
|
||||
|
||||
5. 重启Unity引擎
|
||||
|
||||
重新打开工程后用上面的代码示例验证,看下是否有编译错误!
|
||||
|
||||
### 使用教程B
|
||||
|
||||
1. 通过Package导入UniTask插件
|
||||
|
||||
2. 拷贝YOO提供的扩展脚本到工程内。
|
||||
|
||||
YooAssets/Samples/UniTask Sample/UniTask目录
|
||||
|
||||
YooAssets/Samples/UniTask Sample/UniTaskRef目录
|
||||
|
||||
3. 添加引擎里的宏定义(在宏定义未生效的情况下)
|
||||
|
||||
Project Settings --> Player --> Scripting Define Symbols
|
||||
|
||||
```
|
||||
UNITASK_YOOASSET_SUPPORT
|
||||
```
|
||||
|
||||
4. 重启Unity引擎
|
||||
|
||||
重新打开工程后用上面的代码示例验证,看下是否有编译错误!
|
||||
|
||||
### 注意事项
|
||||
|
||||
- 注意检测程序集引用是否丢失
|
||||
|
||||

|
||||
7
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README.md.meta
vendored
Normal file
7
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/README.md.meta
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6375cc739b170490fbc6c38181b2c600
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask.meta
vendored
Normal file
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaf714c0c57134e7ab7675a7528c1505
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask/Runtime.meta
vendored
Normal file
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask/Runtime.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bbb725df946a6f49afbc3ef104fbd8f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask/Runtime/External.meta
vendored
Normal file
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask/Runtime/External.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a06b0036f802a1c48805344cdbdfff1f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask/Runtime/External/YooAsset.meta
vendored
Normal file
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTask/Runtime/External/YooAsset.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a55ef7d1bba14cc982b478d482c4461
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
#if UNITASK_YOOASSET_SUPPORT
|
||||
using System;
|
||||
using YooAsset;
|
||||
using static Cysharp.Threading.Tasks.Internal.Error;
|
||||
|
||||
namespace Cysharp.Threading.Tasks
|
||||
{
|
||||
public static class AsyncOperationBaseExtensions
|
||||
{
|
||||
public static UniTask.Awaiter GetAwaiter(this AsyncOperationBase handle)
|
||||
{
|
||||
return ToUniTask(handle).GetAwaiter();
|
||||
}
|
||||
public static UniTask ToUniTask(this AsyncOperationBase handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update)
|
||||
{
|
||||
ThrowArgumentNullException(handle, nameof(handle));
|
||||
|
||||
if (handle.IsDone)
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
return new UniTask(
|
||||
AsyncOperationBaserConfiguredSource.Create(handle, timing, progress, out var token),
|
||||
token
|
||||
);
|
||||
}
|
||||
|
||||
sealed class AsyncOperationBaserConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationBaserConfiguredSource>
|
||||
{
|
||||
private static TaskPool<AsyncOperationBaserConfiguredSource> _pool;
|
||||
private AsyncOperationBaserConfiguredSource _nextNode;
|
||||
private readonly Action<AsyncOperationBase> _continuationAction;
|
||||
private AsyncOperationBase _handle;
|
||||
private IProgress<float> _progress;
|
||||
private bool _completed;
|
||||
private UniTaskCompletionSourceCore<AsyncUnit> _core;
|
||||
|
||||
public ref AsyncOperationBaserConfiguredSource NextNode => ref _nextNode;
|
||||
|
||||
static AsyncOperationBaserConfiguredSource()
|
||||
{
|
||||
TaskPool.RegisterSizeGetter(typeof(AsyncOperationBaserConfiguredSource), () => _pool.Size);
|
||||
}
|
||||
|
||||
AsyncOperationBaserConfiguredSource() { _continuationAction = Continuation; }
|
||||
|
||||
public static IUniTaskSource Create(AsyncOperationBase handle, PlayerLoopTiming timing, IProgress<float> progress, out short token)
|
||||
{
|
||||
if (!_pool.TryPop(out var result))
|
||||
{
|
||||
result = new AsyncOperationBaserConfiguredSource();
|
||||
}
|
||||
|
||||
result._handle = handle;
|
||||
result._progress = progress;
|
||||
result._completed = false;
|
||||
TaskTracker.TrackActiveTask(result, 3);
|
||||
|
||||
if (progress != null)
|
||||
{
|
||||
PlayerLoopHelper.AddAction(timing, result);
|
||||
}
|
||||
|
||||
handle.Completed += result._continuationAction;
|
||||
token = result._core.Version;
|
||||
return result;
|
||||
}
|
||||
|
||||
private void Continuation(AsyncOperationBase _)
|
||||
{
|
||||
_handle.Completed -= _continuationAction;
|
||||
|
||||
if (_completed)
|
||||
{
|
||||
TryReturn();
|
||||
}
|
||||
else
|
||||
{
|
||||
_completed = true;
|
||||
if (_handle.Status == EOperationStatus.Failed)
|
||||
{
|
||||
_core.TrySetException(new Exception(_handle.Error));
|
||||
}
|
||||
else
|
||||
{
|
||||
_core.TrySetResult(AsyncUnit.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool TryReturn()
|
||||
{
|
||||
TaskTracker.RemoveTracking(this);
|
||||
_core.Reset();
|
||||
_handle = default;
|
||||
_progress = default;
|
||||
return _pool.TryPush(this);
|
||||
}
|
||||
|
||||
public UniTaskStatus GetStatus(short token) => _core.GetStatus(token);
|
||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
||||
{
|
||||
_core.OnCompleted(continuation, state, token);
|
||||
}
|
||||
public void GetResult(short token) { _core.GetResult(token); }
|
||||
public UniTaskStatus UnsafeGetStatus() => _core.UnsafeGetStatus();
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (_completed)
|
||||
{
|
||||
TryReturn();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_handle.IsDone)
|
||||
{
|
||||
_progress?.Report(_handle.Progress);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cceff5ec1f84bd0a6a9b4ed7719527c
|
||||
timeCreated: 1651978895
|
||||
@@ -0,0 +1,221 @@
|
||||
#if UNITASK_YOOASSET_SUPPORT
|
||||
#if UNITY_2020_1_OR_NEWER && ! UNITY_2021
|
||||
#define UNITY_2020_BUG
|
||||
#endif
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using YooAsset;
|
||||
using static Cysharp.Threading.Tasks.Internal.Error;
|
||||
|
||||
namespace Cysharp.Threading.Tasks
|
||||
{
|
||||
public static class HandleBaseExtensions
|
||||
{
|
||||
public static UniTask.Awaiter GetAwaiter(this HandleBase handle)
|
||||
{
|
||||
return ToUniTask(handle).GetAwaiter();
|
||||
}
|
||||
public static UniTask ToUniTask(this HandleBase handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update)
|
||||
{
|
||||
ThrowArgumentNullException(handle, nameof(handle));
|
||||
|
||||
if (!handle.IsValid)
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
return new UniTask(
|
||||
HandleBaserConfiguredSource.Create(handle, timing, progress, out var token),
|
||||
token
|
||||
);
|
||||
}
|
||||
|
||||
sealed class HandleBaserConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<HandleBaserConfiguredSource>
|
||||
{
|
||||
private static TaskPool<HandleBaserConfiguredSource> _pool;
|
||||
private HandleBaserConfiguredSource _nextNode;
|
||||
private readonly Action<HandleBase> _continuationAction;
|
||||
private HandleBase _handle;
|
||||
private IProgress<float> _progress;
|
||||
private bool _completed;
|
||||
private UniTaskCompletionSourceCore<AsyncUnit> _core;
|
||||
|
||||
public ref HandleBaserConfiguredSource NextNode => ref _nextNode;
|
||||
|
||||
static HandleBaserConfiguredSource()
|
||||
{
|
||||
TaskPool.RegisterSizeGetter(typeof(HandleBaserConfiguredSource), () => _pool.Size);
|
||||
}
|
||||
|
||||
HandleBaserConfiguredSource() { _continuationAction = Continuation; }
|
||||
|
||||
public static IUniTaskSource Create(HandleBase handle, PlayerLoopTiming timing, IProgress<float> progress, out short token)
|
||||
{
|
||||
if (!_pool.TryPop(out var result))
|
||||
{
|
||||
result = new HandleBaserConfiguredSource();
|
||||
}
|
||||
|
||||
result._handle = handle;
|
||||
result._progress = progress;
|
||||
result._completed = false;
|
||||
TaskTracker.TrackActiveTask(result, 3);
|
||||
|
||||
if (progress != null)
|
||||
{
|
||||
PlayerLoopHelper.AddAction(timing, result);
|
||||
}
|
||||
|
||||
// BUG 在 Unity 2020.3.36 版本测试中, IL2Cpp 会报 如下错误
|
||||
// BUG ArgumentException: Incompatible Delegate Types. First is System.Action`1[[YooAsset.AssetHandle, YooAsset, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]] second is System.Action`1[[YooAsset.OperationHandleBase, YooAsset, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
|
||||
// BUG 也可能报的是 Action '1' Action '1' 的 InvalidCastException
|
||||
// BUG 此处不得不这么修改, 如果后续 Unity 修复了这个问题, 可以恢复之前的写法
|
||||
#if UNITY_2020_BUG
|
||||
switch (handle)
|
||||
{
|
||||
case AssetHandle asset_handle:
|
||||
asset_handle.Completed += result.AssetContinuation;
|
||||
break;
|
||||
case SceneHandle scene_handle:
|
||||
scene_handle.Completed += result.SceneContinuation;
|
||||
break;
|
||||
case SubAssetsHandle sub_asset_handle:
|
||||
sub_asset_handle.Completed += result.SubContinuation;
|
||||
break;
|
||||
case RawFileHandle raw_file_handle:
|
||||
raw_file_handle.Completed += result.RawFileContinuation;
|
||||
break;
|
||||
case AllAssetsHandle all_assets_handle:
|
||||
all_assets_handle.Completed += result.AllAssetsContinuation;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (handle)
|
||||
{
|
||||
case AssetHandle asset_handle:
|
||||
asset_handle.Completed += result.continuationAction;
|
||||
break;
|
||||
case SceneHandle scene_handle:
|
||||
scene_handle.Completed += result.continuationAction;
|
||||
break;
|
||||
case SubAssetsHandle sub_asset_handle:
|
||||
sub_asset_handle.Completed += result.continuationAction;
|
||||
break;
|
||||
case RawFileHandle raw_file_handle:
|
||||
raw_file_handle.Completed += result.continuationAction;
|
||||
break;
|
||||
case AllAssetsHandle all_assets_handle:
|
||||
all_assets_handle.Completed += result.continuationAction;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
token = result._core.Version;
|
||||
return result;
|
||||
}
|
||||
|
||||
#if UNITY_2020_BUG
|
||||
private void AssetContinuation(AssetHandle handle)
|
||||
{
|
||||
handle.Completed -= AssetContinuation;
|
||||
BaseContinuation();
|
||||
}
|
||||
private void SceneContinuation(SceneHandle handle)
|
||||
{
|
||||
handle.Completed -= SceneContinuation;
|
||||
BaseContinuation();
|
||||
}
|
||||
private void SubContinuation(SubAssetsHandle handle)
|
||||
{
|
||||
handle.Completed -= SubContinuation;
|
||||
BaseContinuation();
|
||||
}
|
||||
private void RawFileContinuation(RawFileHandle handle)
|
||||
{
|
||||
handle.Completed -= RawFileContinuation;
|
||||
BaseContinuation();
|
||||
}
|
||||
private void AllAssetsContinuation(AllAssetsHandle handle)
|
||||
{
|
||||
handle.Completed -= AllAssetsContinuation;
|
||||
BaseContinuation();
|
||||
}
|
||||
#endif
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void BaseContinuation()
|
||||
{
|
||||
if (_completed)
|
||||
{
|
||||
TryReturn();
|
||||
}
|
||||
else
|
||||
{
|
||||
_completed = true;
|
||||
if (_handle.Status == EOperationStatus.Failed)
|
||||
{
|
||||
_core.TrySetException(new Exception(_handle.LastError));
|
||||
}
|
||||
else
|
||||
{
|
||||
_core.TrySetResult(AsyncUnit.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Continuation(HandleBase _)
|
||||
{
|
||||
switch (_handle)
|
||||
{
|
||||
case AssetHandle asset_handle:
|
||||
asset_handle.Completed -= _continuationAction;
|
||||
break;
|
||||
case SceneHandle scene_handle:
|
||||
scene_handle.Completed -= _continuationAction;
|
||||
break;
|
||||
case SubAssetsHandle sub_asset_handle:
|
||||
sub_asset_handle.Completed -= _continuationAction;
|
||||
break;
|
||||
case RawFileHandle raw_file_handle:
|
||||
raw_file_handle.Completed -= _continuationAction;
|
||||
break;
|
||||
case AllAssetsHandle all_assets_handle:
|
||||
all_assets_handle.Completed -= _continuationAction;
|
||||
break;
|
||||
}
|
||||
|
||||
BaseContinuation();
|
||||
}
|
||||
private bool TryReturn()
|
||||
{
|
||||
TaskTracker.RemoveTracking(this);
|
||||
_core.Reset();
|
||||
_handle = default;
|
||||
_progress = default;
|
||||
return _pool.TryPush(this);
|
||||
}
|
||||
|
||||
public UniTaskStatus GetStatus(short token) => _core.GetStatus(token);
|
||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
||||
{
|
||||
_core.OnCompleted(continuation, state, token);
|
||||
}
|
||||
public void GetResult(short token) { _core.GetResult(token); }
|
||||
public UniTaskStatus UnsafeGetStatus() => _core.UnsafeGetStatus();
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (_completed)
|
||||
{
|
||||
TryReturn();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_handle.IsValid)
|
||||
{
|
||||
_progress?.Report(_handle.Progress);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1c9a3a6de2246bf88547a6b59b99b9f
|
||||
timeCreated: 1650851321
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "UniTask.YooAsset",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:e34a5702dd353724aa315fb8011f08c3"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.cysharp.unitask",
|
||||
"expression": "",
|
||||
"define": "UNITASK_YOOASSET_SUPPORT"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1278a46ce459c5a46b4eaeda148684ef
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef.meta
vendored
Normal file
8
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4f000ae8d64e444fa5bf1090b648f76
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/UniTaskRef.asmref
vendored
Normal file
3
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/UniTaskRef.asmref
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"reference": "GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
}
|
||||
7
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/UniTaskRef.asmref.meta
vendored
Normal file
7
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/UniTaskRef.asmref.meta
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb1a9972a41e10f40a752774a402830a
|
||||
AssemblyDefinitionReferenceImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/_InternalVisibleTo.cs
vendored
Normal file
3
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/_InternalVisibleTo.cs
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("UniTask.YooAsset")]
|
||||
11
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/_InternalVisibleTo.cs.meta
vendored
Normal file
11
Assets/ThirdParty/YooAsset/2.3.17/UniTask Sample/UniTaskRef/_InternalVisibleTo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc0f48d84ee89ad499856840eea08a64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user