UNITASK_ASSETBUNDLE_SUPPORT #131

pull/132/head
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, "autoReferenced": true,
"defineConstraints": [], "defineConstraints": [],
"versionDefines": [ "versionDefines": [
{
"name": "com.unity.modules.assetbundle",
"expression": "",
"define": "UNITASK_ASSETBUNDLE_SUPPORT"
}
], ],
"noEngineReferences": false "noEngineReferences": false
} }

View File

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

View File

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

View File

@ -17,6 +17,7 @@
Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>"; Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>";
Func<string, string> ToIUniTaskSourceReturnType = x => (x == "void") ? "IUniTaskSource" : $"IUniTaskSource<{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> 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"; 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 #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) { #> <# foreach(var t in types) { #>
<# if(IsUnityWebRequest(t)) { #> <# if(IsUnityWebRequest(t)) { #>
#if ENABLE_UNITYWEBREQUEST #if ENABLE_UNITYWEBREQUEST
<# } else if(IsAssetBundleModule(t)) { #>
#if UNITASK_ASSETBUNDLE_SUPPORT
<# } #> <# } #>
#region <#= t.typeName #> #region <#= t.typeName #>
@ -422,7 +425,7 @@ namespace Cysharp.Threading.Tasks
} }
#endregion #endregion
<# if(IsUnityWebRequest(t)) { #> <# if(IsUnityWebRequest(t) || IsAssetBundleModule(t)) { #>
#endif #endif
<# } #> <# } #>