mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-15 19:40:09 +00:00
Compare commits
67 Commits
moreasmdef
...
chore/add_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51cc6e71e9 | ||
|
|
958a8e11ab | ||
|
|
257186313b | ||
|
|
5bd508b31c | ||
|
|
9e18ba332e | ||
|
|
946b9003f0 | ||
|
|
ffa55becf3 | ||
|
|
72e620d169 | ||
|
|
10ebddf892 | ||
|
|
c51e45ee21 | ||
|
|
6968faf35b | ||
|
|
4fc9ca315e | ||
|
|
aaf1c0eaa1 | ||
|
|
44ce3c96bb | ||
|
|
03097f08e2 | ||
|
|
af82dd719e | ||
|
|
ecd3625a08 | ||
|
|
da8f599ccb | ||
|
|
aa3216e48d | ||
|
|
5f7148419f | ||
|
|
89ae106ea7 | ||
|
|
721a7d9e4e | ||
|
|
18f2746f0d | ||
|
|
8a10f2191f | ||
|
|
8b3c8d15c4 | ||
|
|
49ca9364f7 | ||
|
|
62f6429b60 | ||
|
|
b6a9836e81 | ||
|
|
be34d8abf4 | ||
|
|
9af15d7ab3 | ||
|
|
308fef2859 | ||
|
|
3cc0c80b1e | ||
|
|
cdda33a98e | ||
|
|
e57a4332ec | ||
|
|
e88e553cc9 | ||
|
|
a1a38d0d7c | ||
|
|
c9bebd6550 | ||
|
|
42047070dd | ||
|
|
316f3bd963 | ||
|
|
5f96e646d4 | ||
|
|
186114996c | ||
|
|
841b6e85ae | ||
|
|
7ac9853cf6 | ||
|
|
0ec45b9da6 | ||
|
|
dfd0fe9fe4 | ||
|
|
4710268e0a | ||
|
|
cae512e4de | ||
|
|
6351d4c5a4 | ||
|
|
1173bb4f34 | ||
|
|
e4272b5337 | ||
|
|
b660506e31 | ||
|
|
2c101aef08 | ||
|
|
498b2a4f81 | ||
|
|
a8c2fd420a | ||
|
|
dade7fdc76 | ||
|
|
1c8b16f798 | ||
|
|
89649d8777 | ||
|
|
9894bf875b | ||
|
|
45a800330b | ||
|
|
19b5f921a1 | ||
|
|
8cd577904e | ||
|
|
309d661bcc | ||
|
|
8736024d9b | ||
|
|
97680e57a8 | ||
|
|
7535c84581 | ||
|
|
690f3a2ead | ||
|
|
88371d08b9 |
53
.github/workflows/build-debug.yml
vendored
53
.github/workflows/build-debug.yml
vendored
@@ -12,7 +12,6 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-dotnet:
|
build-dotnet:
|
||||||
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))"
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||||
@@ -26,42 +25,48 @@ jobs:
|
|||||||
- run: dotnet test -c Debug ./src/UniTask.NetCoreTests/UniTask.NetCoreTests.csproj
|
- run: dotnet test -c Debug ./src/UniTask.NetCoreTests/UniTask.NetCoreTests.csproj
|
||||||
|
|
||||||
build-unity:
|
build-unity:
|
||||||
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
|
if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
unity: ["2019.3.9f1", "2020.1.0b5"]
|
unity: ["2019.3.9f1", "2019.4.13f1", "2020.1.12f1"]
|
||||||
include:
|
include:
|
||||||
- unity: 2019.3.9f1
|
- unity: 2019.3.9f1
|
||||||
license: UNITY_2019_3
|
license: UNITY_LICENSE_2019
|
||||||
- unity: 2020.1.0b5
|
- unity: 2019.4.13f1
|
||||||
license: UNITY_2020_1
|
license: UNITY_LICENSE_2019
|
||||||
|
- unity: 2020.1.12f1
|
||||||
|
license: UNITY_LICENSE_2020
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
# with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
|
|
||||||
image: gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
|
|
||||||
steps:
|
steps:
|
||||||
# Ubuntu 18.04 git is too old, use ppa latest git.
|
|
||||||
- run: |
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y software-properties-common && add-apt-repository -y ppa:git-core/ppa
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y git
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
|
# Execute scripts: RuntimeUnitTestToolkit
|
||||||
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
|
||||||
|
- name: Build UnitTest(Linux64, mono)
|
||||||
|
uses: game-ci/unity-builder@v2.0-alpha-6
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
- name: Activate Unity, always returns a success. But if a subsequent run fails, the activation may have failed(if succeeded, shows `Next license update check is after` and not shows other message(like GUID != GUID). If fails not). In that case, upload the artifact's .alf file to https://license.unity3d.com/manual to get the .ulf file and set it to secrets.
|
with:
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
|
projectPath: src/UniTask
|
||||||
|
unityVersion: ${{ matrix.unity }}
|
||||||
# Execute scripts: RuntimeUnitTestToolkit
|
targetPlatform: StandaloneLinux64
|
||||||
- name: Build UnitTest(Linux64, mono)
|
buildMethod: UnitTestBuilder.BuildUnitTest
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
|
customParameters: /headless /ScriptBackend mono
|
||||||
working-directory: src/UniTask
|
versioning: None
|
||||||
- name: Execute UnitTest
|
- name: Execute UnitTest
|
||||||
run: ./src/UniTask/bin/UnitTest/StandaloneLinux64_Mono2x/test
|
run: ./src/UniTask/bin/UnitTest/StandaloneLinux64_Mono2x/test
|
||||||
|
|
||||||
# Execute scripts: Export Package
|
# Execute scripts: Export Package
|
||||||
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
- name: Export unitypackage
|
- name: Export unitypackage
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
uses: game-ci/unity-builder@v2.0-alpha-6
|
||||||
working-directory: src/UniTask
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
|
with:
|
||||||
|
projectPath: src/UniTask
|
||||||
|
unityVersion: ${{ matrix.unity }}
|
||||||
|
targetPlatform: StandaloneLinux64
|
||||||
|
buildMethod: PackageExporter.Export
|
||||||
|
versioning: None
|
||||||
|
|
||||||
- name: check all .meta is commited
|
- name: check all .meta is commited
|
||||||
run: |
|
run: |
|
||||||
@@ -76,5 +81,5 @@ jobs:
|
|||||||
# Store artifacts.
|
# Store artifacts.
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: UniTask.unitypackage.zip
|
name: UniTask.unitypackage-${{ matrix.unity }}.zip
|
||||||
path: ./src/UniTask/*.unitypackage
|
path: ./src/UniTask/*.unitypackage
|
||||||
|
|||||||
3
.github/workflows/build-docs.yml
vendored
3
.github/workflows/build-docs.yml
vendored
@@ -8,7 +8,6 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-docfx:
|
run-docfx:
|
||||||
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))"
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -28,4 +27,4 @@ jobs:
|
|||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: docs/_site
|
publish_dir: docs/_site
|
||||||
|
|||||||
57
.github/workflows/build-release.yml
vendored
57
.github/workflows/build-release.yml
vendored
@@ -26,40 +26,51 @@ jobs:
|
|||||||
sha: ${{ steps.commit.outputs.sha }}
|
sha: ${{ steps.commit.outputs.sha }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: before
|
- name: Output package.json (Before)
|
||||||
run: cat ${{ env.TARGET_FILE}}
|
run: cat ${{ env.TARGET_FILE}}
|
||||||
- name: update package.json to version ${{ env.GIT_TAG }}
|
|
||||||
|
- name: Update package.json to version ${{ env.GIT_TAG }}
|
||||||
run: sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}
|
run: sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}
|
||||||
- name: after
|
|
||||||
run: cat ${{ env.TARGET_FILE}}
|
- name: Check update
|
||||||
|
id: check_update
|
||||||
|
run: |
|
||||||
|
cat ${{ env.TARGET_FILE}}
|
||||||
|
git diff --exit-code || echo "::set-output name=changed::1"
|
||||||
|
|
||||||
- name: Commit files
|
- name: Commit files
|
||||||
id: commit
|
id: commit
|
||||||
|
if: steps.check_update.outputs.changed == '1'
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
|
git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
|
||||||
echo "::set-output name=sha::$(git rev-parse HEAD)"
|
echo "::set-output name=sha::$(git rev-parse HEAD)"
|
||||||
- name: check sha
|
|
||||||
|
- name: Check sha
|
||||||
run: echo "SHA ${SHA}"
|
run: echo "SHA ${SHA}"
|
||||||
env:
|
env:
|
||||||
SHA: ${{ steps.commit.outputs.sha }}
|
SHA: ${{ steps.commit.outputs.sha }}
|
||||||
- name: tag
|
|
||||||
|
- name: Create Tag
|
||||||
|
if: steps.check_update.outputs.changed == '1'
|
||||||
run: git tag ${{ env.GIT_TAG }}
|
run: git tag ${{ env.GIT_TAG }}
|
||||||
if: env.DRY_RUN == 'false'
|
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
|
if: env.DRY_RUN == 'false' && steps.check_update.outputs.changed == '1'
|
||||||
uses: ad-m/github-push-action@master
|
uses: ad-m/github-push-action@master
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
branch: ${{ github.ref }}
|
branch: ${{ github.ref }}
|
||||||
tags: true
|
tags: true
|
||||||
if: env.DRY_RUN == 'false'
|
|
||||||
- name: Push changes (dry_run)
|
- name: Push changes (dry_run)
|
||||||
|
if: env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1'
|
||||||
uses: ad-m/github-push-action@master
|
uses: ad-m/github-push-action@master
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
|
branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
|
||||||
tags: false
|
tags: false
|
||||||
if: env.DRY_RUN == 'true'
|
|
||||||
|
|
||||||
build-dotnet:
|
build-dotnet:
|
||||||
needs: [update-packagejson]
|
needs: [update-packagejson]
|
||||||
@@ -94,30 +105,26 @@ jobs:
|
|||||||
unity: ["2019.3.9f1"]
|
unity: ["2019.3.9f1"]
|
||||||
include:
|
include:
|
||||||
- unity: 2019.3.9f1
|
- unity: 2019.3.9f1
|
||||||
license: UNITY_2019_3
|
license: UNITY_LICENSE_2019
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
container:
|
|
||||||
# with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
|
|
||||||
image: gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
|
|
||||||
steps:
|
steps:
|
||||||
# Ubuntu 18.04 git is too old, use ppa latest git.
|
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
||||||
- run: |
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y software-properties-common && add-apt-repository -y ppa:git-core/ppa
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y git
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ needs.update-packagejson.outputs.sha }}
|
ref: ${{ needs.update-packagejson.outputs.sha }}
|
||||||
# activate Unity from manual license file(ulf)
|
# Execute scripts: Export Package
|
||||||
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
|
- name: Export unitypackage
|
||||||
|
uses: game-ci/unity-builder@v2.0-alpha-6
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
- run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
|
with:
|
||||||
|
projectPath: src/UniTask
|
||||||
# Execute scripts: Export Package
|
unityVersion: ${{ matrix.unity }}
|
||||||
- name: Export unitypackage
|
targetPlatform: StandaloneLinux64
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
buildMethod: PackageExporter.Export
|
||||||
working-directory: src/UniTask
|
versioning: None
|
||||||
|
|
||||||
- name: check all .meta is commited
|
- name: check all .meta is commited
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -259,3 +259,5 @@ src/UniTask/Unity.EditorCoroutines.Editor.csproj
|
|||||||
src/UniTask/.vsconfig
|
src/UniTask/.vsconfig
|
||||||
|
|
||||||
src/UniTask/Logs/ApiUpdaterCheck.txt
|
src/UniTask/Logs/ApiUpdaterCheck.txt
|
||||||
|
|
||||||
|
src/UniTask/Assembly-CSharp-firstpass.csproj
|
||||||
|
|||||||
194
README.md
194
README.md
@@ -24,6 +24,7 @@ For advanced tips, see blog post: [Extends UnityWebRequest via async decorator p
|
|||||||
- [Getting started](#getting-started)
|
- [Getting started](#getting-started)
|
||||||
- [Basics of UniTask and AsyncOperation](#basics-of-unitask-and-asyncoperation)
|
- [Basics of UniTask and AsyncOperation](#basics-of-unitask-and-asyncoperation)
|
||||||
- [Cancellation and Exception handling](#cancellation-and-exception-handling)
|
- [Cancellation and Exception handling](#cancellation-and-exception-handling)
|
||||||
|
- [Timeout handling](#timeout-handling)
|
||||||
- [Progress](#progress)
|
- [Progress](#progress)
|
||||||
- [PlayerLoop](#playerloop)
|
- [PlayerLoop](#playerloop)
|
||||||
- [async void vs async UniTaskVoid](#async-void-vs-async-unitaskvoid)
|
- [async void vs async UniTaskVoid](#async-void-vs-async-unitaskvoid)
|
||||||
@@ -127,9 +128,6 @@ async UniTask<string> DemoAsync()
|
|||||||
|
|
||||||
// shorthand of WhenAll, tuple can await directly
|
// shorthand of WhenAll, tuple can await directly
|
||||||
var (google2, bing2, yahoo2) = await (task1, task2, task3);
|
var (google2, bing2, yahoo2) = await (task1, task2, task3);
|
||||||
|
|
||||||
// You can handle timeouts easily
|
|
||||||
await GetTextAsync(UnityWebRequest.Get("http://unity.com")).Timeout(TimeSpan.FromMilliseconds(300));
|
|
||||||
|
|
||||||
// return async-value.(or you can use `UniTask`(no result), `UniTaskVoid`(fire and forget)).
|
// return async-value.(or you can use `UniTask`(no result), `UniTaskVoid`(fire and forget)).
|
||||||
return (asset as TextAsset)?.text ?? throw new InvalidOperationException("Asset not found");
|
return (asset as TextAsset)?.text ?? throw new InvalidOperationException("Asset not found");
|
||||||
@@ -154,7 +152,7 @@ UniTask provides three pattern of extension methods.
|
|||||||
|
|
||||||
`WithCancellation` is a simple version of `ToUniTask`, both return `UniTask`. For details of cancellation, see: [Cancellation and Exception handling](#cancellation-and-exception-handling) section.
|
`WithCancellation` is a simple version of `ToUniTask`, both return `UniTask`. For details of cancellation, see: [Cancellation and Exception handling](#cancellation-and-exception-handling) section.
|
||||||
|
|
||||||
> Note: WithCancellation is returned from native timing of PlayerLoop but ToUniTask is returned from specified PlayerLoopTiming. For details of timing, see: [PlayerLoop](#playerloop) section.
|
> Note: await directly is returned from native timing of PlayerLoop but WithCancellation and ToUniTask are returned from specified PlayerLoopTiming. For details of timing, see: [PlayerLoop](#playerloop) section.
|
||||||
|
|
||||||
> Note: AssetBundleRequest has `asset` and `allAssets`, default await returns `asset`. If you want to get `allAssets`, you can use `AwaitForAllAssets()` method.
|
> Note: AssetBundleRequest has `asset` and `allAssets`, default await returns `asset`. If you want to get `allAssets`, you can use `AwaitForAllAssets()` method.
|
||||||
|
|
||||||
@@ -243,9 +241,57 @@ CancellationToken can be created by `CancellationTokenSource` or MonoBehaviour's
|
|||||||
await UniTask.DelayFrame(1000, cancellationToken: this.GetCancellationTokenOnDestroy());
|
await UniTask.DelayFrame(1000, cancellationToken: this.GetCancellationTokenOnDestroy());
|
||||||
```
|
```
|
||||||
|
|
||||||
When cancellation is detected, all methods throw `OperationCanceledException` and propagate upstream. `OperationCanceledException` is a special exception, if this exception is not handled, it is propagated finally to `UniTaskScheduler.UnobservedTaskException`.
|
For propagate Cancellation, all async method recommend to accept `CancellationToken cancellationToken` at last argument, and pass `CancellationToken` from root to end.
|
||||||
|
|
||||||
The default behaviour of received unhandled exception is to write log as exception. Log level can be changed using `UniTaskScheduler.UnobservedExceptionWriteLogType`. If you want to use custom behaviour, set an action to `UniTaskScheduler.UnobservedTaskException.`
|
```csharp
|
||||||
|
await FooAsync(this.GetCancellationTokenOnDestroy());
|
||||||
|
|
||||||
|
// ---
|
||||||
|
|
||||||
|
async UniTask FooAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await BarAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
async UniTask BarAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await UniTask.Delay(TimeSpan.FromSeconds(3), cancellationToken);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`CancellationToken` means lifecycle of async. You can hold your own lifecycle insteadof default CancellationTokenOnDestroy.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public class MyBehaviour : MonoBehaviour
|
||||||
|
{
|
||||||
|
CancellationTokenSource disableCancellation = new CancellationTokenSource();
|
||||||
|
CancellationTokenSource destroyCancellation = new CancellationTokenSource();
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
if (disableCancellation != null)
|
||||||
|
{
|
||||||
|
disableCancellation.Dispose();
|
||||||
|
}
|
||||||
|
disableCancellation = new CancellationTokenSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
disableCancellation.Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
destroyCancellation.Cancel();
|
||||||
|
destroyCancellation.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
When cancellation is detected, all methods throw `OperationCanceledException` and propagate upstream. When exception(not limited to `OperationCanceledException`) is not handled in async method, it is propagated finally to `UniTaskScheduler.UnobservedTaskException`. The default behaviour of received unhandled exception is to write log as exception. Log level can be changed using `UniTaskScheduler.UnobservedExceptionWriteLogType`. If you want to use custom behaviour, set an action to `UniTaskScheduler.UnobservedTaskException.`
|
||||||
|
|
||||||
|
Andalso `OperationCanceledException` is a special exception, this is silently ignored at `UnobservedTaskException`.
|
||||||
|
|
||||||
If you want to cancel behaviour in an async UniTask method, throw `OperationCanceledException` manually.
|
If you want to cancel behaviour in an async UniTask method, throw `OperationCanceledException` manually.
|
||||||
|
|
||||||
@@ -267,7 +313,7 @@ public async UniTask<int> BarAsync()
|
|||||||
var x = await FooAsync();
|
var x = await FooAsync();
|
||||||
return x * 2;
|
return x * 2;
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!(ex is OperationCanceledException))
|
catch (Exception ex) when (!(ex is OperationCanceledException)) // when (ex is not OperationCanceledException) at C# 9.0
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -286,6 +332,100 @@ if (isCanceled)
|
|||||||
|
|
||||||
Note: Only suppress throws if you call directly into the most source method. Otherwise, the return value will be converted, but the entire pipeline will not suppress throws.
|
Note: Only suppress throws if you call directly into the most source method. Otherwise, the return value will be converted, but the entire pipeline will not suppress throws.
|
||||||
|
|
||||||
|
Timeout handling
|
||||||
|
---
|
||||||
|
Timeout is a variation of cancellation. You can set timeout by `CancellationTokenSouce.CancelAfterSlim(TimeSpan)` and pass CancellationToken to async methods.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
cts.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest().WithCancellation(cts.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (ex.CancellationToken == cts.Token)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Timeout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> `CancellationTokenSouce.CancelAfter` is a standard api. However in Unity you should not use it because it depends threading timer. `CancelAfterSlim` is UniTask's extension methods, it uses PlayerLoop instead.
|
||||||
|
|
||||||
|
If you want to use timeout with other source of cancellation, use `CancellationTokenSource.CreateLinkedTokenSource`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var cancelToken = new CancellationTokenSource();
|
||||||
|
cancelButton.onClick.AddListener(()=>
|
||||||
|
{
|
||||||
|
cancelToken.Cancel(); // cancel from button click.
|
||||||
|
});
|
||||||
|
|
||||||
|
var timeoutToken = new CancellationTokenSource();
|
||||||
|
timeoutToken.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// combine token
|
||||||
|
var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancelToken.Token, timeoutToken.Token);
|
||||||
|
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest().WithCancellation(linkedTokenSource.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (timeoutToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Timeout.");
|
||||||
|
}
|
||||||
|
else if (cancelToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Cancel clicked.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Optimize for reduce allocation of CancellationTokenSource for timeout per call async method, you can use UniTask's `TimeoutController`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
TimeoutController timeoutController = new TimeoutController(); // setup to field for reuse.
|
||||||
|
|
||||||
|
async UniTask FooAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// you can pass timeoutController.Timeout(TimeSpan) to cancellationToken.
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest()
|
||||||
|
.WithCancellation(timeoutController.Timeout(TimeSpan.FromSeconds(5)));
|
||||||
|
timeoutController.Reset(); // call Reset(Stop timeout timer and ready for reuse) when succeed.
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (timeoutController.IsTimeout())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("timeout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to use timeout with other source of cancellation, use `new TimeoutController(CancellationToken)`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
TimeoutController timeoutController;
|
||||||
|
CancellationTokenSource clickCancelSource;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
this.clickCancelSource = new CancellationTokenSource();
|
||||||
|
this.timeoutController = new TimeoutController(clickCancelSource);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: UniTask has `.Timeout`, `.TimeoutWithoutException` methods however, if possible, do not use these, please pass `CancellationToken`. Because `.Timeout` work from external of task, can not stop timeoutted task. `.Timeout` means ignore result when timeout. If you pass a `CancellationToken` to the method, it will act from inside of the task, so it is possible to stop a running task.
|
||||||
|
|
||||||
Progress
|
Progress
|
||||||
---
|
---
|
||||||
Some async operations for unity have `ToUniTask(IProgress<float> progress = null, ...)` extension methods.
|
Some async operations for unity have `ToUniTask(IProgress<float> progress = null, ...)` extension methods.
|
||||||
@@ -366,7 +506,7 @@ It indicates when to run, you can check [PlayerLoopList.md](https://gist.github.
|
|||||||
|
|
||||||
`AsyncOperation` is returned from native timing. For example, await `SceneManager.LoadSceneAsync` is returned from `EarlyUpdate.UpdatePreloading` and after being called, the loaded scene's `Start` is called from `EarlyUpdate.ScriptRunDelayedStartupFrame`. Also `await UnityWebRequest` is returned from `EarlyUpdate.ExecuteMainThreadJobs`.
|
`AsyncOperation` is returned from native timing. For example, await `SceneManager.LoadSceneAsync` is returned from `EarlyUpdate.UpdatePreloading` and after being called, the loaded scene's `Start` is called from `EarlyUpdate.ScriptRunDelayedStartupFrame`. Also `await UnityWebRequest` is returned from `EarlyUpdate.ExecuteMainThreadJobs`.
|
||||||
|
|
||||||
In UniTask, await directly and `WithCancellation` use native timing, `ToUniTask` uses specified timing. This is usually not a particular problem, but with `LoadSceneAsync`, it causes a different order of Start and continuation after await. So it is recommended not to use `LoadSceneAsync.ToUniTask`.
|
In UniTask, await directly uses native timing, `WithCancellation` and `ToUniTask` use specified timing. This is usually not a particular problem, but with `LoadSceneAsync`, it causes a different order of Start and continuation after await. So it is recommended not to use `LoadSceneAsync.ToUniTask`.
|
||||||
|
|
||||||
In the stacktrace, you can check where it is running in playerloop.
|
In the stacktrace, you can check where it is running in playerloop.
|
||||||
|
|
||||||
@@ -408,6 +548,37 @@ void Start()
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can optimize loop cost slightly by remove unuse PlayerLoopTiming injection. You can call `PlayerLoopHelper.Initialize(InjectPlayerLoopTimings)` on initialize.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var loop = PlayerLoop.GetCurrentPlayerLoop();
|
||||||
|
PlayerLoopHelper.Initialize(ref loop, InjectPlayerLoopTimings.Minimum); // minimum is Update | FixedUpdate | LastPostLateUpdate
|
||||||
|
```
|
||||||
|
|
||||||
|
`InjectPlayerLoopTimings` has three preset, `All` and `Standard`(All without last except LastPostLateUpdate), `Minimum`(`Update | FixedUpdate | LastPostLateUpdate`). Default is All and you can combine custom inject timings like `InjectPlayerLoopTimings.Update | InjectPlayerLoopTimings.FixedUpdate | InjectPlayerLoopTimings.PreLateUpdate`.
|
||||||
|
|
||||||
|
You can make error to use uninjected `PlayerLoopTiming` by [Microsoft.CodeAnalysis.BannedApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md). For example, you can setup `BannedSymbols.txt` like this for `InjectPlayerLoopTimings.Minimum`.
|
||||||
|
|
||||||
|
```txt
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.Initialization; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastInitialization; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.EarlyUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastEarlyUpdate; Isn't injected this PlayerLoop in this project.d
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastFixedUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.PreUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.PreLateUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreLateUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.PostLateUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.TimeUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastTimeUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
```
|
||||||
|
|
||||||
|
You can configure `RS0030` severity to error.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
async void vs async UniTaskVoid
|
async void vs async UniTaskVoid
|
||||||
---
|
---
|
||||||
`async void` is a standard C# task system so it does not run on UniTask systems. It is better not to use it. `async UniTaskVoid` is a lightweight version of `async UniTask` because it does not have awaitable completion and reports errors immediately to `UniTaskScheduler.UnobservedTaskException`. If you don't require awaiting (fire and forget), using `UniTaskVoid` is better. Unfortunately to dismiss warning, you're required to call `Forget()`.
|
`async void` is a standard C# task system so it does not run on UniTask systems. It is better not to use it. `async UniTaskVoid` is a lightweight version of `async UniTask` because it does not have awaitable completion and reports errors immediately to `UniTaskScheduler.UnobservedTaskException`. If you don't require awaiting (fire and forget), using `UniTaskVoid` is better. Unfortunately to dismiss warning, you're required to call `Forget()`.
|
||||||
@@ -546,7 +717,7 @@ Async LINQ is enabled when `using Cysharp.Threading.Tasks.Linq;`, and `UniTaskAs
|
|||||||
|
|
||||||
It's closer to UniRx (Reactive Extensions), but UniTaskAsyncEnumerable is a pull-based asynchronous stream, whereas Rx was a push-based asynchronous stream. Note that although similar, the characteristics are different and the details behave differently along with them.
|
It's closer to UniRx (Reactive Extensions), but UniTaskAsyncEnumerable is a pull-based asynchronous stream, whereas Rx was a push-based asynchronous stream. Note that although similar, the characteristics are different and the details behave differently along with them.
|
||||||
|
|
||||||
`UniTaskAsyncEnumerable` is the entry point like `Enumerbale`. In addition to the standard query operators, there are other generators for Unity such as `EveryUpdate`, `Timer`, `TimerFrame`, `Interval`, `IntervalFrame`, and `EveryValueChanged`. And also added additional UniTask original query operators like `Append`, `Prepend`, `DistinctUntilChanged`, `ToHashSet`, `Buffer`, `CombineLatest`, `Do`, `Never`, `ForEachAsync`, `Pairwise`, `Publish`, `Queue`, `Return`, `SkipUntil`, `TakeUntil`, `SkipUntilCanceled`, `TakeUntilCanceled`, `TakeLast`, `Subscribe`.
|
`UniTaskAsyncEnumerable` is the entry point like `Enumerable`. In addition to the standard query operators, there are other generators for Unity such as `EveryUpdate`, `Timer`, `TimerFrame`, `Interval`, `IntervalFrame`, and `EveryValueChanged`. And also added additional UniTask original query operators like `Append`, `Prepend`, `DistinctUntilChanged`, `ToHashSet`, `Buffer`, `CombineLatest`, `Do`, `Never`, `ForEachAsync`, `Pairwise`, `Publish`, `Queue`, `Return`, `SkipUntil`, `TakeUntil`, `SkipUntilCanceled`, `TakeUntilCanceled`, `TakeLast`, `Subscribe`.
|
||||||
|
|
||||||
The method with Func as an argument has three additional overloads, `***Await`, `***AwaitWithCancellation`.
|
The method with Func as an argument has three additional overloads, `***Await`, `***AwaitWithCancellation`.
|
||||||
|
|
||||||
@@ -725,7 +896,7 @@ button.OnClickAsAsyncEnumerable().Subscribe(async x =>
|
|||||||
|
|
||||||
Channel
|
Channel
|
||||||
---
|
---
|
||||||
`Channel` is the same as [System.Threading.Tasks.Channels](https://docs.microsoft.com/ja-jp/dotnet/api/system.threading.channels?view=netcore-3.1) which is similar to a GoLang Channel.
|
`Channel` is the same as [System.Threading.Tasks.Channels](https://docs.microsoft.com/en-us/dotnet/api/system.threading.channels?view=netcore-3.1) which is similar to a GoLang Channel.
|
||||||
|
|
||||||
Currently it only supports multiple-producer, single-consumer unbounded channels. It can create by `Channel.CreateSingleConsumerUnbounded<T>()`.
|
Currently it only supports multiple-producer, single-consumer unbounded channels. It can create by `Channel.CreateSingleConsumerUnbounded<T>()`.
|
||||||
|
|
||||||
@@ -812,8 +983,9 @@ For UnityEditor
|
|||||||
---
|
---
|
||||||
UniTask can run on Unity Editor like an Editor Coroutine. However, there are some limitations.
|
UniTask can run on Unity Editor like an Editor Coroutine. However, there are some limitations.
|
||||||
|
|
||||||
* Delay, DelayFrame do not work correctly because they can not get deltaTime in editor. Return the result of the await immediately; you can use `DelayType.Realtime` to wait for the right time.
|
* UniTask.Delay's DelayType.DeltaTime, UnscaledDeltaTime do not work correctly because they can not get deltaTime in editor. Therefore run on EditMode, automatically change DelayType to `DelayType.Realtime` that wait for the right time.
|
||||||
* All PlayerLoopTiming run on the timing `EditorApplication.update`.
|
* All PlayerLoopTiming run on the timing `EditorApplication.update`.
|
||||||
|
* `-batchmode` with `-quit` does not work because Unity does not run `EditorApplication.update` and quit after a single frame. Instead, don't use `-quit` and quit manually with `EditorApplication.Exit(0)`.
|
||||||
|
|
||||||
Compare with Standard Task API
|
Compare with Standard Task API
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageIcon>Icon.png</PackageIcon>
|
<PackageIcon>Icon.png</PackageIcon>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>opensource.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -26,29 +28,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\UniTask\Assets\Plugins\UniTask\Runtime\**\*.cs"
|
<Compile Include="..\UniTask\Assets\Plugins\UniTask\Runtime\**\*.cs" Exclude="
..\UniTask\Assets\Plugins\UniTask\Editor\*.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\Triggers\*.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\Linq\UnityExtensions\*.cs;
 
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityEqualityComparer.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\DiagnosticsExtensions.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\PlayerLoopRunner.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\ContinuationQueue.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityWebRequestExtensions.cs;
 
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\TimeoutController.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopTimer.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Run.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Bridge.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.WaitUntil.cs;
..\UniTask\Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.*;
..\UniTask\Assets\Plugins\UniTask\Runtime\UnityBindingExtensions.cs;
" />
|
||||||
Exclude="
|
<Compile Remove="..\UniTask\Assets\Plugins\UniTask\Runtime\_InternalVisibleTo.cs" />
|
||||||
..\UniTask\Assets\Plugins\UniTask\Editor\*.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Triggers\*.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Linq\UnityExtensions\*.cs;
|
|
||||||
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityEqualityComparer.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\DiagnosticsExtensions.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\PlayerLoopRunner.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\ContinuationQueue.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityWebRequestExtensions.cs;
|
|
||||||
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Run.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Bridge.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.WaitUntil.cs;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.*;
|
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UnityBindingExtensions.cs;
|
|
||||||
" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
BIN
src/UniTask.NetCore/opensource.snk
Normal file
BIN
src/UniTask.NetCore/opensource.snk
Normal file
Binary file not shown.
@@ -31,7 +31,7 @@ namespace NetCoreTests
|
|||||||
|
|
||||||
var ar = await array;
|
var ar = await array;
|
||||||
|
|
||||||
ar.Should().BeEquivalentTo(new[] { 99, 100, 100, 100, 131 });
|
ar.Should().Equal(new[] { 99, 100, 100, 100, 131 });
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -49,7 +49,7 @@ namespace NetCoreTests
|
|||||||
|
|
||||||
var ar = await array;
|
var ar = await array;
|
||||||
|
|
||||||
ar.Should().BeEquivalentTo(new[] { 100, 100, 100, 131, 191 });
|
ar.Should().Equal(new[] { 100, 100, 100, 131, 191 });
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
//[Fact]
|
||||||
@@ -70,7 +70,7 @@ namespace NetCoreTests
|
|||||||
|
|
||||||
// var ar = await array;
|
// var ar = await array;
|
||||||
|
|
||||||
// ar.Should().BeEquivalentTo(new[] { 99, 100, 100, 100, 131 });
|
// ar.Should().Equal(new[] { 99, 100, 100, 100, 131 });
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//[Fact]
|
//[Fact]
|
||||||
@@ -88,7 +88,7 @@ namespace NetCoreTests
|
|||||||
|
|
||||||
// var ar = await array;
|
// var ar = await array;
|
||||||
|
|
||||||
// ar.Should().BeEquivalentTo(new[] { 100, 100, 100, 131, 191 });
|
// ar.Should().Equal(new[] { 100, 100, 100, 131, 191 });
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ namespace NetCoreTests
|
|||||||
reference.Writer.TryComplete();
|
reference.Writer.TryComplete();
|
||||||
channel.Writer.TryComplete();
|
channel.Writer.TryComplete();
|
||||||
|
|
||||||
(await ta1).Should().BeEquivalentTo(new[] { 10, 20, 30 });
|
(await ta1).Should().Equal(new[] { 10, 20, 30 });
|
||||||
(await ta2).Should().BeEquivalentTo(new[] { 10, 20, 30 });
|
(await ta2).Should().Equal(new[] { 10, 20, 30 });
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ namespace NetCoreTests.Linq
|
|||||||
list.Add(x);
|
list.Add(x);
|
||||||
});
|
});
|
||||||
|
|
||||||
list.Should().BeEquivalentTo(Enumerable.Range(1, 10));
|
list.Should().Equal(Enumerable.Range(1, 10));
|
||||||
|
|
||||||
var list2 = new List<(int, int)>();
|
var list2 = new List<(int, int)>();
|
||||||
await Enumerable.Range(5, 10).ToUniTaskAsyncEnumerable().ForEachAsync((index, x) =>
|
await Enumerable.Range(5, 10).ToUniTaskAsyncEnumerable().ForEachAsync((index, x) =>
|
||||||
@@ -490,7 +490,7 @@ namespace NetCoreTests.Linq
|
|||||||
});
|
});
|
||||||
|
|
||||||
var list3 = Enumerable.Range(5, 10).Select((index, x) => (index, x)).ToArray();
|
var list3 = Enumerable.Range(5, 10).Select((index, x) => (index, x)).ToArray();
|
||||||
list2.Should().BeEquivalentTo(list3);
|
list2.Should().Equal(list3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Append(99).ToArrayAsync();
|
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Append(99).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(start, count).Append(99).ToArray();
|
var ys = Enumerable.Range(start, count).Append(99).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -50,7 +50,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Prepend(99).ToArrayAsync();
|
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Prepend(99).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(start, count).Prepend(99).ToArray();
|
var ys = Enumerable.Range(start, count).Prepend(99).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -85,7 +85,7 @@ namespace NetCoreTests.Linq
|
|||||||
|
|
||||||
var xs = await l.ToUniTaskAsyncEnumerable().Concat(r.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
var xs = await l.ToUniTaskAsyncEnumerable().Concat(r.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
||||||
var ys = l.Concat(r).ToArray();
|
var ys = l.Concat(r).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -119,17 +119,17 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
|
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, 0).DefaultIfEmpty(99).ToArray();
|
var ys = Enumerable.Range(1, 0).DefaultIfEmpty(99).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
|
var xs = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, 1).DefaultIfEmpty(99).ToArray();
|
var ys = Enumerable.Range(1, 1).DefaultIfEmpty(99).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
|
var xs = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, 10).DefaultIfEmpty(99).ToArray();
|
var ys = Enumerable.Range(1, 10).DefaultIfEmpty(99).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
// Throw
|
// Throw
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, 10).ToObservable().ToArray();
|
var xs = await UniTaskAsyncEnumerable.Range(1, 10).ToObservable().ToArray();
|
||||||
xs.Should().BeEquivalentTo(Enumerable.Range(1, 10));
|
xs.Should().Equal(Enumerable.Range(1, 10));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, 0).ToObservable().ToArray();
|
var xs = await UniTaskAsyncEnumerable.Range(1, 0).ToObservable().ToArray();
|
||||||
xs.Should().BeEquivalentTo(Enumerable.Range(1, 0));
|
xs.Should().Equal(Enumerable.Range(1, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,21 +70,21 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await Observable.Range(1, 100).ToUniTaskAsyncEnumerable().ToArrayAsync();
|
var xs = await Observable.Range(1, 100).ToUniTaskAsyncEnumerable().ToArrayAsync();
|
||||||
var ys = await Observable.Range(1, 100).ToArray();
|
var ys = await Observable.Range(1, 100).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
var xs = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();
|
var xs = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();
|
||||||
var ys = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToArray();
|
var ys = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
var xs = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();
|
var xs = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();
|
||||||
var ys = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToArray();
|
var ys = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,25 +95,25 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);
|
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);
|
||||||
var ys = Enumerable.Range(1, 100).ToDictionary(x => x);
|
var ys = Enumerable.Range(1, 100).ToDictionary(x => x);
|
||||||
|
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);
|
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);
|
||||||
var ys = Enumerable.Range(1, 0).ToDictionary(x => x);
|
var ys = Enumerable.Range(1, 0).ToDictionary(x => x);
|
||||||
|
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);
|
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);
|
||||||
var ys = Enumerable.Range(1, 100).ToDictionary(x => x, x => x * 2);
|
var ys = Enumerable.Range(1, 100).ToDictionary(x => x, x => x * 2);
|
||||||
|
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);
|
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);
|
||||||
var ys = Enumerable.Range(1, 0).ToDictionary(x => x, x => x * 2);
|
var ys = Enumerable.Range(1, 0).ToDictionary(x => x, x => x * 2);
|
||||||
|
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,34 +126,34 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.ToLookup(x => x);
|
var ys = arr.ToLookup(x => x);
|
||||||
|
|
||||||
xs.Count.Should().Be(ys.Count);
|
xs.Count.Should().Be(ys.Count);
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
foreach (var key in xs.Select(x => x.Key))
|
foreach (var key in xs.Select(x => x.Key))
|
||||||
{
|
{
|
||||||
xs[key].Should().BeEquivalentTo(ys[key]);
|
xs[key].Should().Equal(ys[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x);
|
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x);
|
||||||
var ys = Enumerable.Range(1, 0).ToLookup(x => x);
|
var ys = Enumerable.Range(1, 0).ToLookup(x => x);
|
||||||
|
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await arr.ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);
|
var xs = await arr.ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);
|
||||||
var ys = arr.ToLookup(x => x, x => x * 2);
|
var ys = arr.ToLookup(x => x, x => x * 2);
|
||||||
|
|
||||||
xs.Count.Should().Be(ys.Count);
|
xs.Count.Should().Be(ys.Count);
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
foreach (var key in xs.Select(x => x.Key))
|
foreach (var key in xs.Select(x => x.Key))
|
||||||
{
|
{
|
||||||
xs[key].Should().BeEquivalentTo(ys[key]);
|
xs[key].Should().Equal(ys[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);
|
var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);
|
||||||
var ys = Enumerable.Range(1, 0).ToLookup(x => x, x => x * 2);
|
var ys = Enumerable.Range(1, 0).ToLookup(x => x, x => x * 2);
|
||||||
|
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,13 +164,13 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToListAsync();
|
var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToListAsync();
|
||||||
var ys = Enumerable.Range(1, 100).ToList();
|
var ys = Enumerable.Range(1, 100).ToList();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToListAsync();
|
var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToListAsync();
|
||||||
var ys = Enumerable.Empty<int>().ToList();
|
var ys = Enumerable.Empty<int>().ToList();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,13 +181,13 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await new[] { 1, 20, 4, 5, 20, 4, 6 }.ToUniTaskAsyncEnumerable().ToHashSetAsync();
|
var xs = await new[] { 1, 20, 4, 5, 20, 4, 6 }.ToUniTaskAsyncEnumerable().ToHashSetAsync();
|
||||||
var ys = new[] { 1, 20, 4, 5, 20, 4, 6 }.ToHashSet();
|
var ys = new[] { 1, 20, 4, 5, 20, 4, 6 }.ToHashSet();
|
||||||
|
|
||||||
xs.OrderBy(x => x).Should().BeEquivalentTo(ys.OrderBy(x => x));
|
xs.OrderBy(x => x).Should().Equal(ys.OrderBy(x => x));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToHashSetAsync();
|
var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToHashSetAsync();
|
||||||
var ys = Enumerable.Empty<int>().ToHashSet();
|
var ys = Enumerable.Empty<int>().ToHashSet();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace NetCoreTests.Linq
|
|||||||
|
|
||||||
var ys = await Range(from, count).AsUniTaskAsyncEnumerable().ToArrayAsync();
|
var ys = await Range(from, count).AsUniTaskAsyncEnumerable().ToArrayAsync();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -57,19 +57,19 @@ namespace NetCoreTests.Linq
|
|||||||
list.Should().BeEmpty();
|
list.Should().BeEmpty();
|
||||||
|
|
||||||
await e.MoveNextAsync();
|
await e.MoveNextAsync();
|
||||||
list.Should().BeEquivalentTo(100);
|
list.Should().Equal(100);
|
||||||
e.Current.Should().Be(10);
|
e.Current.Should().Be(10);
|
||||||
|
|
||||||
await e.MoveNextAsync();
|
await e.MoveNextAsync();
|
||||||
list.Should().BeEquivalentTo(100, 200);
|
list.Should().Equal(100, 200);
|
||||||
e.Current.Should().Be(20);
|
e.Current.Should().Be(20);
|
||||||
|
|
||||||
await e.MoveNextAsync();
|
await e.MoveNextAsync();
|
||||||
list.Should().BeEquivalentTo(100, 200, 300);
|
list.Should().Equal(100, 200, 300);
|
||||||
e.Current.Should().Be(30);
|
e.Current.Should().Be(30);
|
||||||
|
|
||||||
(await e.MoveNextAsync()).Should().BeFalse();
|
(await e.MoveNextAsync()).Should().BeFalse();
|
||||||
list.Should().BeEquivalentTo(100, 200, 300, 400);
|
list.Should().Equal(100, 200, 300, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -144,19 +144,19 @@ namespace NetCoreTests.Linq
|
|||||||
list.Should().BeEmpty();
|
list.Should().BeEmpty();
|
||||||
|
|
||||||
await e.MoveNextAsync();
|
await e.MoveNextAsync();
|
||||||
list.Should().BeEquivalentTo(100);
|
list.Should().Equal(100);
|
||||||
e.Current.Should().Be(10);
|
e.Current.Should().Be(10);
|
||||||
|
|
||||||
await e.MoveNextAsync();
|
await e.MoveNextAsync();
|
||||||
list.Should().BeEquivalentTo(100, 200);
|
list.Should().Equal(100, 200);
|
||||||
e.Current.Should().Be(20);
|
e.Current.Should().Be(20);
|
||||||
|
|
||||||
await e.MoveNextAsync();
|
await e.MoveNextAsync();
|
||||||
list.Should().BeEquivalentTo(100, 200, 300);
|
list.Should().Equal(100, 200, 300);
|
||||||
e.Current.Should().Be(30);
|
e.Current.Should().Be(30);
|
||||||
|
|
||||||
(await e.MoveNextAsync()).Should().BeFalse();
|
(await e.MoveNextAsync()).Should().BeFalse();
|
||||||
list.Should().BeEquivalentTo(100, 200, 300, 400);
|
list.Should().Equal(100, 200, 300, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
async IAsyncEnumerable<int> Range(int from, int count)
|
async IAsyncEnumerable<int> Range(int from, int count)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(start, count).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(start, count).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(start, count).ToArray();
|
var ys = Enumerable.Range(start, count).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@@ -36,7 +36,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Repeat(value, count).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Repeat(value, count).ToArrayAsync();
|
||||||
var ys = Enumerable.Repeat(value, count).ToArray();
|
var ys = Enumerable.Repeat(value, count).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -45,7 +45,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Empty<int>().ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Empty<int>().ToArrayAsync();
|
||||||
var ys = Enumerable.Empty<int>().ToArray();
|
var ys = Enumerable.Empty<int>().ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|||||||
@@ -23,26 +23,26 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var a = await src.Where(x => x % 2 == 0).ToArrayAsync();
|
var a = await src.Where(x => x % 2 == 0).ToArrayAsync();
|
||||||
var expected = range.Where(x => x % 2 == 0).ToArray();
|
var expected = range.Where(x => x % 2 == 0).ToArray();
|
||||||
a.Should().BeEquivalentTo(expected);
|
a.Should().Equal(expected);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var a = await src.Where((x, i) => (x + i) % 2 == 0).ToArrayAsync();
|
var a = await src.Where((x, i) => (x + i) % 2 == 0).ToArrayAsync();
|
||||||
var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();
|
var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();
|
||||||
a.Should().BeEquivalentTo(expected);
|
a.Should().Equal(expected);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var a = await src.WhereAwait(x => UniTask.Run(() => x % 2 == 0)).ToArrayAsync();
|
var a = await src.WhereAwait(x => UniTask.Run(() => x % 2 == 0)).ToArrayAsync();
|
||||||
var b = await src.WhereAwait(x => UniTask.FromResult(x % 2 == 0)).ToArrayAsync();
|
var b = await src.WhereAwait(x => UniTask.FromResult(x % 2 == 0)).ToArrayAsync();
|
||||||
var expected = range.Where(x => x % 2 == 0).ToArray();
|
var expected = range.Where(x => x % 2 == 0).ToArray();
|
||||||
a.Should().BeEquivalentTo(expected);
|
a.Should().Equal(expected);
|
||||||
b.Should().BeEquivalentTo(expected);
|
b.Should().Equal(expected);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var a = await src.WhereAwait((x, i) => UniTask.Run(() => (x + i) % 2 == 0)).ToArrayAsync();
|
var a = await src.WhereAwait((x, i) => UniTask.Run(() => (x + i) % 2 == 0)).ToArrayAsync();
|
||||||
var b = await src.WhereAwait((x, i) => UniTask.FromResult((x + i) % 2 == 0)).ToArrayAsync();
|
var b = await src.WhereAwait((x, i) => UniTask.FromResult((x + i) % 2 == 0)).ToArrayAsync();
|
||||||
var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();
|
var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();
|
||||||
a.Should().BeEquivalentTo(expected);
|
a.Should().Equal(expected);
|
||||||
b.Should().BeEquivalentTo(expected);
|
b.Should().Equal(expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ namespace NetCoreTests.Linq
|
|||||||
var a = await data.ToUniTaskAsyncEnumerable().OfType<int>().ToArrayAsync();
|
var a = await data.ToUniTaskAsyncEnumerable().OfType<int>().ToArrayAsync();
|
||||||
var b = data.OfType<int>().ToArray();
|
var b = data.OfType<int>().ToArray();
|
||||||
|
|
||||||
a.Should().BeEquivalentTo(b);
|
a.Should().Equal(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ namespace NetCoreTests.Linq
|
|||||||
var a = await data.ToUniTaskAsyncEnumerable().Cast<int>().ToArrayAsync();
|
var a = await data.ToUniTaskAsyncEnumerable().Cast<int>().ToArrayAsync();
|
||||||
var b = data.Cast<int>().ToArray();
|
var b = data.Cast<int>().ToArray();
|
||||||
|
|
||||||
a.Should().BeEquivalentTo(b);
|
a.Should().Equal(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await outer.ToUniTaskAsyncEnumerable().Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => (x, y)).ToArrayAsync();
|
var xs = await outer.ToUniTaskAsyncEnumerable().Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => (x, y)).ToArrayAsync();
|
||||||
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
|
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, y))).ToArrayAsync();
|
var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, y))).ToArrayAsync();
|
||||||
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
|
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, y))).ToArrayAsync();
|
var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, y))).ToArrayAsync();
|
||||||
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
|
var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.GroupBy(x => x).ToArray();
|
var ys = arr.GroupBy(x => x).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
|
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().BeEquivalentTo(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
|
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -139,7 +139,7 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.GroupBy(x => x).ToArray();
|
var ys = arr.GroupBy(x => x).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -147,7 +147,7 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
|
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().BeEquivalentTo(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
|
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -155,7 +155,7 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.GroupBy(x => x).ToArray();
|
var ys = arr.GroupBy(x => x).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.OrderBy(x => x.Key).Should().BeEquivalentTo(ys.OrderBy(x => x.Key));
|
xs.Should().BeEquivalentTo(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
|
var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().BeEquivalentTo(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
|
xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,21 +199,21 @@ namespace NetCoreTests.Linq
|
|||||||
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
|
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync();
|
var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync();
|
||||||
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
|
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync();
|
var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, string.Join(", ", y)))).ToArrayAsync();
|
||||||
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
|
var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(", ", y))).ToArray();
|
||||||
|
|
||||||
xs.Length.Should().Be(ys.Length);
|
xs.Length.Should().Be(ys.Length);
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).Skip(skipCount).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).Skip(skipCount).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).Skip(skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).Skip(skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -52,7 +52,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipLast(skipCount).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipLast(skipCount).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipLast(skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipLast(skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -77,7 +77,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeLast(takeCount).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeLast(takeCount).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeLast(takeCount).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeLast(takeCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -103,7 +103,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).Take(takeCount).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).Take(takeCount).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).Take(takeCount).ToArray();
|
var ys = Enumerable.Range(1, collection).Take(takeCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -130,37 +130,37 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
|
var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,37 +213,37 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
|
var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Reverse().ToArrayAsync();
|
var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Reverse().ToArrayAsync();
|
||||||
var ys = Enumerable.Range(start, count).Reverse().ToArray();
|
var ys = Enumerable.Range(start, count).Reverse().ToArray();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -46,18 +46,18 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, count).Select(x => x * x).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, count).Select(x => x * x).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, count).Select(x => x * x).ToArray();
|
var ys = Enumerable.Range(1, count).Select(x => x * x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
|
|
||||||
var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x) => UniTask.Run(() => x * x)).ToArrayAsync();
|
var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x) => UniTask.Run(() => x * x)).ToArrayAsync();
|
||||||
zs.Should().BeEquivalentTo(ys);
|
zs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, count).Select((x, i) => x * x * i).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, count).Select((x, i) => x * x * i).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, count).Select((x, i) => x * x * i).ToArray();
|
var ys = Enumerable.Range(1, count).Select((x, i) => x * x * i).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
|
|
||||||
var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x, i) => UniTask.Run(() => x * x * i)).ToArrayAsync();
|
var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x, i) => UniTask.Run(() => x * x * i)).ToArrayAsync();
|
||||||
zs.Should().BeEquivalentTo(ys);
|
zs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,22 +98,22 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x), (x, y) => x * y).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x), (x, y) => x * y).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
// await
|
// await
|
||||||
@@ -121,22 +121,22 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
// with cancel
|
// with cancel
|
||||||
@@ -144,22 +144,22 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
|
var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,17 +219,17 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).Zip(UniTaskAsyncEnumerable.Range(99, rightCount)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).Zip(UniTaskAsyncEnumerable.Range(99, rightCount)).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwait(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwait(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwaitWithCancellation(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y, _) => UniTask.Run(() => (x, y))).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwaitWithCancellation(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y, _) => UniTask.Run(() => (x, y))).ToArrayAsync();
|
||||||
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
|
var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -288,7 +288,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
||||||
var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@@ -305,7 +305,7 @@ namespace NetCoreTests.Linq
|
|||||||
var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
||||||
var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(",", x)).ToArrayAsync();
|
||||||
|
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -402,7 +402,7 @@ namespace NetCoreTests.Linq
|
|||||||
public async Task PariwiseImmediate()
|
public async Task PariwiseImmediate()
|
||||||
{
|
{
|
||||||
var xs = await UniTaskAsyncEnumerable.Range(1, 5).Pairwise().ToArrayAsync();
|
var xs = await UniTaskAsyncEnumerable.Range(1, 5).Pairwise().ToArrayAsync();
|
||||||
xs.Should().BeEquivalentTo((1, 2), (2, 3), (3, 4), (4, 5));
|
xs.Should().Equal((1, 2), (2, 3), (3, 4), (4, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -426,7 +426,7 @@ namespace NetCoreTests.Linq
|
|||||||
|
|
||||||
await complete;
|
await complete;
|
||||||
|
|
||||||
list.Should().BeEquivalentTo((10, 20), (20, 30), (30, 40), (40, 50));
|
list.Should().Equal((10, 20), (20, 30), (30, 40), (40, 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyException : Exception
|
class MyException : Exception
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace NetCoreTests.Linq
|
|||||||
|
|
||||||
rp.Value = 2;
|
rp.Value = 2;
|
||||||
|
|
||||||
(await b).Should().BeEquivalentTo(1, 2);
|
(await b).Should().Equal(1, 2);
|
||||||
|
|
||||||
var c = multicast.ToArrayAsync();
|
var c = multicast.ToArrayAsync();
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ namespace NetCoreTests.Linq
|
|||||||
|
|
||||||
rp.Dispose();
|
rp.Dispose();
|
||||||
|
|
||||||
(await a).Should().BeEquivalentTo(1, 2, 3, 4, 5);
|
(await a).Should().Equal(1, 2, 3, 4, 5);
|
||||||
(await c).Should().BeEquivalentTo(3, 4, 5);
|
(await c).Should().Equal(3, 4, 5);
|
||||||
|
|
||||||
disp.Dispose();
|
disp.Dispose();
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ namespace NetCoreTests.Linq
|
|||||||
|
|
||||||
rp.Value = 2;
|
rp.Value = 2;
|
||||||
|
|
||||||
(await b).Should().BeEquivalentTo(1, 2);
|
(await b).Should().Equal(1, 2);
|
||||||
|
|
||||||
var c = multicast.ToArrayAsync();
|
var c = multicast.ToArrayAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace NetCoreTests.Linq
|
|||||||
l.Add(x);
|
l.Add(x);
|
||||||
});
|
});
|
||||||
|
|
||||||
l.Should().BeEquivalentTo(100, 110, 120, 130, 140, 150, 160, 170, 180, 190);
|
l.Should().Equal(100, 110, 120, 130, 140, 150, 160, 170, 180, 190);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var ys = array.Distinct().ToArray();
|
var ys = array.Distinct().ToArray();
|
||||||
{
|
{
|
||||||
(await array.ToUniTaskAsyncEnumerable().Distinct().ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().Distinct().ToArrayAsync()).Should().Equal(ys);
|
||||||
(await array.ToUniTaskAsyncEnumerable().Distinct(x => x).ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().Distinct(x => x).ToArrayAsync()).Should().Equal(ys);
|
||||||
(await array.ToUniTaskAsyncEnumerable().DistinctAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().DistinctAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
|
||||||
(await array.ToUniTaskAsyncEnumerable().DistinctAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().DistinctAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var ys = await array.ToAsyncEnumerable().DistinctUntilChanged().ToArrayAsync();
|
var ys = await array.ToAsyncEnumerable().DistinctUntilChanged().ToArrayAsync();
|
||||||
{
|
{
|
||||||
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged().ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged().ToArrayAsync()).Should().Equal(ys);
|
||||||
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged(x => x).ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged(x => x).ToArrayAsync()).Should().Equal(ys);
|
||||||
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
|
||||||
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().BeEquivalentTo(ys);
|
(await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await a1.ToUniTaskAsyncEnumerable().Except(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
var xs = await a1.ToUniTaskAsyncEnumerable().Except(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
||||||
var ys = a1.Except(a2).ToArray();
|
var ys = a1.Except(a2).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await a1.ToUniTaskAsyncEnumerable().Intersect(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
var xs = await a1.ToUniTaskAsyncEnumerable().Intersect(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
||||||
var ys = a1.Intersect(a2).ToArray();
|
var ys = a1.Intersect(a2).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await a1.ToUniTaskAsyncEnumerable().Union(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
var xs = await a1.ToUniTaskAsyncEnumerable().Union(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();
|
||||||
var ys = a1.Union(a2).ToArray();
|
var ys = a1.Union(a2).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,32 +59,32 @@ namespace NetCoreTests.Linq
|
|||||||
{
|
{
|
||||||
var xs = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x).ToArrayAsync();
|
var xs = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x).ToArrayAsync();
|
||||||
var ys = array.OrderBy(x => x).ToArray();
|
var ys = array.OrderBy(x => x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x).ToArrayAsync();
|
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x).ToArrayAsync();
|
||||||
var ys = array.OrderByDescending(x => x).ToArray();
|
var ys = array.OrderByDescending(x => x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwait(RandomRun).ToArrayAsync();
|
var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwait(RandomRun).ToArrayAsync();
|
||||||
var ys = array.OrderBy(x => x).ToArray();
|
var ys = array.OrderBy(x => x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(RandomRun).ToArrayAsync();
|
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(RandomRun).ToArrayAsync();
|
||||||
var ys = array.OrderByDescending(x => x).ToArray();
|
var ys = array.OrderByDescending(x => x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation(RandomRun).ToArrayAsync();
|
var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation(RandomRun).ToArrayAsync();
|
||||||
var ys = array.OrderBy(x => x).ToArray();
|
var ys = array.OrderBy(x => x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync();
|
var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync();
|
||||||
var ys = array.OrderByDescending(x => x).ToArray();
|
var ys = array.OrderByDescending(x => x).ToArray();
|
||||||
xs.Should().BeEquivalentTo(ys);
|
xs.Should().Equal(ys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,14 +125,14 @@ namespace NetCoreTests.Linq
|
|||||||
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();
|
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();
|
||||||
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();
|
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();
|
||||||
|
|
||||||
a.Should().BeEquivalentTo(a2);
|
a.Should().Equal(a2);
|
||||||
b.Should().BeEquivalentTo(b2);
|
b.Should().Equal(b2);
|
||||||
c.Should().BeEquivalentTo(c2);
|
c.Should().Equal(c2);
|
||||||
d.Should().BeEquivalentTo(d2);
|
d.Should().Equal(d2);
|
||||||
e.Should().BeEquivalentTo(e2);
|
e.Should().Equal(e2);
|
||||||
f.Should().BeEquivalentTo(f2);
|
f.Should().Equal(f2);
|
||||||
g.Should().BeEquivalentTo(g2);
|
g.Should().Equal(g2);
|
||||||
h.Should().BeEquivalentTo(h2);
|
h.Should().Equal(h2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();
|
var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();
|
||||||
@@ -144,14 +144,14 @@ namespace NetCoreTests.Linq
|
|||||||
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();
|
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();
|
||||||
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();
|
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();
|
||||||
|
|
||||||
a.Should().BeEquivalentTo(a2);
|
a.Should().Equal(a2);
|
||||||
b.Should().BeEquivalentTo(b2);
|
b.Should().Equal(b2);
|
||||||
c.Should().BeEquivalentTo(c2);
|
c.Should().Equal(c2);
|
||||||
d.Should().BeEquivalentTo(d2);
|
d.Should().Equal(d2);
|
||||||
e.Should().BeEquivalentTo(e2);
|
e.Should().Equal(e2);
|
||||||
f.Should().BeEquivalentTo(f2);
|
f.Should().Equal(f2);
|
||||||
g.Should().BeEquivalentTo(g2);
|
g.Should().Equal(g2);
|
||||||
h.Should().BeEquivalentTo(h2);
|
h.Should().Equal(h2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
|
var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
|
||||||
@@ -163,14 +163,14 @@ namespace NetCoreTests.Linq
|
|||||||
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
|
var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
|
||||||
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
|
var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();
|
||||||
|
|
||||||
a.Should().BeEquivalentTo(a2);
|
a.Should().Equal(a2);
|
||||||
b.Should().BeEquivalentTo(b2);
|
b.Should().Equal(b2);
|
||||||
c.Should().BeEquivalentTo(c2);
|
c.Should().Equal(c2);
|
||||||
d.Should().BeEquivalentTo(d2);
|
d.Should().Equal(d2);
|
||||||
e.Should().BeEquivalentTo(e2);
|
e.Should().Equal(e2);
|
||||||
f.Should().BeEquivalentTo(f2);
|
f.Should().Equal(f2);
|
||||||
g.Should().BeEquivalentTo(g2);
|
g.Should().Equal(g2);
|
||||||
h.Should().BeEquivalentTo(h2);
|
h.Should().Equal(h2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace NetCoreTests.Linq
|
|||||||
rp.Value = 4;
|
rp.Value = 4;
|
||||||
rp.Value = 5;
|
rp.Value = 5;
|
||||||
|
|
||||||
(await xs).Should().BeEquivalentTo(1, 2, 3, 4, 5);
|
(await xs).Should().Equal(1, 2, 3, 4, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -39,7 +39,7 @@ namespace NetCoreTests.Linq
|
|||||||
rp.Value = 4;
|
rp.Value = 4;
|
||||||
rp.Value = 5;
|
rp.Value = 5;
|
||||||
|
|
||||||
(await xs).Should().BeEquivalentTo(1, 2, 3, 4);
|
(await xs).Should().Equal(1, 2, 3, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -56,7 +56,7 @@ namespace NetCoreTests.Linq
|
|||||||
await c;
|
await c;
|
||||||
var foo = await xs;
|
var foo = await xs;
|
||||||
|
|
||||||
foo.Should().BeEquivalentTo(new[] { 1, 10, 20 });
|
foo.Should().Equal(new[] { 1, 10, 20 });
|
||||||
|
|
||||||
async Task CancelAsync()
|
async Task CancelAsync()
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ namespace NetCoreTests.Linq
|
|||||||
await c;
|
await c;
|
||||||
var foo = await xs;
|
var foo = await xs;
|
||||||
|
|
||||||
foo.Should().BeEquivalentTo(new[] { 20, 30, 40 });
|
foo.Should().Equal(new[] { 20, 30, 40 });
|
||||||
|
|
||||||
async Task CancelAsync()
|
async Task CancelAsync()
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ namespace NetCoreTests.Linq
|
|||||||
await c;
|
await c;
|
||||||
var foo = await xs;
|
var foo = await xs;
|
||||||
|
|
||||||
foo.Should().BeEquivalentTo(new[] { 1, 10, 20 });
|
foo.Should().Equal(new[] { 1, 10, 20 });
|
||||||
|
|
||||||
async Task CancelAsync()
|
async Task CancelAsync()
|
||||||
{
|
{
|
||||||
@@ -145,7 +145,7 @@ namespace NetCoreTests.Linq
|
|||||||
await c;
|
await c;
|
||||||
var foo = await xs;
|
var foo = await xs;
|
||||||
|
|
||||||
foo.Should().BeEquivalentTo(new[] { 20, 30, 40 });
|
foo.Should().Equal(new[] { 20, 30, 40 });
|
||||||
|
|
||||||
async Task CancelAsync()
|
async Task CancelAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ namespace NetCoreTests
|
|||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
ev.SetCanceled(default);
|
ev.SetCanceled(default);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
one.CompletedCalled.Count.Should().Be(1);
|
one.CompletedCalled.Count.Should().Be(1);
|
||||||
}
|
}
|
||||||
// after removed, onemore
|
// after removed, onemore
|
||||||
@@ -59,7 +59,7 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ namespace NetCoreTests
|
|||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
ev.SetCanceled(default);
|
ev.SetCanceled(default);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
one.CompletedCalled.Count.Should().Be(1);
|
one.CompletedCalled.Count.Should().Be(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,10 +102,10 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
four.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
four.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
|
|
||||||
@@ -120,11 +120,11 @@ namespace NetCoreTests
|
|||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
ev.SetCanceled(default);
|
ev.SetCanceled(default);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
one.CompletedCalled.Count.Should().Be(1);
|
one.CompletedCalled.Count.Should().Be(1);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.CompletedCalled.Count.Should().Be(1);
|
three.CompletedCalled.Count.Should().Be(1);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.CompletedCalled.Count.Should().Be(1);
|
three.CompletedCalled.Count.Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,10 +145,10 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
ev.Add(four);
|
ev.Add(four);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
four.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
four.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
|
|
||||||
@@ -163,11 +163,11 @@ namespace NetCoreTests
|
|||||||
ev.SetCompleted();
|
ev.SetCompleted();
|
||||||
ev.SetCanceled(default);
|
ev.SetCanceled(default);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
one.CompletedCalled.Count.Should().Be(1);
|
one.CompletedCalled.Count.Should().Be(1);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.CompletedCalled.Count.Should().Be(1);
|
three.CompletedCalled.Count.Should().Be(1);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.CompletedCalled.Count.Should().Be(1);
|
three.CompletedCalled.Count.Should().Be(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,9 +190,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.Remove(one);
|
ev.Remove(one);
|
||||||
|
|
||||||
@@ -200,9 +200,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(50);
|
ev.SetResult(50);
|
||||||
ev.SetResult(60);
|
ev.SetResult(60);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60);
|
two.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60);
|
three.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -222,9 +222,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.Remove(two);
|
ev.Remove(two);
|
||||||
|
|
||||||
@@ -232,9 +232,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(50);
|
ev.SetResult(50);
|
||||||
ev.SetResult(60);
|
ev.SetResult(60);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60);
|
one.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60);
|
three.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -254,9 +254,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
|
|
||||||
ev.Remove(three);
|
ev.Remove(three);
|
||||||
|
|
||||||
@@ -264,9 +264,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(50);
|
ev.SetResult(50);
|
||||||
ev.SetResult(60);
|
ev.SetResult(60);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60);
|
one.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40, 50, 60);
|
two.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,9 +321,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10);
|
one.NextCalled.Should().Equal(10);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run2()
|
public void Run2()
|
||||||
@@ -342,9 +342,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10);
|
one.NextCalled.Should().Equal(10);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run3()
|
public void Run3()
|
||||||
@@ -363,9 +363,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10);
|
one.NextCalled.Should().Equal(10);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
two.NextCalled.Should().Equal(10, 20, 30);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,9 +390,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Count.Should().Be(0);
|
two.NextCalled.Count.Should().Be(0);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run2()
|
public void Run2()
|
||||||
@@ -412,9 +412,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10);
|
two.NextCalled.Should().Equal(10);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run3()
|
public void Run3()
|
||||||
@@ -434,9 +434,9 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Should().BeEquivalentTo(10);
|
two.NextCalled.Should().Equal(10);
|
||||||
three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
three.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,10 +464,10 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
one.NextCalled.Should().Equal(10, 20, 30);
|
||||||
two.NextCalled.Count.Should().Be(0);
|
two.NextCalled.Count.Should().Be(0);
|
||||||
three.NextCalled.Count.Should().Be(0);
|
three.NextCalled.Count.Should().Be(0);
|
||||||
four.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
four.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run2()
|
public void Run2()
|
||||||
@@ -490,10 +490,10 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(20);
|
ev.SetResult(20);
|
||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10);
|
one.NextCalled.Should().Equal(10);
|
||||||
two.NextCalled.Count.Should().Be(0);
|
two.NextCalled.Count.Should().Be(0);
|
||||||
three.NextCalled.Count.Should().Be(0);
|
three.NextCalled.Count.Should().Be(0);
|
||||||
four.NextCalled.Should().BeEquivalentTo(10, 20, 30);
|
four.NextCalled.Should().Equal(10, 20, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -533,10 +533,10 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
ev.SetResult(40);
|
ev.SetResult(40);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40);
|
one.NextCalled.Should().Equal(10, 20, 30, 40);
|
||||||
two.NextCalled.Should().BeEquivalentTo(20, 30, 40);
|
two.NextCalled.Should().Equal(20, 30, 40);
|
||||||
three.NextCalled.Should().BeEquivalentTo(30, 40);
|
three.NextCalled.Should().Equal(30, 40);
|
||||||
four.NextCalled.Should().BeEquivalentTo(40);
|
four.NextCalled.Should().Equal(40);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run2()
|
public void Run2()
|
||||||
@@ -573,10 +573,10 @@ namespace NetCoreTests
|
|||||||
ev.SetResult(30);
|
ev.SetResult(30);
|
||||||
ev.SetResult(40);
|
ev.SetResult(40);
|
||||||
|
|
||||||
one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40);
|
one.NextCalled.Should().Equal(10, 20, 30, 40);
|
||||||
two.NextCalled.Should().BeEquivalentTo(20, 30, 40);
|
two.NextCalled.Should().Equal(20, 30, 40);
|
||||||
three.NextCalled.Should().BeEquivalentTo(30, 40);
|
three.NextCalled.Should().Equal(30, 40);
|
||||||
four.NextCalled.Should().BeEquivalentTo(40);
|
four.NextCalled.Should().Equal(40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace NetCoreTests
|
|||||||
{
|
{
|
||||||
CancellationTokenSource cts = new CancellationTokenSource();
|
CancellationTokenSource cts = new CancellationTokenSource();
|
||||||
|
|
||||||
var v = await UniTask.Run(() => 10).WithCancellation(cts.Token);
|
var v = await UniTask.Run(() => 10).AttachExternalCancellation(cts.Token);
|
||||||
|
|
||||||
v.Should().Be(10);
|
v.Should().Be(10);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace NetCoreTests
|
|||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||||
return 10;
|
return 10;
|
||||||
}).WithCancellation(cts.Token);
|
}).AttachExternalCancellation(cts.Token);
|
||||||
|
|
||||||
cts.Cancel();
|
cts.Cancel();
|
||||||
|
|
||||||
|
|||||||
@@ -1,734 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>10.0.20506</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<RootNamespace></RootNamespace>
|
|
||||||
<ProjectGuid>{CECB0124-DA37-D676-2B9E-00C5241684F4}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<AssemblyName>Assembly-CSharp-firstpass</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<BaseDirectory>.</BaseDirectory>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>Temp\Bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE;UNITY_2020_2_1;UNITY_2020_2;UNITY_2020;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<NoWarn>0169</NoWarn>
|
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>Temp\bin\Release\</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<NoWarn>0169</NoWarn>
|
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<NoConfig>true</NoConfig>
|
|
||||||
<NoStdLib>true</NoStdLib>
|
|
||||||
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
|
|
||||||
<ImplicitlyExpandNETStandardFacades>false</ImplicitlyExpandNETStandardFacades>
|
|
||||||
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<UnityProjectGenerator>Package</UnityProjectGenerator>
|
|
||||||
<UnityProjectGeneratorVersion>2.0.5</UnityProjectGeneratorVersion>
|
|
||||||
<UnityProjectType>GamePlugins:3</UnityProjectType>
|
|
||||||
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
|
|
||||||
<UnityVersion>2020.2.1f1</UnityVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Analyzer Include="C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\16.0\Analyzers\Microsoft.Unity.Analyzers.dll" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\AsyncUniTaskMethodBuilder.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Bridge.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\EnumerableAsyncExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\Error.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Channel.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\IUniTaskSource.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Progress.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\PooledDelegate.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAny.Generated.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.uGUI.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.MonoBehaviour.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskCompletionSource.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\DiagnosticsExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\AsyncMethodBuilderAttribute.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncAwakeTrigger.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\AsyncUniTaskVoidMethodBuilder.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\IUniTaskAsyncEnumerable.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\_InternalVisibleTo.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\AsyncUnit.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\RuntimeHelpersAbstraction.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\TriggerEvent.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Threading.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskVoid.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\TaskPool.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityBindingExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncTriggerBase.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityWebRequestException.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\WeakDictionary.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ArrayPool.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncStartTrigger.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskExtensions.Shorthand.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskScheduler.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAll.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Factory.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ValueStopwatch.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ContinuationQueue.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.AssetBundleRequestAllAssets.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\PlayerLoopRunner.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WaitUntil.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Run.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ArrayUtil.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\MoveNextSource.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\MonoBehaviourMessagesTriggers.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\ExceptionExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\AsyncReactiveProperty.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\AsyncLazy.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAny.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\MinimumQueue.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAll.Generated.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\StateMachineRunner.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\StatePool.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.AsyncGPUReadback.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.Jobs.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskObservableExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncTriggerExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CancellationTokenExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ArrayPoolUtil.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\TaskTracker.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncDestroyTrigger.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\UnityEqualityComparer.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\UnityWebRequestExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CancellationTokenEqualityComparer.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Assets\Plugins\UniTask\Runtime\UniTask.asmdef" />
|
|
||||||
<Reference Include="UnityEngine">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ARModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ARModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AccessibilityModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AccessibilityModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AndroidJNIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AndroidJNIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AnimationModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AnimationModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AssetBundleModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AssetBundleModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AudioModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AudioModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ClusterInputModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClusterInputModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ClusterRendererModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClusterRendererModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.CoreModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.CrashReportingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.CrashReportingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.DSPGraphModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.DSPGraphModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.DirectorModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.DirectorModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.GIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.GIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.GameCenterModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.GameCenterModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.GridModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.GridModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.HotReloadModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.HotReloadModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.IMGUIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.IMGUIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ImageConversionModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ImageConversionModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.InputModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.InputModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.InputLegacyModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.InputLegacyModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.JSONSerializeModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.JSONSerializeModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.LocalizationModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.LocalizationModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ParticleSystemModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ParticleSystemModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.PerformanceReportingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.PerformanceReportingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ProfilerModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ProfilerModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ScreenCaptureModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ScreenCaptureModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SharedInternalsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SharedInternalsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SpriteMaskModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SpriteMaskModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SpriteShapeModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SpriteShapeModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.StreamingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.StreamingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SubstanceModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SubstanceModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TLSModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TLSModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TerrainModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TerrainModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextCoreModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TextCoreModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TextRenderingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UIElementsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIElementsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UIElementsNativeModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIElementsNativeModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UNETModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UNETModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UmbraModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UmbraModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityAnalyticsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityAnalyticsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityConnectModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityConnectModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityCurlModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityCurlModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityTestProtocolModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityTestProtocolModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestAssetBundleModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestAssetBundleModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestTextureModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestTextureModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.VFXModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.VFXModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.VideoModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.VideoModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.VirtualTexturingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.VirtualTexturingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.WindModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.WindModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.CoreModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.CoreModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.GraphViewModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.GraphViewModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.PackageManagerUIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.PackageManagerUIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.SceneTemplateModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.SceneTemplateModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UIElementsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UIElementsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UIElementsSamplesModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UIElementsSamplesModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UIServiceModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UIServiceModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UnityConnectModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UnityConnectModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="nunit.framework">
|
|
||||||
<HintPath>Library\PackageCache\com.unity.ext.nunit@1.0.5\net35\unity-custom\nunit.framework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="netstandard">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\ref\2.0.0\netstandard.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Win32.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\Microsoft.Win32.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.AppContext">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.AppContext.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections.Concurrent">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.Concurrent.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections.NonGeneric">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.NonGeneric.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections.Specialized">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.Specialized.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.EventBasedAsync">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.EventBasedAsync.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.TypeConverter">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.TypeConverter.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Console">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Console.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Data.Common">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Data.Common.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Contracts">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Contracts.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Debug">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Debug.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.FileVersionInfo">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.FileVersionInfo.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Process">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Process.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.StackTrace">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.StackTrace.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.TextWriterTraceListener">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.TextWriterTraceListener.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Tools">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Tools.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.TraceSource">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.TraceSource.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Tracing">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Tracing.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Drawing.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Drawing.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Dynamic.Runtime">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Dynamic.Runtime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Globalization.Calendars">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Globalization.Calendars.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Globalization">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Globalization.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Globalization.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Globalization.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.Compression.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression.ZipFile">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.Compression.ZipFile.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem.DriveInfo">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.DriveInfo.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem.Watcher">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.Watcher.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.IsolatedStorage">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.IsolatedStorage.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.MemoryMappedFiles">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.MemoryMappedFiles.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Pipes">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.Pipes.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.UnmanagedMemoryStream">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.UnmanagedMemoryStream.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq.Expressions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.Expressions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq.Parallel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.Parallel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq.Queryable">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.Queryable.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Http">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Http.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.NameResolution">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.NameResolution.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.NetworkInformation">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.NetworkInformation.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Ping">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Ping.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Requests">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Requests.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Security">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Security.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Sockets">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Sockets.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.WebHeaderCollection">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.WebHeaderCollection.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.WebSockets.Client">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.WebSockets.Client.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.WebSockets">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.WebSockets.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ObjectModel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ObjectModel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reflection">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Reflection.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reflection.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Reflection.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reflection.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Reflection.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Resources.Reader">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Resources.Reader.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Resources.ResourceManager">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Resources.ResourceManager.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Resources.Writer">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Resources.Writer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.CompilerServices.VisualC">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.CompilerServices.VisualC.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Handles">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Handles.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.InteropServices.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Numerics">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Numerics.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Formatters">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Formatters.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Json">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Xml">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Xml.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Claims">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Claims.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Algorithms">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Algorithms.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Csp">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Csp.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Encoding">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Encoding.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.X509Certificates">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Principal">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Principal.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.SecureString">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.SecureString.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Text.Encoding">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Text.Encoding.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Text.Encoding.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Text.Encoding.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Text.RegularExpressions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Text.RegularExpressions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Overlapped">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Overlapped.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Tasks">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Tasks.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Tasks.Parallel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Tasks.Parallel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Thread">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Thread.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.ThreadPool">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.ThreadPool.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Timer">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Timer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ValueTuple">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ValueTuple.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.ReaderWriter">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.ReaderWriter.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XDocument">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XDocument.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XmlDocument">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XmlDocument.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XmlSerializer">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XmlSerializer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XPath">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XPath.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XPath.XDocument">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XPath.XDocument.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Numerics.Vectors">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\Extensions\2.0.0\System.Numerics.Vectors.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices.WindowsRuntime">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\Extensions\2.0.0\System.Runtime.InteropServices.WindowsRuntime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="mscorlib">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\mscorlib.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.Composition">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.ComponentModel.Composition.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Core">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Data">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Data.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Drawing">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Drawing.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression.FileSystem">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.IO.Compression.FileSystem.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Net.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Numerics">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Numerics.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Runtime.Serialization.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ServiceModel.Web">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.ServiceModel.Web.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Transactions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Transactions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Web">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Web.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Windows">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Windows.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Xml.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.Linq">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Xml.Linq.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.Serialization">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Xml.Serialization.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.VSCode.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.VSCode.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.CacheServer">
|
|
||||||
<HintPath>Library\ScriptAssemblies\UnityEditor.CacheServer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.VisualStudio.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.VisualStudio.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Addressables">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.Addressables.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.ScriptableBuildPipeline">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.ScriptableBuildPipeline.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Addressables.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.Addressables.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.ScriptableBuildPipeline.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.ScriptableBuildPipeline.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.ResourceManager">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.ResourceManager.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Rider.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.Rider.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="UniTask.TextMeshPro.csproj">
|
|
||||||
<Project>{B5929667-6CB2-8779-D894-4F69110C1A43}</Project>
|
|
||||||
<Name>UniTask.TextMeshPro</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="TempAsm.csproj">
|
|
||||||
<Project>{9E0EF10C-B6E1-E08E-3160-7162D66F7EE0}</Project>
|
|
||||||
<Name>TempAsm</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="UniTask.DOTween.csproj">
|
|
||||||
<Project>{7121D833-D063-D143-CFFC-CD50DDF1B3D1}</Project>
|
|
||||||
<Name>UniTask.DOTween</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="UniTask.Addressables.csproj">
|
|
||||||
<Project>{78124C71-0355-1FB9-3AEB-7D573CD8E7CA}</Project>
|
|
||||||
<Name>UniTask.Addressables</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="UniTask.Linq.csproj">
|
|
||||||
<Project>{7F0F67EA-D985-C15F-AAE8-F643789B52A7}</Project>
|
|
||||||
<Name>UniTask.Linq</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Target Name="GenerateTargetFrameworkMonikerAttribute" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
@@ -4,31 +4,29 @@ using System.Threading;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Cysharp.Threading.Tasks.Triggers;
|
using Cysharp.Threading.Tasks.Triggers;
|
||||||
using System;
|
using System;
|
||||||
|
using Cysharp.Threading.Tasks.Internal;
|
||||||
|
|
||||||
namespace Cysharp.Threading.Tasks
|
namespace Cysharp.Threading.Tasks
|
||||||
{
|
{
|
||||||
public static class CancellationTokenSourceExtensions
|
|
||||||
|
public static partial class CancellationTokenSourceExtensions
|
||||||
{
|
{
|
||||||
public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
readonly static Action<object> CancelCancellationTokenSourceStateDelegate = new Action<object>(CancelCancellationTokenSourceState);
|
||||||
|
|
||||||
|
static void CancelCancellationTokenSourceState(object state)
|
||||||
{
|
{
|
||||||
var delay = UniTask.Delay(millisecondsDelay, delayType, delayTiming, cts.Token);
|
var cts = (CancellationTokenSource)state;
|
||||||
CancelAfterCore(cts, delay).Forget();
|
cts.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
public static IDisposable CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
||||||
{
|
{
|
||||||
var delay = UniTask.Delay(delayTimeSpan, delayType, delayTiming, cts.Token);
|
return CancelAfterSlim(cts, TimeSpan.FromMilliseconds(millisecondsDelay), delayType, delayTiming);
|
||||||
CancelAfterCore(cts, delay).Forget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async UniTaskVoid CancelAfterCore(CancellationTokenSource cts, UniTask delayTask)
|
public static IDisposable CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
||||||
{
|
{
|
||||||
var alreadyCanceled = await delayTask.SuppressCancellationThrow();
|
return PlayerLoopTimer.StartNew(delayTimeSpan, false, delayType, delayTiming, cts.Token, CancelCancellationTokenSourceStateDelegate, cts);
|
||||||
if (!alreadyCanceled)
|
|
||||||
{
|
|
||||||
cts.Cancel();
|
|
||||||
cts.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, Component component)
|
public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, Component component)
|
||||||
@@ -39,11 +37,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, GameObject gameObject)
|
public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, GameObject gameObject)
|
||||||
{
|
{
|
||||||
var trigger = gameObject.GetAsyncDestroyTrigger();
|
var trigger = gameObject.GetAsyncDestroyTrigger();
|
||||||
trigger.CancellationToken.RegisterWithoutCaptureExecutionContext(state =>
|
trigger.CancellationToken.RegisterWithoutCaptureExecutionContext(CancelCancellationTokenSourceStateDelegate, cts);
|
||||||
{
|
|
||||||
var cts2 = (CancellationTokenSource)state;
|
|
||||||
cts2.Cancel();
|
|
||||||
}, cts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Cysharp.Threading.Tasks.Linq
|
|||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(source, nameof(source));
|
Error.ThrowArgumentNullException(source, nameof(source));
|
||||||
|
|
||||||
return new AppendPrepend<TSource>(source, element, true);
|
return new AppendPrepend<TSource>(source, element, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ namespace Cysharp.Threading.Tasks.Linq
|
|||||||
|
|
||||||
if (enumerator == null)
|
if (enumerator == null)
|
||||||
{
|
{
|
||||||
if (state == State.RequireAppend)
|
if (state == State.RequirePrepend)
|
||||||
{
|
{
|
||||||
Current = element;
|
Current = element;
|
||||||
state = State.None;
|
state = State.None;
|
||||||
|
|||||||
@@ -98,6 +98,79 @@ namespace Cysharp.Threading.Tasks
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum InjectPlayerLoopTimings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Preset: All loops(default).
|
||||||
|
/// </summary>
|
||||||
|
All =
|
||||||
|
Initialization | LastInitialization |
|
||||||
|
EarlyUpdate | LastEarlyUpdate |
|
||||||
|
FixedUpdate | LastFixedUpdate |
|
||||||
|
PreUpdate | LastPreUpdate |
|
||||||
|
Update | LastUpdate |
|
||||||
|
PreLateUpdate | LastPreLateUpdate |
|
||||||
|
PostLateUpdate | LastPostLateUpdate
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
| TimeUpdate | LastTimeUpdate,
|
||||||
|
#else
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preset: All without last except LastPostLateUpdate.
|
||||||
|
/// </summary>
|
||||||
|
Standard =
|
||||||
|
Initialization |
|
||||||
|
EarlyUpdate |
|
||||||
|
FixedUpdate |
|
||||||
|
PreUpdate |
|
||||||
|
Update |
|
||||||
|
PreLateUpdate |
|
||||||
|
PostLateUpdate | LastPostLateUpdate
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
| TimeUpdate
|
||||||
|
#endif
|
||||||
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preset: Minimum pattern, Update | FixedUpdate | LastPostLateUpdate
|
||||||
|
/// </summary>
|
||||||
|
Minimum =
|
||||||
|
Update | FixedUpdate | LastPostLateUpdate,
|
||||||
|
|
||||||
|
// PlayerLoopTiming
|
||||||
|
|
||||||
|
Initialization = 1,
|
||||||
|
LastInitialization = 2,
|
||||||
|
|
||||||
|
EarlyUpdate = 4,
|
||||||
|
LastEarlyUpdate = 8,
|
||||||
|
|
||||||
|
FixedUpdate = 16,
|
||||||
|
LastFixedUpdate = 32,
|
||||||
|
|
||||||
|
PreUpdate = 64,
|
||||||
|
LastPreUpdate = 128,
|
||||||
|
|
||||||
|
Update = 256,
|
||||||
|
LastUpdate = 512,
|
||||||
|
|
||||||
|
PreLateUpdate = 1024,
|
||||||
|
LastPreLateUpdate = 2048,
|
||||||
|
|
||||||
|
PostLateUpdate = 4096,
|
||||||
|
LastPostLateUpdate = 8192
|
||||||
|
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
,
|
||||||
|
// Unity 2020.2 added TimeUpdate https://docs.unity3d.com/2020.2/Documentation/ScriptReference/PlayerLoop.TimeUpdate.html
|
||||||
|
TimeUpdate = 16384,
|
||||||
|
LastTimeUpdate = 32768
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public interface IPlayerLoopItem
|
public interface IPlayerLoopItem
|
||||||
{
|
{
|
||||||
bool MoveNext();
|
bool MoveNext();
|
||||||
@@ -105,7 +178,10 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static class PlayerLoopHelper
|
public static class PlayerLoopHelper
|
||||||
{
|
{
|
||||||
public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContetext;
|
static readonly ContinuationQueue ThrowMarkerContinuationQueue = new ContinuationQueue(PlayerLoopTiming.Initialization);
|
||||||
|
static readonly PlayerLoopRunner ThrowMarkerPlayerLoopRunner = new PlayerLoopRunner(PlayerLoopTiming.Initialization);
|
||||||
|
|
||||||
|
public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContext;
|
||||||
public static int MainThreadId => mainThreadId;
|
public static int MainThreadId => mainThreadId;
|
||||||
internal static string ApplicationDataPath => applicationDataPath;
|
internal static string ApplicationDataPath => applicationDataPath;
|
||||||
|
|
||||||
@@ -113,13 +189,14 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
static int mainThreadId;
|
static int mainThreadId;
|
||||||
static string applicationDataPath;
|
static string applicationDataPath;
|
||||||
static SynchronizationContext unitySynchronizationContetext;
|
static SynchronizationContext unitySynchronizationContext;
|
||||||
static ContinuationQueue[] yielders;
|
static ContinuationQueue[] yielders;
|
||||||
static PlayerLoopRunner[] runners;
|
static PlayerLoopRunner[] runners;
|
||||||
internal static bool IsEditorApplicationQuitting { get; private set; }
|
internal static bool IsEditorApplicationQuitting { get; private set; }
|
||||||
static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem,
|
static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem,
|
||||||
Type loopRunnerYieldType, ContinuationQueue cq, Type lastLoopRunnerYieldType, ContinuationQueue lastCq,
|
bool injectOnFirst,
|
||||||
Type loopRunnerType, PlayerLoopRunner runner, Type lastLoopRunnerType, PlayerLoopRunner lastRunner)
|
Type loopRunnerYieldType, ContinuationQueue cq,
|
||||||
|
Type loopRunnerType, PlayerLoopRunner runner)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
@@ -134,22 +211,11 @@ namespace Cysharp.Threading.Tasks
|
|||||||
runner.Run();
|
runner.Run();
|
||||||
runner.Clear();
|
runner.Clear();
|
||||||
}
|
}
|
||||||
if (lastRunner != null)
|
|
||||||
{
|
|
||||||
lastRunner.Run();
|
|
||||||
lastRunner.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cq != null)
|
if (cq != null)
|
||||||
{
|
{
|
||||||
cq.Run();
|
cq.Run();
|
||||||
cq.Clear();
|
cq.Clear();
|
||||||
}
|
}
|
||||||
if (lastCq != null)
|
|
||||||
{
|
|
||||||
lastCq.Run();
|
|
||||||
lastCq.Clear();
|
|
||||||
}
|
|
||||||
IsEditorApplicationQuitting = false;
|
IsEditorApplicationQuitting = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -161,40 +227,38 @@ namespace Cysharp.Threading.Tasks
|
|||||||
updateDelegate = cq.Run
|
updateDelegate = cq.Run
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastYieldLoop = new PlayerLoopSystem
|
|
||||||
{
|
|
||||||
type = lastLoopRunnerYieldType,
|
|
||||||
updateDelegate = lastCq.Run
|
|
||||||
};
|
|
||||||
|
|
||||||
var runnerLoop = new PlayerLoopSystem
|
var runnerLoop = new PlayerLoopSystem
|
||||||
{
|
{
|
||||||
type = loopRunnerType,
|
type = loopRunnerType,
|
||||||
updateDelegate = runner.Run
|
updateDelegate = runner.Run
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastRunnerLoop = new PlayerLoopSystem
|
|
||||||
{
|
|
||||||
type = lastLoopRunnerType,
|
|
||||||
updateDelegate = lastRunner.Run
|
|
||||||
};
|
|
||||||
|
|
||||||
// Remove items from previous initializations.
|
// Remove items from previous initializations.
|
||||||
var source = loopSystem.subSystemList
|
var source = RemoveRunner(loopSystem, loopRunnerYieldType, loopRunnerType);
|
||||||
.Where(ls => ls.type != loopRunnerYieldType && ls.type != loopRunnerType && ls.type != lastLoopRunnerYieldType && ls.type != lastLoopRunnerType)
|
var dest = new PlayerLoopSystem[source.Length + 2];
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
var dest = new PlayerLoopSystem[source.Length + 4];
|
Array.Copy(source, 0, dest, injectOnFirst ? 2 : 0, source.Length);
|
||||||
|
if (injectOnFirst)
|
||||||
Array.Copy(source, 0, dest, 2, source.Length);
|
{
|
||||||
dest[0] = yieldLoop;
|
dest[0] = yieldLoop;
|
||||||
dest[1] = runnerLoop;
|
dest[1] = runnerLoop;
|
||||||
dest[dest.Length - 2] = lastYieldLoop;
|
}
|
||||||
dest[dest.Length - 1] = lastRunnerLoop;
|
else
|
||||||
|
{
|
||||||
|
dest[dest.Length - 2] = yieldLoop;
|
||||||
|
dest[dest.Length - 1] = runnerLoop;
|
||||||
|
}
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PlayerLoopSystem[] RemoveRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, Type loopRunnerType)
|
||||||
|
{
|
||||||
|
return loopSystem.subSystemList
|
||||||
|
.Where(ls => ls.type != loopRunnerYieldType && ls.type != loopRunnerType)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
static PlayerLoopSystem[] InsertUniTaskSynchronizationContext(PlayerLoopSystem loopSystem)
|
static PlayerLoopSystem[] InsertUniTaskSynchronizationContext(PlayerLoopSystem loopSystem)
|
||||||
{
|
{
|
||||||
var loop = new PlayerLoopSystem
|
var loop = new PlayerLoopSystem
|
||||||
@@ -225,7 +289,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
static void Init()
|
static void Init()
|
||||||
{
|
{
|
||||||
// capture default(unity) sync-context.
|
// capture default(unity) sync-context.
|
||||||
unitySynchronizationContetext = SynchronizationContext.Current;
|
unitySynchronizationContext = SynchronizationContext.Current;
|
||||||
mainThreadId = Thread.CurrentThread.ManagedThreadId;
|
mainThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -311,7 +375,23 @@ namespace Cysharp.Threading.Tasks
|
|||||||
throw new Exception("Target PlayerLoopSystem does not found. Type:" + systemType.FullName);
|
throw new Exception("Target PlayerLoopSystem does not found. Type:" + systemType.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Initialize(ref PlayerLoopSystem playerLoop)
|
static void InsertLoop(PlayerLoopSystem[] copyList, InjectPlayerLoopTimings injectTimings, Type loopType, InjectPlayerLoopTimings targetTimings,
|
||||||
|
int index, bool injectOnFirst, Type loopRunnerYieldType, Type loopRunnerType, PlayerLoopTiming playerLoopTiming)
|
||||||
|
{
|
||||||
|
var i = FindLoopSystemIndex(copyList, loopType);
|
||||||
|
if ((injectTimings & targetTimings) == targetTimings)
|
||||||
|
{
|
||||||
|
copyList[i].subSystemList = InsertRunner(copyList[i], injectOnFirst,
|
||||||
|
loopRunnerYieldType, yielders[index] = new ContinuationQueue(playerLoopTiming),
|
||||||
|
loopRunnerType, runners[index] = new PlayerLoopRunner(playerLoopTiming));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
copyList[i].subSystemList = RemoveRunner(copyList[i], loopRunnerYieldType, loopRunnerType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Initialize(ref PlayerLoopSystem playerLoop, InjectPlayerLoopTimings injectTimings = InjectPlayerLoopTimings.All)
|
||||||
{
|
{
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
yielders = new ContinuationQueue[16];
|
yielders = new ContinuationQueue[16];
|
||||||
@@ -323,58 +403,82 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
var copyList = playerLoop.subSystemList.ToArray();
|
var copyList = playerLoop.subSystemList.ToArray();
|
||||||
|
|
||||||
var i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Initialization));
|
// Initialization
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldInitialization), yielders[0] = new ContinuationQueue(PlayerLoopTiming.Initialization),
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Initialization),
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldInitialization), yielders[1] = new ContinuationQueue(PlayerLoopTiming.LastInitialization),
|
InjectPlayerLoopTimings.Initialization, 0, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization), runners[0] = new PlayerLoopRunner(PlayerLoopTiming.Initialization),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldInitialization), typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization), PlayerLoopTiming.Initialization);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastInitialization), runners[1] = new PlayerLoopRunner(PlayerLoopTiming.LastInitialization));
|
|
||||||
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Initialization),
|
||||||
|
InjectPlayerLoopTimings.LastInitialization, 1, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldInitialization), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastInitialization), PlayerLoopTiming.LastInitialization);
|
||||||
|
|
||||||
// EarlyUpdate
|
// EarlyUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.EarlyUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.EarlyUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldEarlyUpdate), yielders[2] = new ContinuationQueue(PlayerLoopTiming.EarlyUpdate),
|
InjectPlayerLoopTimings.EarlyUpdate, 2, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldEarlyUpdate), yielders[3] = new ContinuationQueue(PlayerLoopTiming.LastEarlyUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldEarlyUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerEarlyUpdate), PlayerLoopTiming.EarlyUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerEarlyUpdate), runners[2] = new PlayerLoopRunner(PlayerLoopTiming.EarlyUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastEarlyUpdate), runners[3] = new PlayerLoopRunner(PlayerLoopTiming.LastEarlyUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.EarlyUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastEarlyUpdate, 3, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldEarlyUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastEarlyUpdate), PlayerLoopTiming.LastEarlyUpdate);
|
||||||
|
|
||||||
// FixedUpdate
|
// FixedUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.FixedUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.FixedUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldFixedUpdate), yielders[4] = new ContinuationQueue(PlayerLoopTiming.FixedUpdate),
|
InjectPlayerLoopTimings.FixedUpdate, 4, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldFixedUpdate), yielders[5] = new ContinuationQueue(PlayerLoopTiming.LastFixedUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldFixedUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerFixedUpdate), PlayerLoopTiming.FixedUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerFixedUpdate), runners[4] = new PlayerLoopRunner(PlayerLoopTiming.FixedUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastFixedUpdate), runners[5] = new PlayerLoopRunner(PlayerLoopTiming.LastFixedUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.FixedUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastFixedUpdate, 5, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldFixedUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastFixedUpdate), PlayerLoopTiming.LastFixedUpdate);
|
||||||
|
|
||||||
// PreUpdate
|
// PreUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.PreUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreUpdate), yielders[6] = new ContinuationQueue(PlayerLoopTiming.PreUpdate),
|
InjectPlayerLoopTimings.PreUpdate, 6, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreUpdate), yielders[7] = new ContinuationQueue(PlayerLoopTiming.LastPreUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreUpdate), PlayerLoopTiming.PreUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreUpdate), runners[6] = new PlayerLoopRunner(PlayerLoopTiming.PreUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreUpdate), runners[7] = new PlayerLoopRunner(PlayerLoopTiming.LastPreUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastPreUpdate, 7, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreUpdate), PlayerLoopTiming.LastPreUpdate);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Update),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldUpdate), yielders[8] = new ContinuationQueue(PlayerLoopTiming.Update),
|
InjectPlayerLoopTimings.Update, 8, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldUpdate), yielders[9] = new ContinuationQueue(PlayerLoopTiming.LastUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerUpdate), PlayerLoopTiming.Update);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerUpdate), runners[8] = new PlayerLoopRunner(PlayerLoopTiming.Update),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastUpdate), runners[9] = new PlayerLoopRunner(PlayerLoopTiming.LastUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Update),
|
||||||
|
InjectPlayerLoopTimings.LastUpdate, 9, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastUpdate), PlayerLoopTiming.LastUpdate);
|
||||||
|
|
||||||
// PreLateUpdate
|
// PreLateUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.PreLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreLateUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreLateUpdate), yielders[10] = new ContinuationQueue(PlayerLoopTiming.PreLateUpdate),
|
InjectPlayerLoopTimings.PreLateUpdate, 10, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreLateUpdate), yielders[11] = new ContinuationQueue(PlayerLoopTiming.LastPreLateUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreLateUpdate), PlayerLoopTiming.PreLateUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreLateUpdate), runners[10] = new PlayerLoopRunner(PlayerLoopTiming.PreLateUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreLateUpdate), runners[11] = new PlayerLoopRunner(PlayerLoopTiming.LastPreLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreLateUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastPreLateUpdate, 11, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreLateUpdate), PlayerLoopTiming.LastPreLateUpdate);
|
||||||
|
|
||||||
// PostLateUpdate
|
// PostLateUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.PostLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PostLateUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPostLateUpdate), yielders[12] = new ContinuationQueue(PlayerLoopTiming.PostLateUpdate),
|
InjectPlayerLoopTimings.PostLateUpdate, 12, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPostLateUpdate), yielders[13] = new ContinuationQueue(PlayerLoopTiming.LastPostLateUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPostLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPostLateUpdate), PlayerLoopTiming.PostLateUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerPostLateUpdate), runners[12] = new PlayerLoopRunner(PlayerLoopTiming.PostLateUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPostLateUpdate), runners[13] = new PlayerLoopRunner(PlayerLoopTiming.LastPostLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PostLateUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastPostLateUpdate, 13, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPostLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPostLateUpdate), PlayerLoopTiming.LastPostLateUpdate);
|
||||||
|
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
// TimeUpdate
|
// TimeUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.TimeUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.TimeUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldTimeUpdate), yielders[14] = new ContinuationQueue(PlayerLoopTiming.TimeUpdate),
|
InjectPlayerLoopTimings.TimeUpdate, 14, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldTimeUpdate), yielders[15] = new ContinuationQueue(PlayerLoopTiming.LastTimeUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldTimeUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerTimeUpdate), PlayerLoopTiming.TimeUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerTimeUpdate), runners[14] = new PlayerLoopRunner(PlayerLoopTiming.TimeUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastTimeUpdate), runners[15] = new PlayerLoopRunner(PlayerLoopTiming.LastTimeUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.TimeUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastTimeUpdate, 15, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldTimeUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastTimeUpdate), PlayerLoopTiming.LastTimeUpdate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Insert UniTaskSynchronizationContext to Update loop
|
// Insert UniTaskSynchronizationContext to Update loop
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));
|
var i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));
|
||||||
copyList[i].subSystemList = InsertUniTaskSynchronizationContext(copyList[i]);
|
copyList[i].subSystemList = InsertUniTaskSynchronizationContext(copyList[i]);
|
||||||
|
|
||||||
playerLoop.subSystemList = copyList;
|
playerLoop.subSystemList = copyList;
|
||||||
@@ -383,12 +487,27 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
|
public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
|
||||||
{
|
{
|
||||||
runners[(int)timing].AddAction(action);
|
var runner = runners[(int)timing];
|
||||||
|
if (runner == null)
|
||||||
|
{
|
||||||
|
ThrowInvalidLoopTiming(timing);
|
||||||
|
}
|
||||||
|
runner.AddAction(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ThrowInvalidLoopTiming(PlayerLoopTiming playerLoopTiming)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Target playerLoopTiming is not injected. Please check PlayerLoopHelper.Initialize. PlayerLoopTiming:" + playerLoopTiming);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddContinuation(PlayerLoopTiming timing, Action continuation)
|
public static void AddContinuation(PlayerLoopTiming timing, Action continuation)
|
||||||
{
|
{
|
||||||
yielders[(int)timing].Enqueue(continuation);
|
var q = yielders[(int)timing];
|
||||||
|
if (q == null)
|
||||||
|
{
|
||||||
|
ThrowInvalidLoopTiming(timing);
|
||||||
|
}
|
||||||
|
q.Enqueue(continuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diagnostics helper
|
// Diagnostics helper
|
||||||
|
|||||||
262
src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopTimer.cs
Normal file
262
src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopTimer.cs
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||||
|
|
||||||
|
using System.Threading;
|
||||||
|
using System;
|
||||||
|
using Cysharp.Threading.Tasks.Internal;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Cysharp.Threading.Tasks
|
||||||
|
{
|
||||||
|
public abstract class PlayerLoopTimer : IDisposable, IPlayerLoopItem
|
||||||
|
{
|
||||||
|
readonly CancellationToken cancellationToken;
|
||||||
|
readonly Action<object> timerCallback;
|
||||||
|
readonly object state;
|
||||||
|
readonly PlayerLoopTiming playerLoopTiming;
|
||||||
|
readonly bool periodic;
|
||||||
|
|
||||||
|
bool isRunning;
|
||||||
|
bool tryStop;
|
||||||
|
bool isDisposed;
|
||||||
|
|
||||||
|
protected PlayerLoopTimer(bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)
|
||||||
|
{
|
||||||
|
this.periodic = periodic;
|
||||||
|
this.playerLoopTiming = playerLoopTiming;
|
||||||
|
this.cancellationToken = cancellationToken;
|
||||||
|
this.timerCallback = timerCallback;
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerLoopTimer Create(TimeSpan interval, bool periodic, DelayType delayType, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// force use Realtime.
|
||||||
|
if (PlayerLoopHelper.IsMainThread && !UnityEditor.EditorApplication.isPlaying)
|
||||||
|
{
|
||||||
|
delayType = DelayType.Realtime;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (delayType)
|
||||||
|
{
|
||||||
|
case DelayType.UnscaledDeltaTime:
|
||||||
|
return new IgnoreTimeScalePlayerLoopTimer(interval, periodic, playerLoopTiming, cancellationToken, timerCallback, state);
|
||||||
|
case DelayType.Realtime:
|
||||||
|
return new RealtimePlayerLoopTimer(interval, periodic, playerLoopTiming, cancellationToken, timerCallback, state);
|
||||||
|
case DelayType.DeltaTime:
|
||||||
|
default:
|
||||||
|
return new DeltaTimePlayerLoopTimer(interval, periodic, playerLoopTiming, cancellationToken, timerCallback, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerLoopTimer StartNew(TimeSpan interval, bool periodic, DelayType delayType, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)
|
||||||
|
{
|
||||||
|
var timer = Create(interval, periodic, delayType, playerLoopTiming, cancellationToken, timerCallback, state);
|
||||||
|
timer.Restart();
|
||||||
|
return timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restart(Reset and Start) timer.
|
||||||
|
/// </summary>
|
||||||
|
public void Restart()
|
||||||
|
{
|
||||||
|
if (isDisposed) throw new ObjectDisposedException(null);
|
||||||
|
|
||||||
|
ResetCore(null); // init state
|
||||||
|
if (!isRunning)
|
||||||
|
{
|
||||||
|
isRunning = true;
|
||||||
|
PlayerLoopHelper.AddAction(playerLoopTiming, this);
|
||||||
|
}
|
||||||
|
tryStop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restart(Reset and Start) and change interval.
|
||||||
|
/// </summary>
|
||||||
|
public void Restart(TimeSpan interval)
|
||||||
|
{
|
||||||
|
if (isDisposed) throw new ObjectDisposedException(null);
|
||||||
|
|
||||||
|
ResetCore(interval); // init state
|
||||||
|
if (!isRunning)
|
||||||
|
{
|
||||||
|
isRunning = true;
|
||||||
|
PlayerLoopHelper.AddAction(playerLoopTiming, this);
|
||||||
|
}
|
||||||
|
tryStop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop timer.
|
||||||
|
/// </summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
tryStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void ResetCore(TimeSpan? newInterval);
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
isDisposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPlayerLoopItem.MoveNext()
|
||||||
|
{
|
||||||
|
if (isDisposed)
|
||||||
|
{
|
||||||
|
isRunning = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (tryStop)
|
||||||
|
{
|
||||||
|
isRunning = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
isRunning = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!MoveNextCore())
|
||||||
|
{
|
||||||
|
timerCallback(state);
|
||||||
|
|
||||||
|
if (periodic)
|
||||||
|
{
|
||||||
|
ResetCore(null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isRunning = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract bool MoveNextCore();
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class DeltaTimePlayerLoopTimer : PlayerLoopTimer
|
||||||
|
{
|
||||||
|
int initialFrame;
|
||||||
|
float elapsed;
|
||||||
|
float interval;
|
||||||
|
|
||||||
|
public DeltaTimePlayerLoopTimer(TimeSpan interval, bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)
|
||||||
|
: base(periodic, playerLoopTiming, cancellationToken, timerCallback, state)
|
||||||
|
{
|
||||||
|
ResetCore(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool MoveNextCore()
|
||||||
|
{
|
||||||
|
if (elapsed == 0.0f)
|
||||||
|
{
|
||||||
|
if (initialFrame == Time.frameCount)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed += Time.deltaTime;
|
||||||
|
if (elapsed >= interval)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ResetCore(TimeSpan? interval)
|
||||||
|
{
|
||||||
|
this.elapsed = 0.0f;
|
||||||
|
this.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;
|
||||||
|
if (interval != null)
|
||||||
|
{
|
||||||
|
this.interval = (float)interval.Value.TotalSeconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class IgnoreTimeScalePlayerLoopTimer : PlayerLoopTimer
|
||||||
|
{
|
||||||
|
int initialFrame;
|
||||||
|
float elapsed;
|
||||||
|
float interval;
|
||||||
|
|
||||||
|
public IgnoreTimeScalePlayerLoopTimer(TimeSpan interval, bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)
|
||||||
|
: base(periodic, playerLoopTiming, cancellationToken, timerCallback, state)
|
||||||
|
{
|
||||||
|
ResetCore(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool MoveNextCore()
|
||||||
|
{
|
||||||
|
if (elapsed == 0.0f)
|
||||||
|
{
|
||||||
|
if (initialFrame == Time.frameCount)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed += Time.unscaledDeltaTime;
|
||||||
|
if (elapsed >= interval)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ResetCore(TimeSpan? interval)
|
||||||
|
{
|
||||||
|
this.elapsed = 0.0f;
|
||||||
|
this.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;
|
||||||
|
if (interval != null)
|
||||||
|
{
|
||||||
|
this.interval = (float)interval.Value.TotalSeconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class RealtimePlayerLoopTimer : PlayerLoopTimer
|
||||||
|
{
|
||||||
|
ValueStopwatch stopwatch;
|
||||||
|
long intervalTicks;
|
||||||
|
|
||||||
|
public RealtimePlayerLoopTimer(TimeSpan interval, bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)
|
||||||
|
: base(periodic, playerLoopTiming, cancellationToken, timerCallback, state)
|
||||||
|
{
|
||||||
|
ResetCore(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool MoveNextCore()
|
||||||
|
{
|
||||||
|
if (stopwatch.ElapsedTicks >= intervalTicks)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ResetCore(TimeSpan? interval)
|
||||||
|
{
|
||||||
|
this.stopwatch = ValueStopwatch.StartNew();
|
||||||
|
if (interval != null)
|
||||||
|
{
|
||||||
|
this.intervalTicks = interval.Value.Ticks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 57095a17fdca7ee4380450910afc7f26
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
129
src/UniTask/Assets/Plugins/UniTask/Runtime/TimeoutController.cs
Normal file
129
src/UniTask/Assets/Plugins/UniTask/Runtime/TimeoutController.cs
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Cysharp.Threading.Tasks
|
||||||
|
{
|
||||||
|
// CancellationTokenSource itself can not reuse but CancelAfter(Timeout.InfiniteTimeSpan) allows reuse if did not reach timeout.
|
||||||
|
// Similar discussion:
|
||||||
|
// https://github.com/dotnet/runtime/issues/4694
|
||||||
|
// https://github.com/dotnet/runtime/issues/48492
|
||||||
|
// This TimeoutController emulate similar implementation, using CancelAfterSlim; to achieve zero allocation timeout.
|
||||||
|
|
||||||
|
public sealed class TimeoutController : IDisposable
|
||||||
|
{
|
||||||
|
readonly static Action<object> CancelCancellationTokenSourceStateDelegate = new Action<object>(CancelCancellationTokenSourceState);
|
||||||
|
|
||||||
|
static void CancelCancellationTokenSourceState(object state)
|
||||||
|
{
|
||||||
|
var cts = (CancellationTokenSource)state;
|
||||||
|
cts.Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
CancellationTokenSource timeoutSource;
|
||||||
|
CancellationTokenSource linkedSource;
|
||||||
|
PlayerLoopTimer timer;
|
||||||
|
bool isDisposed;
|
||||||
|
|
||||||
|
readonly DelayType delayType;
|
||||||
|
readonly PlayerLoopTiming delayTiming;
|
||||||
|
readonly CancellationTokenSource originalLinkCancellationTokenSource;
|
||||||
|
|
||||||
|
public TimeoutController(DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
||||||
|
{
|
||||||
|
this.timeoutSource = new CancellationTokenSource();
|
||||||
|
this.originalLinkCancellationTokenSource = null;
|
||||||
|
this.linkedSource = null;
|
||||||
|
this.delayType = delayType;
|
||||||
|
this.delayTiming = delayTiming;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeoutController(CancellationTokenSource linkCancellationTokenSource, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
||||||
|
{
|
||||||
|
this.timeoutSource = new CancellationTokenSource();
|
||||||
|
this.originalLinkCancellationTokenSource = linkCancellationTokenSource;
|
||||||
|
this.linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, linkCancellationTokenSource.Token);
|
||||||
|
this.delayType = delayType;
|
||||||
|
this.delayTiming = delayTiming;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CancellationToken Timeout(int millisecondsTimeout)
|
||||||
|
{
|
||||||
|
return Timeout(TimeSpan.FromMilliseconds(millisecondsTimeout));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CancellationToken Timeout(TimeSpan timeout)
|
||||||
|
{
|
||||||
|
if (originalLinkCancellationTokenSource != null && originalLinkCancellationTokenSource.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return originalLinkCancellationTokenSource.Token;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timeouted, create new source and timer.
|
||||||
|
if (timeoutSource.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
timeoutSource.Dispose();
|
||||||
|
timeoutSource = new CancellationTokenSource();
|
||||||
|
if (linkedSource != null)
|
||||||
|
{
|
||||||
|
this.linkedSource.Cancel();
|
||||||
|
this.linkedSource.Dispose();
|
||||||
|
this.linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, originalLinkCancellationTokenSource.Token);
|
||||||
|
}
|
||||||
|
|
||||||
|
timer?.Dispose();
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var useSource = (linkedSource != null) ? linkedSource : timeoutSource;
|
||||||
|
var token = useSource.Token;
|
||||||
|
if (timer == null)
|
||||||
|
{
|
||||||
|
// Timer complete => timeoutSource.Cancel() -> linkedSource will be canceled.
|
||||||
|
// (linked)token is canceled => stop timer
|
||||||
|
timer = PlayerLoopTimer.StartNew(timeout, false, delayType, delayTiming, token, CancelCancellationTokenSourceStateDelegate, timeoutSource);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timer.Restart(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTimeout()
|
||||||
|
{
|
||||||
|
return timeoutSource.IsCancellationRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (isDisposed) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// stop timer.
|
||||||
|
timer.Dispose();
|
||||||
|
|
||||||
|
// cancel and dispose.
|
||||||
|
timeoutSource.Cancel();
|
||||||
|
timeoutSource.Dispose();
|
||||||
|
if (linkedSource != null)
|
||||||
|
{
|
||||||
|
linkedSource.Cancel();
|
||||||
|
linkedSource.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
isDisposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6347ab34d2db6d744a654e8d62d96b96
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -20,12 +20,23 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public partial struct UniTask
|
public partial struct UniTask
|
||||||
{
|
{
|
||||||
public static YieldAwaitable Yield(PlayerLoopTiming timing = PlayerLoopTiming.Update)
|
public static YieldAwaitable Yield()
|
||||||
|
{
|
||||||
|
// optimized for single continuation
|
||||||
|
return new YieldAwaitable(PlayerLoopTiming.Update);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YieldAwaitable Yield(PlayerLoopTiming timing)
|
||||||
{
|
{
|
||||||
// optimized for single continuation
|
// optimized for single continuation
|
||||||
return new YieldAwaitable(timing);
|
return new YieldAwaitable(timing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UniTask Yield(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return new UniTask(YieldPromise.Create(PlayerLoopTiming.Update, cancellationToken, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
public static UniTask Yield(PlayerLoopTiming timing, CancellationToken cancellationToken)
|
public static UniTask Yield(PlayerLoopTiming timing, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return new UniTask(YieldPromise.Create(timing, cancellationToken, out var token), token);
|
return new UniTask(YieldPromise.Create(timing, cancellationToken, out var token), token);
|
||||||
@@ -34,11 +45,36 @@ namespace Cysharp.Threading.Tasks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UniTask NextFrame(PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default)
|
public static UniTask NextFrame()
|
||||||
|
{
|
||||||
|
return new UniTask(NextFramePromise.Create(PlayerLoopTiming.Update, CancellationToken.None, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
|
/// </summary>
|
||||||
|
public static UniTask NextFrame(PlayerLoopTiming timing)
|
||||||
|
{
|
||||||
|
return new UniTask(NextFramePromise.Create(timing, CancellationToken.None, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
|
/// </summary>
|
||||||
|
public static UniTask NextFrame(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return new UniTask(NextFramePromise.Create(PlayerLoopTiming.Update, cancellationToken, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
|
/// </summary>
|
||||||
|
public static UniTask NextFrame(PlayerLoopTiming timing, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return new UniTask(NextFramePromise.Create(timing, cancellationToken, out var token), token);
|
return new UniTask(NextFramePromise.Create(timing, cancellationToken, out var token), token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same as UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate).
|
/// Same as UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -106,6 +142,14 @@ namespace Cysharp.Threading.Tasks
|
|||||||
throw new ArgumentOutOfRangeException("Delay does not allow minus delayTimeSpan. delayTimeSpan:" + delayTimeSpan);
|
throw new ArgumentOutOfRangeException("Delay does not allow minus delayTimeSpan. delayTimeSpan:" + delayTimeSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// force use Realtime.
|
||||||
|
if (PlayerLoopHelper.IsMainThread && !UnityEditor.EditorApplication.isPlaying)
|
||||||
|
{
|
||||||
|
delayType = DelayType.Realtime;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (delayType)
|
switch (delayType)
|
||||||
{
|
{
|
||||||
case DelayType.UnscaledDeltaTime:
|
case DelayType.UnscaledDeltaTime:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
"define": "UNITASK_UGUI_SUPPORT"
|
"define": "UNITASK_UGUI_SUPPORT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.unity.modules.unitywebrequestwww",
|
"name": "com.unity.modules.unitywebrequest",
|
||||||
"expression": "",
|
"expression": "",
|
||||||
"define": "UNITASK_WEBREQUEST_SUPPORT"
|
"define": "UNITASK_WEBREQUEST_SUPPORT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ignore task result when cancel raised first.
|
/// Ignore task result when cancel raised first.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UniTask WithCancellation(this UniTask task, CancellationToken cancellationToken)
|
public static UniTask AttachExternalCancellation(this UniTask task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!cancellationToken.CanBeCanceled)
|
if (!cancellationToken.CanBeCanceled)
|
||||||
{
|
{
|
||||||
@@ -209,13 +209,13 @@ namespace Cysharp.Threading.Tasks
|
|||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UniTask(new WithCancellationSource(task, cancellationToken), 0);
|
return new UniTask(new AttachExternalCancellationSource(task, cancellationToken), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ignore task result when cancel raised first.
|
/// Ignore task result when cancel raised first.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UniTask<T> WithCancellation<T>(this UniTask<T> task, CancellationToken cancellationToken)
|
public static UniTask<T> AttachExternalCancellation<T>(this UniTask<T> task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!cancellationToken.CanBeCanceled)
|
if (!cancellationToken.CanBeCanceled)
|
||||||
{
|
{
|
||||||
@@ -232,10 +232,10 @@ namespace Cysharp.Threading.Tasks
|
|||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UniTask<T>(new WithCancellationSource<T>(task, cancellationToken), 0);
|
return new UniTask<T>(new AttachExternalCancellationSource<T>(task, cancellationToken), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class WithCancellationSource : IUniTaskSource
|
sealed class AttachExternalCancellationSource : IUniTaskSource
|
||||||
{
|
{
|
||||||
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
CancellationTokenRegistration tokenRegistration;
|
CancellationTokenRegistration tokenRegistration;
|
||||||
UniTaskCompletionSourceCore<AsyncUnit> core;
|
UniTaskCompletionSourceCore<AsyncUnit> core;
|
||||||
|
|
||||||
public WithCancellationSource(UniTask task, CancellationToken cancellationToken)
|
public AttachExternalCancellationSource(UniTask task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
this.cancellationToken = cancellationToken;
|
this.cancellationToken = cancellationToken;
|
||||||
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
||||||
@@ -269,7 +269,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
static void CancellationCallback(object state)
|
static void CancellationCallback(object state)
|
||||||
{
|
{
|
||||||
var self = (WithCancellationSource)state;
|
var self = (AttachExternalCancellationSource)state;
|
||||||
self.core.TrySetCanceled(self.cancellationToken);
|
self.core.TrySetCanceled(self.cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class WithCancellationSource<T> : IUniTaskSource<T>
|
sealed class AttachExternalCancellationSource<T> : IUniTaskSource<T>
|
||||||
{
|
{
|
||||||
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
CancellationTokenRegistration tokenRegistration;
|
CancellationTokenRegistration tokenRegistration;
|
||||||
UniTaskCompletionSourceCore<T> core;
|
UniTaskCompletionSourceCore<T> core;
|
||||||
|
|
||||||
public WithCancellationSource(UniTask<T> task, CancellationToken cancellationToken)
|
public AttachExternalCancellationSource(UniTask<T> task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
this.cancellationToken = cancellationToken;
|
this.cancellationToken = cancellationToken;
|
||||||
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
||||||
@@ -327,7 +327,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
static void CancellationCallback(object state)
|
static void CancellationCallback(object state)
|
||||||
{
|
{
|
||||||
var self = (WithCancellationSource<T>)state;
|
var self = (AttachExternalCancellationSource<T>)state;
|
||||||
self.core.TrySetCanceled(self.cancellationToken);
|
self.core.TrySetCanceled(self.cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
task.GetAwaiter().GetResult();
|
||||||
return new ReturnObservable<AsyncUnit>(AsyncUnit.Default);
|
return new ReturnObservable<AsyncUnit>(AsyncUnit.Default);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return AwaitForAllAssets(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object[]>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult<UnityEngine.Object[]>(asyncOperation.allAssets);
|
|
||||||
return new UniTask<UnityEngine.Object[]>(AssetBundleRequestAllAssetsWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -84,129 +81,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AssetBundleRequestAllAssetsWithCancellationSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AssetBundleRequestAllAssetsWithCancellationSource> pool;
|
|
||||||
AssetBundleRequestAllAssetsWithCancellationSource nextNode;
|
|
||||||
public ref AssetBundleRequestAllAssetsWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AssetBundleRequestAllAssetsWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AssetBundleRequestAllAssetsWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AssetBundleRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityEngine.Object[]> core;
|
|
||||||
|
|
||||||
AssetBundleRequestAllAssetsWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityEngine.Object[]> Create(AssetBundleRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityEngine.Object[]>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AssetBundleRequestAllAssetsWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.allAssets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityEngine.Object[] GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AssetBundleRequestAllAssetsConfiguredSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsConfiguredSource>
|
sealed class AssetBundleRequestAllAssetsConfiguredSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AssetBundleRequestAllAssetsConfiguredSource> pool;
|
static TaskPool<AssetBundleRequestAllAssetsConfiguredSource> pool;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#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
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|||||||
@@ -23,10 +23,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken)
|
public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.CompletedTask;
|
|
||||||
return new UniTask(AsyncOperationWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask ToUniTask(this AsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask ToUniTask(this AsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -77,125 +74,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AsyncOperationWithCancellationSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AsyncOperationWithCancellationSource> pool;
|
|
||||||
AsyncOperationWithCancellationSource nextNode;
|
|
||||||
public ref AsyncOperationWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AsyncOperationWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AsyncOperation asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<AsyncUnit> core;
|
|
||||||
|
|
||||||
AsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource Create(AsyncOperation asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AsyncOperationWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(AsyncUnit.Default);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetResult(short token)
|
|
||||||
{
|
|
||||||
core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource>
|
sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AsyncOperationConfiguredSource> pool;
|
static TaskPool<AsyncOperationConfiguredSource> pool;
|
||||||
@@ -315,10 +193,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityEngine.Object> WithCancellation(this ResourceRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityEngine.Object> WithCancellation(this ResourceRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.asset);
|
|
||||||
return new UniTask<UnityEngine.Object>(ResourceRequestWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityEngine.Object> ToUniTask(this ResourceRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityEngine.Object> ToUniTask(this ResourceRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -373,129 +248,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class ResourceRequestWithCancellationSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<ResourceRequestWithCancellationSource> pool;
|
|
||||||
ResourceRequestWithCancellationSource nextNode;
|
|
||||||
public ref ResourceRequestWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static ResourceRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(ResourceRequestWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
ResourceRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityEngine.Object> core;
|
|
||||||
|
|
||||||
ResourceRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityEngine.Object> Create(ResourceRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityEngine.Object>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new ResourceRequestWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.asset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityEngine.Object GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource>
|
sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<ResourceRequestConfiguredSource> pool;
|
static TaskPool<ResourceRequestConfiguredSource> pool;
|
||||||
@@ -620,10 +372,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.asset);
|
|
||||||
return new UniTask<UnityEngine.Object>(AssetBundleRequestWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityEngine.Object> ToUniTask(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityEngine.Object> ToUniTask(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -678,129 +427,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AssetBundleRequestWithCancellationSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AssetBundleRequestWithCancellationSource> pool;
|
|
||||||
AssetBundleRequestWithCancellationSource nextNode;
|
|
||||||
public ref AssetBundleRequestWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AssetBundleRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AssetBundleRequestWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AssetBundleRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityEngine.Object> core;
|
|
||||||
|
|
||||||
AssetBundleRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityEngine.Object> Create(AssetBundleRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityEngine.Object>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AssetBundleRequestWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.asset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityEngine.Object GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource>
|
sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AssetBundleRequestConfiguredSource> pool;
|
static TaskPool<AssetBundleRequestConfiguredSource> pool;
|
||||||
@@ -926,10 +552,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<AssetBundle> WithCancellation(this AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<AssetBundle> WithCancellation(this AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<AssetBundle>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.assetBundle);
|
|
||||||
return new UniTask<AssetBundle>(AssetBundleCreateRequestWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<AssetBundle> ToUniTask(this AssetBundleCreateRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<AssetBundle> ToUniTask(this AssetBundleCreateRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -984,129 +607,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AssetBundleCreateRequestWithCancellationSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AssetBundleCreateRequestWithCancellationSource> pool;
|
|
||||||
AssetBundleCreateRequestWithCancellationSource nextNode;
|
|
||||||
public ref AssetBundleCreateRequestWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AssetBundleCreateRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AssetBundleCreateRequestWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AssetBundleCreateRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<AssetBundle> core;
|
|
||||||
|
|
||||||
AssetBundleCreateRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<AssetBundle> Create(AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<AssetBundle>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AssetBundleCreateRequestWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.assetBundle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AssetBundle GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource>
|
sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AssetBundleCreateRequestConfiguredSource> pool;
|
static TaskPool<AssetBundleCreateRequestConfiguredSource> pool;
|
||||||
@@ -1232,17 +732,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityWebRequest> WithCancellation(this UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityWebRequest> WithCancellation(this UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityWebRequest>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone)
|
|
||||||
{
|
|
||||||
if (asyncOperation.webRequest.IsError())
|
|
||||||
{
|
|
||||||
return UniTask.FromException<UnityWebRequest>(new UnityWebRequestException(asyncOperation.webRequest));
|
|
||||||
}
|
|
||||||
return UniTask.FromResult(asyncOperation.webRequest);
|
|
||||||
}
|
|
||||||
return new UniTask<UnityWebRequest>(UnityWebRequestAsyncOperationWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityWebRequest> ToUniTask(this UnityWebRequestAsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityWebRequest> ToUniTask(this UnityWebRequestAsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -1312,138 +802,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class UnityWebRequestAsyncOperationWithCancellationSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<UnityWebRequestAsyncOperationWithCancellationSource> pool;
|
|
||||||
UnityWebRequestAsyncOperationWithCancellationSource nextNode;
|
|
||||||
public ref UnityWebRequestAsyncOperationWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static UnityWebRequestAsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(UnityWebRequestAsyncOperationWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
UnityWebRequestAsyncOperation asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityWebRequest> core;
|
|
||||||
|
|
||||||
UnityWebRequestAsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityWebRequest> Create(UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityWebRequest>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new UnityWebRequestAsyncOperationWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = asyncOperation.webRequest;
|
|
||||||
if (result.IsError())
|
|
||||||
{
|
|
||||||
core.TrySetException(new UnityWebRequestException(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
core.TrySetResult(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityWebRequest GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
asyncOperation.webRequest.Abort();
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource>
|
sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<UnityWebRequestAsyncOperationConfiguredSource> pool;
|
static TaskPool<UnityWebRequestAsyncOperationConfiguredSource> pool;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
("ResourceRequest", "UnityEngine.Object", "asset"),
|
("ResourceRequest", "UnityEngine.Object", "asset"),
|
||||||
("AssetBundleRequest", "UnityEngine.Object", "asset"), // allAssets?
|
("AssetBundleRequest", "UnityEngine.Object", "asset"), // allAssets?
|
||||||
("AssetBundleCreateRequest", "AssetBundle", "assetBundle"),
|
("AssetBundleCreateRequest", "AssetBundle", "assetBundle"),
|
||||||
("UnityWebRequestAsyncOperation", "UnityWebRequest", "webRequest") // -> #if ENABLE_UNITYWEBREQUEST
|
("UnityWebRequestAsyncOperation", "UnityWebRequest", "webRequest") // -> #if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>";
|
Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>";
|
||||||
@@ -27,7 +27,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Cysharp.Threading.Tasks.Internal;
|
using Cysharp.Threading.Tasks.Internal;
|
||||||
#if ENABLE_UNITYWEBREQUEST
|
#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ 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 && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||||
<# } else if(IsAssetBundleModule(t)) { #>
|
<# } else if(IsAssetBundleModule(t)) { #>
|
||||||
#if UNITASK_ASSETBUNDLE_SUPPORT
|
#if UNITASK_ASSETBUNDLE_SUPPORT
|
||||||
<# } #>
|
<# } #>
|
||||||
@@ -51,21 +51,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static <#= ToUniTaskReturnType(t.returnType) #> WithCancellation(this <#= t.typeName #> asyncOperation, CancellationToken cancellationToken)
|
public static <#= ToUniTaskReturnType(t.returnType) #> WithCancellation(this <#= t.typeName #> asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<#= IsVoid(t) ? "" : "<" + t.returnType + ">" #>(cancellationToken);
|
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
|
||||||
if (asyncOperation.isDone)
|
|
||||||
{
|
|
||||||
if (asyncOperation.webRequest.IsError())
|
|
||||||
{
|
|
||||||
return UniTask.FromException<UnityWebRequest>(new UnityWebRequestException(asyncOperation.webRequest));
|
|
||||||
}
|
|
||||||
return UniTask.FromResult(asyncOperation.webRequest);
|
|
||||||
}
|
|
||||||
<# } else { #>
|
|
||||||
if (asyncOperation.isDone) return <#= IsVoid(t) ? "UniTask.CompletedTask" : $"UniTask.FromResult(asyncOperation.{t.returnField})" #>;
|
|
||||||
<# } #>
|
|
||||||
return new <#= ToUniTaskReturnType(t.returnType) #>(<#= t.typeName #>WithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <#= ToUniTaskReturnType(t.returnType) #> ToUniTask(this <#= t.typeName #> asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static <#= ToUniTaskReturnType(t.returnType) #> ToUniTask(this <#= t.typeName #> asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -151,150 +137,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class <#= t.typeName #>WithCancellationSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>WithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<<#= t.typeName #>WithCancellationSource> pool;
|
|
||||||
<#= t.typeName #>WithCancellationSource nextNode;
|
|
||||||
public ref <#= t.typeName #>WithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static <#= t.typeName #>WithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(<#= t.typeName #>WithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
<#= t.typeName #> asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<<#= IsVoid(t) ? "AsyncUnit" : t.returnType #>> core;
|
|
||||||
|
|
||||||
<#= t.typeName #>WithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <#= ToIUniTaskSourceReturnType(t.returnType) #> Create(<#= t.typeName #> asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<#= IsVoid(t) ? "" : $"<{t.returnType}>" #>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new <#= t.typeName #>WithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
|
||||||
var result = asyncOperation.webRequest;
|
|
||||||
if (result.IsError())
|
|
||||||
{
|
|
||||||
core.TrySetException(new UnityWebRequestException(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
core.TrySetResult(result);
|
|
||||||
}
|
|
||||||
<# } else { #>
|
|
||||||
core.TrySetResult(<#= IsVoid(t) ? "AsyncUnit.Default" : $"asyncOperation.{t.returnField}" #>);
|
|
||||||
<# } #>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public <#= t.returnType #> GetResult(short token)
|
|
||||||
{
|
|
||||||
<# if (!IsVoid(t)) { #>
|
|
||||||
return core.GetResult(token);
|
|
||||||
<# } else { #>
|
|
||||||
core.GetResult(token);
|
|
||||||
<# } #>
|
|
||||||
}
|
|
||||||
|
|
||||||
<# if (!IsVoid(t)) { #>
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
<# } #>
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
|
||||||
asyncOperation.webRequest.Abort();
|
|
||||||
<# } #>
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource>
|
sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<<#= t.typeName #>ConfiguredSource> pool;
|
static TaskPool<<#= t.typeName #>ConfiguredSource> pool;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.cysharp.unitask",
|
"name": "com.cysharp.unitask",
|
||||||
"displayName": "UniTask",
|
"displayName": "UniTask",
|
||||||
"version": "2.1.1",
|
"version": "2.2.5",
|
||||||
"unity": "2018.4",
|
"unity": "2018.4",
|
||||||
"description": "Provides an efficient async/await integration to Unity.",
|
"description": "Provides an efficient async/await integration to Unity.",
|
||||||
"keywords": [ "async/await", "async", "Task", "UniTask" ],
|
"keywords": [ "async/await", "async", "Task", "UniTask" ],
|
||||||
|
|||||||
8
src/UniTask/Assets/Resources.meta
Normal file
8
src/UniTask/Assets/Resources.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8fb84ce71736dab41b0cca7ea3f5b313
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
1
src/UniTask/Assets/Resources/bar.txt
Normal file
1
src/UniTask/Assets/Resources/bar.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bar
|
||||||
7
src/UniTask/Assets/Resources/bar.txt.meta
Normal file
7
src/UniTask/Assets/Resources/bar.txt.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9df64c494bee73b40ad3679f44bbc8c5
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
1
src/UniTask/Assets/Resources/baz.txt
Normal file
1
src/UniTask/Assets/Resources/baz.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
baz
|
||||||
7
src/UniTask/Assets/Resources/baz.txt.meta
Normal file
7
src/UniTask/Assets/Resources/baz.txt.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b9e797ec5aa031408d06d42830c6709
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
1
src/UniTask/Assets/Resources/foo.txt
Normal file
1
src/UniTask/Assets/Resources/foo.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
foo
|
||||||
7
src/UniTask/Assets/Resources/foo.txt.meta
Normal file
7
src/UniTask/Assets/Resources/foo.txt.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b28aa61554c736c4887674883ac049f2
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
129
src/UniTask/Assets/Scenes/DemoScript.cs
Normal file
129
src/UniTask/Assets/Scenes/DemoScript.cs
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class DemoScript : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Toggle toggle = null;
|
||||||
|
public Text text = null;
|
||||||
|
|
||||||
|
async Task Start()
|
||||||
|
{
|
||||||
|
text.text = "";
|
||||||
|
var result = await DemoAsync();
|
||||||
|
text.text = $"RESULT is: {result}";
|
||||||
|
}
|
||||||
|
|
||||||
|
async UniTask<string> DemoAsync()
|
||||||
|
{
|
||||||
|
// You can await Unity's AsyncObject
|
||||||
|
text.text = "loading assets";
|
||||||
|
var asset = await Resources.LoadAsync<TextAsset>("foo");
|
||||||
|
text.text = "get data from github.com";
|
||||||
|
var txt = (await UnityWebRequest.Get("https://github.com").SendWebRequest()).downloadHandler.text;
|
||||||
|
text.text = "load scene2";
|
||||||
|
await SceneManager.LoadSceneAsync("scene2", LoadSceneMode.Additive);
|
||||||
|
|
||||||
|
// .WithCancellation enables Cancel, GetCancellationTokenOnDestroy synchornizes with lifetime of GameObject
|
||||||
|
text.text = "load text asset bar";
|
||||||
|
var asset2 = await Resources.LoadAsync<TextAsset>("bar").WithCancellation(this.GetCancellationTokenOnDestroy());
|
||||||
|
|
||||||
|
// .ToUniTask accepts progress callback(and all options), Progress.Create is a lightweight alternative of IProgress<T>
|
||||||
|
text.text = "load text asset baz";
|
||||||
|
var asset3 = await Resources.LoadAsync<TextAsset>("baz").ToUniTask(Progress.Create<float>(x => Debug.Log(x)));
|
||||||
|
|
||||||
|
// await frame-based operation like a coroutine
|
||||||
|
text.text = "delay frame";
|
||||||
|
await UniTask.DelayFrame(100);
|
||||||
|
|
||||||
|
// replacement of yield return new WaitForSeconds/WaitForSecondsRealtime
|
||||||
|
text.text = "wait 3sec.";
|
||||||
|
await UniTask.Delay(TimeSpan.FromSeconds(3), ignoreTimeScale: false);
|
||||||
|
|
||||||
|
// yield any playerloop timing(PreUpdate, Update, LateUpdate, etc...)
|
||||||
|
text.text = "wait for PreLateUpdate";
|
||||||
|
await UniTask.Yield(PlayerLoopTiming.PreLateUpdate);
|
||||||
|
|
||||||
|
// replacement of yield return null
|
||||||
|
text.text = "yield";
|
||||||
|
await UniTask.Yield();
|
||||||
|
text.text = "wait nextframe";
|
||||||
|
await UniTask.NextFrame();
|
||||||
|
|
||||||
|
// replacement of WaitForEndOfFrame(same as UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate))
|
||||||
|
text.text = "wait end of frame";
|
||||||
|
await UniTask.WaitForEndOfFrame();
|
||||||
|
|
||||||
|
// replacement of yield return new WaitForFixedUpdate(same as UniTask.Yield(PlayerLoopTiming.FixedUpdate))
|
||||||
|
text.text = "wait fixed update";
|
||||||
|
await UniTask.WaitForFixedUpdate();
|
||||||
|
|
||||||
|
// replacement of yield return WaitUntil
|
||||||
|
text.text = "wait for toggle => false";
|
||||||
|
await UniTask.WaitUntil(() => toggle.isOn == false);
|
||||||
|
|
||||||
|
// special helper of WaitUntil
|
||||||
|
text.text = "wait for toggle";
|
||||||
|
await UniTask.WaitUntilValueChanged(this, x => toggle.isOn);
|
||||||
|
|
||||||
|
// You can await IEnumerator coroutines
|
||||||
|
text.text = "corouting";
|
||||||
|
await FooCoroutineEnumerator();
|
||||||
|
|
||||||
|
// You can await a standard task
|
||||||
|
text.text = "run standard task";
|
||||||
|
await Task.Run(() => 100);
|
||||||
|
|
||||||
|
// Multithreading, run on ThreadPool under this code
|
||||||
|
text.text = "switch to thread pool";
|
||||||
|
await UniTask.SwitchToThreadPool();
|
||||||
|
|
||||||
|
/* work on ThreadPool */
|
||||||
|
|
||||||
|
// return to MainThread(same as `ObserveOnMainThread` in UniRx)
|
||||||
|
await UniTask.SwitchToMainThread();
|
||||||
|
text.text = "switch to main pool";
|
||||||
|
|
||||||
|
// get async webrequest
|
||||||
|
async UniTask<string> GetTextAsync(UnityWebRequest req)
|
||||||
|
{
|
||||||
|
var op = await req.SendWebRequest();
|
||||||
|
return op.downloadHandler.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
var task1 = GetTextAsync(UnityWebRequest.Get("https://google.com/"));
|
||||||
|
var task2 = GetTextAsync(UnityWebRequest.Get("https://bing.com/"));
|
||||||
|
var task3 = GetTextAsync(UnityWebRequest.Get("https://yahoo.com/"));
|
||||||
|
|
||||||
|
// concurrent async-wait and get results easily by tuple syntax
|
||||||
|
text.text = "get data from google,bing,yahoo (concurrent)";
|
||||||
|
var (google, bing, yahoo) = await UniTask.WhenAll(task1, task2, task3);
|
||||||
|
|
||||||
|
// can not call same task twice. let's define again for simple demo.
|
||||||
|
var tasknew1 = GetTextAsync(UnityWebRequest.Get("https://google.com/"));
|
||||||
|
var tasknew2 = GetTextAsync(UnityWebRequest.Get("https://bing.com/"));
|
||||||
|
var tasknew3 = GetTextAsync(UnityWebRequest.Get("https://yahoo.com/"));
|
||||||
|
|
||||||
|
// shorthand of WhenAll, tuple can await directly.
|
||||||
|
text.text = "get data from google,bing,yahoo (shorthand)";
|
||||||
|
var (google2, bing2, yahoo2) = await (tasknew1, tasknew2, tasknew3);
|
||||||
|
|
||||||
|
// return async-value.(or you can use `UniTask`(no result), `UniTaskVoid`(fire and forget)).
|
||||||
|
text.text = "return asset result";
|
||||||
|
return (asset as TextAsset)?.text ?? throw new InvalidOperationException("Asset not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator FooCoroutineEnumerator()
|
||||||
|
{
|
||||||
|
Debug.Log("cotoutine 1");
|
||||||
|
yield return new WaitForSeconds(1);
|
||||||
|
Debug.Log("cotoutine 2");
|
||||||
|
yield return new WaitForSeconds(1);
|
||||||
|
Debug.Log("cotoutine end");
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/UniTask/Assets/Scenes/DemoScript.cs.meta
Normal file
11
src/UniTask/Assets/Scenes/DemoScript.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3defd278e9f50124396082efc492cb81
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -11,30 +11,33 @@ public class Test1
|
|||||||
public static async UniTaskVoid TestFunc()
|
public static async UniTaskVoid TestFunc()
|
||||||
{
|
{
|
||||||
await DoSomeThing();
|
await DoSomeThing();
|
||||||
string[] scenes = new string[]
|
//string[] scenes = new string[]
|
||||||
{
|
//{
|
||||||
"Assets/Scenes/SandboxMain.unity",
|
// "Assets/Scenes/SandboxMain.unity",
|
||||||
};
|
//};
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
Debug.Log("Build Begin");
|
// Debug.Log("Build Begin");
|
||||||
BuildPipeline.BuildPlayer(scenes, Application.dataPath + "../target", BuildTarget.StandaloneWindows, BuildOptions.CompressWithLz4);
|
// BuildPipeline.BuildPlayer(scenes, Application.dataPath + "../target", BuildTarget.StandaloneWindows, BuildOptions.CompressWithLz4);
|
||||||
Debug.Log("Build After");
|
// Debug.Log("Build After");
|
||||||
}
|
//}
|
||||||
catch (Exception e)
|
//catch (Exception e)
|
||||||
{
|
//{
|
||||||
Debug.LogError(e.Message);
|
// Debug.LogError(e.Message);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async UniTask DoSomeThing()
|
public static async UniTask DoSomeThing()
|
||||||
{
|
{
|
||||||
Debug.Log("Dosomething");
|
Debug.Log("Dosomething");
|
||||||
await UniTask.Delay(1500, DelayType.Realtime);
|
await UniTask.Delay(1500, DelayType.DeltaTime);
|
||||||
Debug.Log("Dosomething 2");
|
Debug.Log("Dosomething 2");
|
||||||
await UniTask.Delay(1000, DelayType.Realtime);
|
await UniTask.Delay(1000, DelayType.DeltaTime);
|
||||||
Debug.Log("Dosomething 3");
|
Debug.Log("Dosomething 3");
|
||||||
|
Debug.Log("and Quit.");
|
||||||
|
|
||||||
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1015
src/UniTask/Assets/Scenes/SampleScene.unity
Normal file
1015
src/UniTask/Assets/Scenes/SampleScene.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
src/UniTask/Assets/Scenes/SampleScene.unity.meta
Normal file
7
src/UniTask/Assets/Scenes/SampleScene.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: edc485cde0ff14046a21a7c2a51bb0ac
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -542,26 +542,116 @@ public class SandboxMain : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Debug.LogError(e);
|
Debug.LogError(e);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug.Log("TestAsync Finished.");
|
Debug.Log("TestAsync Finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async UniTaskVoid Start()
|
async UniTaskVoid Start()
|
||||||
{
|
{
|
||||||
var cts = new CancellationTokenSource();
|
|
||||||
|
|
||||||
TestAsync(cts.Token).Forget();
|
// UniTask.Delay(TimeSpan.FromSeconds(1)).TimeoutWithoutException
|
||||||
|
|
||||||
|
|
||||||
|
var currentLoop = PlayerLoop.GetDefaultPlayerLoop();
|
||||||
|
PlayerLoopHelper.Initialize(ref currentLoop, InjectPlayerLoopTimings.Minimum); // minimum is Update | FixedUpdate | LastPostLateUpdate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var cancelToken = new CancellationTokenSource();
|
||||||
|
cancelButton.onClick.AddListener(()=>
|
||||||
|
{
|
||||||
|
cancelToken.Cancel(); // cancel from button click.
|
||||||
|
});
|
||||||
|
|
||||||
|
var timeoutToken = new CancellationTokenSource();
|
||||||
|
timeoutToken.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// combine token
|
||||||
|
var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancelToken.Token, timeoutToken.Token);
|
||||||
|
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest().WithCancellation(linkedTokenSource.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (timeoutToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Timeout.");
|
||||||
|
}
|
||||||
|
else if (cancelToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Cancel clicked.");
|
||||||
|
}
|
||||||
|
_ = ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TestAsync(cts.Token).Forget();
|
||||||
|
|
||||||
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
||||||
{
|
{
|
||||||
cts.Cancel();
|
// try timeout
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//await UniTask.Delay(TimeSpan.FromSeconds(2), cancellationToken: timeoutController.Timeout(TimeSpan.FromSeconds(3)));
|
||||||
|
UnityEngine.Debug.Log("Delay Complete, Reset(and reuse).");
|
||||||
|
//timeoutController.Reset();
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
//UnityEngine.Debug.Log("Timeout! FromTimeout?:" + timeoutController.IsTimeout());
|
||||||
|
_ = ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
await UniTask.Yield();
|
||||||
|
}));
|
||||||
|
|
||||||
|
cancelButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
||||||
|
{
|
||||||
|
//clickCancelSource.Cancel();
|
||||||
|
|
||||||
|
//RunCheck(PlayerLoopTiming.Initialization).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastInitialization).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.EarlyUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastEarlyUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.FixedUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastFixedUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.PreUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastPreUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.Update).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.PreLateUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastPreLateUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.PostLateUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastPostLateUpdate).Forget();
|
||||||
|
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async UniTaskVoid RunCheck(PlayerLoopTiming timing)
|
||||||
|
{
|
||||||
|
//await UniTask.Yield(timing);
|
||||||
|
//UnityEngine.Debug.Log("Yield:" + timing);
|
||||||
|
await UniTask.DelayFrame(1, timing);
|
||||||
|
UnityEngine.Debug.Log("Delay:" + timing);
|
||||||
|
}
|
||||||
|
|
||||||
private void Application_logMessageReceived2(string condition, string stackTrace, LogType type)
|
private void Application_logMessageReceived2(string condition, string stackTrace, LogType type)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
299
src/UniTask/Assets/Scenes/scene2.unity
Normal file
299
src/UniTask/Assets/Scenes/scene2.unity
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 0
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 11
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 1
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_UseShadowmask: 1
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &386714
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 386717}
|
||||||
|
- component: {fileID: 386716}
|
||||||
|
- component: {fileID: 386715}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Main Camera
|
||||||
|
m_TagString: MainCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
|
--- !u!81 &386715
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 386714}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!20 &386716
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 386714}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 0
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: -1
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!4 &386717
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 386714}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &172792889
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 172792893}
|
||||||
|
- component: {fileID: 172792892}
|
||||||
|
- component: {fileID: 172792891}
|
||||||
|
- component: {fileID: 172792890}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Cube
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!65 &172792890
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 172792889}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &172792891
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 172792889}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!33 &172792892
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 172792889}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!4 &172792893
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 172792889}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
7
src/UniTask/Assets/Scenes/scene2.unity.meta
Normal file
7
src/UniTask/Assets/Scenes/scene2.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 84d1cc7b4b33fa54f98a29e843b1db30
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -12,16 +12,16 @@ public class FooMonoBehaviour : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async UniTask Download(UnityWebRequest req, string filePath)
|
//private async UniTask Download(UnityWebRequest req, string filePath)
|
||||||
{
|
//{
|
||||||
_ = req.SendWebRequest();
|
// _ = req.SendWebRequest();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var aaa = await foo;
|
// // var aaa = await foo;
|
||||||
// Debug.Log(aaa);
|
// // Debug.Log(aaa);
|
||||||
await UniTask.Yield();
|
// await UniTask.Yield();
|
||||||
//File.WriteAllText(filePath, req.downloadHandler.text ?? string.Empty);
|
// //File.WriteAllText(filePath, req.downloadHandler.text ?? string.Empty);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
179
src/UniTask/Assets/Tests/PlayerLoopTimerTest.cs
Normal file
179
src/UniTask/Assets/Tests/PlayerLoopTimerTest.cs
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
using FluentAssertions;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
namespace Cysharp.Threading.TasksTests
|
||||||
|
{
|
||||||
|
public class PlayerLoopTimerTest
|
||||||
|
{
|
||||||
|
void Between(TimeSpan l, TimeSpan data, TimeSpan r)
|
||||||
|
{
|
||||||
|
NUnit.Framework.Assert.AreEqual(l < data, true, "{0} < {1} failed.", l, data);
|
||||||
|
NUnit.Framework.Assert.AreEqual(data < r, true, "{0} < {1} failed.", data, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator StandardTicks() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
foreach (var delay in new[] { DelayType.DeltaTime, DelayType.Realtime, DelayType.UnscaledDeltaTime })
|
||||||
|
{
|
||||||
|
var raisedTimeout = new UniTaskCompletionSource();
|
||||||
|
PlayerLoopTimer.StartNew(TimeSpan.FromSeconds(1), false, delay, PlayerLoopTiming.Update, CancellationToken.None, _ =>
|
||||||
|
{
|
||||||
|
raisedTimeout.TrySetResult();
|
||||||
|
}, null);
|
||||||
|
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
await raisedTimeout.Task;
|
||||||
|
sw.Stop();
|
||||||
|
|
||||||
|
Between(TimeSpan.FromSeconds(0.9), sw.Elapsed, TimeSpan.FromSeconds(1.1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator Periodic() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
var raisedTime = new List<DateTime>();
|
||||||
|
var count = 0;
|
||||||
|
var complete = new UniTaskCompletionSource();
|
||||||
|
|
||||||
|
PlayerLoopTimer timer = null;
|
||||||
|
timer = PlayerLoopTimer.StartNew(TimeSpan.FromSeconds(1), true, DelayType.DeltaTime, PlayerLoopTiming.Update, CancellationToken.None, _ =>
|
||||||
|
{
|
||||||
|
raisedTime.Add(DateTime.UtcNow);
|
||||||
|
count++;
|
||||||
|
if (count == 3)
|
||||||
|
{
|
||||||
|
complete.TrySetResult();
|
||||||
|
timer.Dispose();
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
|
||||||
|
var start = DateTime.UtcNow;
|
||||||
|
await complete.Task;
|
||||||
|
|
||||||
|
Between(TimeSpan.FromSeconds(0.9), raisedTime[0] - start, TimeSpan.FromSeconds(1.1));
|
||||||
|
Between(TimeSpan.FromSeconds(1.9), raisedTime[1] - start, TimeSpan.FromSeconds(2.1));
|
||||||
|
Between(TimeSpan.FromSeconds(2.9), raisedTime[2] - start, TimeSpan.FromSeconds(3.1));
|
||||||
|
});
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator CancelAfterSlimTest() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
var complete = new UniTaskCompletionSource();
|
||||||
|
cts.Token.RegisterWithoutCaptureExecutionContext(() =>
|
||||||
|
{
|
||||||
|
complete.TrySetResult();
|
||||||
|
});
|
||||||
|
|
||||||
|
cts.CancelAfterSlim(TimeSpan.FromSeconds(1));
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
await complete.Task;
|
||||||
|
|
||||||
|
Between(TimeSpan.FromSeconds(0.9), sw.Elapsed, TimeSpan.FromSeconds(1.1));
|
||||||
|
});
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator CancelAfterSlimCancelTest() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
var complete = new UniTaskCompletionSource();
|
||||||
|
cts.Token.RegisterWithoutCaptureExecutionContext(() =>
|
||||||
|
{
|
||||||
|
complete.TrySetResult();
|
||||||
|
});
|
||||||
|
|
||||||
|
var d = cts.CancelAfterSlim(TimeSpan.FromSeconds(1));
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
await UniTask.Delay(TimeSpan.FromMilliseconds(100));
|
||||||
|
d.Dispose();
|
||||||
|
|
||||||
|
await UniTask.Delay(TimeSpan.FromSeconds(2));
|
||||||
|
|
||||||
|
complete.Task.Status.Should().Be(UniTaskStatus.Pending);
|
||||||
|
});
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator TimeoutController() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
var controller = new TimeoutController();
|
||||||
|
|
||||||
|
var token = controller.Timeout(TimeSpan.FromSeconds(1));
|
||||||
|
|
||||||
|
var complete = new UniTaskCompletionSource();
|
||||||
|
token.RegisterWithoutCaptureExecutionContext(() =>
|
||||||
|
{
|
||||||
|
complete.TrySetResult();
|
||||||
|
});
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
await complete.Task;
|
||||||
|
Between(TimeSpan.FromSeconds(0.9), sw.Elapsed, TimeSpan.FromSeconds(1.1));
|
||||||
|
|
||||||
|
controller.IsTimeout().Should().BeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator TimeoutReuse() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
var controller = new TimeoutController(DelayType.DeltaTime);
|
||||||
|
|
||||||
|
var token = controller.Timeout(TimeSpan.FromSeconds(2));
|
||||||
|
|
||||||
|
var complete = new UniTaskCompletionSource();
|
||||||
|
token.RegisterWithoutCaptureExecutionContext(() =>
|
||||||
|
{
|
||||||
|
complete.TrySetResult(); // reuse, used same token?
|
||||||
|
});
|
||||||
|
|
||||||
|
await UniTask.Delay(TimeSpan.FromMilliseconds(100));
|
||||||
|
controller.Reset();
|
||||||
|
|
||||||
|
controller.IsTimeout().Should().BeFalse();
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
controller.Timeout(TimeSpan.FromSeconds(5));
|
||||||
|
|
||||||
|
await complete.Task;
|
||||||
|
|
||||||
|
UnityEngine.Debug.Log(UnityEngine.Time.timeScale);
|
||||||
|
Between(TimeSpan.FromSeconds(4.9), sw.Elapsed, TimeSpan.FromSeconds(5.1));
|
||||||
|
|
||||||
|
controller.IsTimeout().Should().BeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator LinkedTokenTest() => UniTask.ToCoroutine(async () =>
|
||||||
|
{
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
var controller = new TimeoutController(cts);
|
||||||
|
var token = controller.Timeout(TimeSpan.FromSeconds(2));
|
||||||
|
|
||||||
|
await UniTask.DelayFrame(3);
|
||||||
|
|
||||||
|
cts.Cancel();
|
||||||
|
|
||||||
|
token.IsCancellationRequested.Should().BeTrue();
|
||||||
|
|
||||||
|
controller.Dispose();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/UniTask/Assets/Tests/PlayerLoopTimerTest.cs.meta
Normal file
11
src/UniTask/Assets/Tests/PlayerLoopTimerTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c0c49de697f829f44aa8709b4d1eff3e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -11,4 +11,10 @@ EditorBuildSettings:
|
|||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/ExceptionExamples.unity
|
path: Assets/Scenes/ExceptionExamples.unity
|
||||||
guid: b5fed17e3ece238439bc796d8747df5d
|
guid: b5fed17e3ece238439bc796d8747df5d
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/SampleScene.unity
|
||||||
|
guid: edc485cde0ff14046a21a7c2a51bb0ac
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/scene2.unity
|
||||||
|
guid: 84d1cc7b4b33fa54f98a29e843b1db30
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 2020.2.0f1
|
m_EditorVersion: 2020.2.1f1
|
||||||
m_EditorVersionWithRevision: 2020.2.0f1 (3721df5a8b28)
|
m_EditorVersionWithRevision: 2020.2.1f1 (270dd8c3da1c)
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ EditorUserSettings:
|
|||||||
RecentlyUsedScenePath-0:
|
RecentlyUsedScenePath-0:
|
||||||
value: 22424703114646680e0b0227036c6c1118131a25340527392367083debf42d
|
value: 22424703114646680e0b0227036c6c1118131a25340527392367083debf42d
|
||||||
flags: 0
|
flags: 0
|
||||||
|
RecentlyUsedScenePath-1:
|
||||||
|
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||||
|
flags: 0
|
||||||
vcSharedLogLevel:
|
vcSharedLogLevel:
|
||||||
value: 0d5e400f0650
|
value: 0d5e400f0650
|
||||||
flags: 0
|
flags: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user