UNITASK_ASSETBUNDLE_SUPPORT #131

master
neuecc 2020-08-13 16:33:32 +09:00
parent 6ec0ed8d61
commit a72ceeba11
4 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,11 @@
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.modules.assetbundle",
"expression": "",
"define": "UNITASK_ASSETBUNDLE_SUPPORT"
}
],
"noEngineReferences": false
}

View File

@ -1,6 +1,7 @@
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#if UNITY_2018_4 || UNITY_2019_4_OR_NEWER
#if UNITASK_ASSETBUNDLE_SUPPORT
using Cysharp.Threading.Tasks.Internal;
using System;
@ -313,3 +314,4 @@ namespace Cysharp.Threading.Tasks
}
#endif
#endif

View File

@ -605,6 +605,7 @@ namespace Cysharp.Threading.Tasks
#endregion
#if UNITASK_ASSETBUNDLE_SUPPORT
#region AssetBundleRequest
public static AssetBundleRequestAwaiter GetAwaiter(this AssetBundleRequest asyncOperation)
@ -906,7 +907,9 @@ namespace Cysharp.Threading.Tasks
}
#endregion
#endif
#if UNITASK_ASSETBUNDLE_SUPPORT
#region AssetBundleCreateRequest
public static AssetBundleCreateRequestAwaiter GetAwaiter(this AssetBundleCreateRequest asyncOperation)
@ -1208,6 +1211,7 @@ namespace Cysharp.Threading.Tasks
}
#endregion
#endif
#if ENABLE_UNITYWEBREQUEST
#region UnityWebRequestAsyncOperation

View File

@ -17,6 +17,7 @@
Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>";
Func<string, string> ToIUniTaskSourceReturnType = x => (x == "void") ? "IUniTaskSource" : $"IUniTaskSource<{x}>";
Func<(string typeName, string returnType, string returnField), bool> IsUnityWebRequest = x => x.returnType == "UnityWebRequest";
Func<(string typeName, string returnType, string returnField), bool> IsAssetBundleModule = x => x.typeName == "AssetBundleRequest" || x.typeName == "AssetBundleCreateRequest";
Func<(string typeName, string returnType, string returnField), bool> IsVoid = x => x.returnType == "void";
#>
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
@ -37,6 +38,8 @@ namespace Cysharp.Threading.Tasks
<# foreach(var t in types) { #>
<# if(IsUnityWebRequest(t)) { #>
#if ENABLE_UNITYWEBREQUEST
<# } else if(IsAssetBundleModule(t)) { #>
#if UNITASK_ASSETBUNDLE_SUPPORT
<# } #>
#region <#= t.typeName #>
@ -422,7 +425,7 @@ namespace Cysharp.Threading.Tasks
}
#endregion
<# if(IsUnityWebRequest(t)) { #>
<# if(IsUnityWebRequest(t) || IsAssetBundleModule(t)) { #>
#endif
<# } #>