-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Better.Extensions.Runtime.Helpers; | ||
using UnityEngine; | ||
|
||
namespace Better.Extensions.Runtime | ||
{ | ||
public static class AssetBundleRequestAwaiterExtensions | ||
{ | ||
public static AssetBundleRequestAwaiter GetAwaiter(this AssetBundleRequest self) | ||
{ | ||
if (self == null) | ||
{ | ||
throw new ArgumentNullException(nameof(self)); | ||
} | ||
|
||
return new AssetBundleRequestAwaiter(self); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Better.Extensions.Runtime.Helpers; | ||
using UnityEngine; | ||
|
||
namespace Better.Extensions.Runtime | ||
{ | ||
public static class AsyncOperationAwaiterExtensions | ||
{ | ||
public static AsyncOperationAwaiter GetAwaiter(this AsyncOperation self) | ||
{ | ||
if (self == null) | ||
{ | ||
throw new ArgumentNullException(nameof(self)); | ||
} | ||
|
||
return new AsyncOperationAwaiter(self); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Better.Extensions.Runtime.Helpers; | ||
using UnityEngine; | ||
|
||
namespace Better.Extensions.Runtime | ||
{ | ||
public static class ResourceRequestAwaiterExtensions | ||
{ | ||
public static ResourceRequestAwaiter GetAwaiter(this ResourceRequest self) | ||
{ | ||
if (self == null) | ||
{ | ||
throw new ArgumentNullException(nameof(self)); | ||
} | ||
|
||
return new ResourceRequestAwaiter(self); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Better.Extensions.Runtime.Helpers; | ||
using UnityEngine.Networking; | ||
|
||
namespace Better.Extensions.Runtime | ||
{ | ||
public static class UnityWebRequestAsyncOperationExtensions | ||
{ | ||
public static UnityWebRequestAwaiter GetAwaiter(this UnityWebRequestAsyncOperation self) | ||
{ | ||
if (self == null) | ||
{ | ||
throw new ArgumentNullException(nameof(self)); | ||
} | ||
|
||
return new UnityWebRequestAwaiter(self); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
using Object = UnityEngine.Object; | ||
|
||
namespace Better.Extensions.Runtime.Helpers | ||
{ | ||
[DebuggerNonUserCode] | ||
public readonly struct AssetBundleRequestAwaiter : INotifyCompletion | ||
{ | ||
private readonly AssetBundleRequest _asyncOperation; | ||
public bool IsCompleted => _asyncOperation.isDone; | ||
|
||
public AssetBundleRequestAwaiter(AssetBundleRequest asyncOperation) | ||
{ | ||
_asyncOperation = asyncOperation; | ||
} | ||
|
||
public void OnCompleted(Action continuation) | ||
{ | ||
_asyncOperation.completed += _ => continuation(); | ||
} | ||
|
||
public Object GetResult() | ||
{ | ||
return _asyncOperation.asset; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
|
||
namespace Better.Extensions.Runtime.Helpers | ||
{ | ||
[DebuggerNonUserCode] | ||
public readonly struct AsyncOperationAwaiter : INotifyCompletion | ||
{ | ||
private readonly AsyncOperation _asyncOperation; | ||
public bool IsCompleted => _asyncOperation.isDone; | ||
|
||
public AsyncOperationAwaiter(AsyncOperation asyncOperation) | ||
{ | ||
_asyncOperation = asyncOperation; | ||
} | ||
|
||
public void OnCompleted(Action continuation) | ||
{ | ||
_asyncOperation.completed += _ => continuation(); | ||
} | ||
|
||
public AsyncOperation GetResult() | ||
{ | ||
return _asyncOperation; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
|
||
namespace Better.Extensions.Runtime.Helpers | ||
{ | ||
[DebuggerNonUserCode] | ||
public readonly struct ResourceRequestAwaiter : INotifyCompletion | ||
{ | ||
private readonly ResourceRequest _asyncOperation; | ||
public bool IsCompleted => _asyncOperation.isDone; | ||
|
||
public ResourceRequestAwaiter(ResourceRequest asyncOperation) | ||
{ | ||
_asyncOperation = asyncOperation; | ||
} | ||
|
||
public void OnCompleted(Action continuation) | ||
{ | ||
_asyncOperation.completed += _ => continuation(); | ||
} | ||
|
||
public ResourceRequest GetResult() | ||
{ | ||
return _asyncOperation; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine.Networking; | ||
|
||
namespace Better.Extensions.Runtime.Helpers | ||
{ | ||
[DebuggerNonUserCode] | ||
public readonly struct UnityWebRequestAwaiter : INotifyCompletion | ||
{ | ||
private readonly UnityWebRequestAsyncOperation _asyncOperation; | ||
|
||
public bool IsCompleted => _asyncOperation.isDone; | ||
|
||
public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOperation) | ||
{ | ||
_asyncOperation = asyncOperation; | ||
} | ||
|
||
public void OnCompleted(Action continuation) | ||
{ | ||
_asyncOperation.completed += _ => continuation(); | ||
} | ||
|
||
public UnityWebRequest GetResult() | ||
{ | ||
return _asyncOperation.webRequest; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.