三国卡牌客户端基础资源仓库
hch
4 天以前 cdac25a8e4f91a4663bf5f80994538dd263b757c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Cysharp.Threading.Tasks.Internal;
using System.Threading;
 
namespace Cysharp.Threading.Tasks.Linq
{
    public static partial class UniTaskAsyncEnumerable
    {
        public static IUniTaskAsyncEnumerable<TValue> Return<TValue>(TValue value)
        {
            return new Return<TValue>(value);
        }
    }
 
    internal class Return<TValue> : IUniTaskAsyncEnumerable<TValue>
    {
        readonly TValue value;
 
        public Return(TValue value)
        {
            this.value = value;
        }
 
        public IUniTaskAsyncEnumerator<TValue> GetAsyncEnumerator(CancellationToken cancellationToken = default)
        {
            return new _Return(value, cancellationToken);
        }
 
        class _Return : IUniTaskAsyncEnumerator<TValue>
        {
            readonly TValue value;
            CancellationToken cancellationToken;
 
            bool called;
 
            public _Return(TValue value, CancellationToken cancellationToken)
            {
                this.value = value;
                this.cancellationToken = cancellationToken;
                this.called = false;
            }
 
            public TValue Current => value;
 
            public UniTask<bool> MoveNextAsync()
            {
                cancellationToken.ThrowIfCancellationRequested();
 
                if (!called)
                {
                    called = true;
                    return CompletedTasks.True;
                }
 
                return CompletedTasks.False;
            }
 
            public UniTask DisposeAsync()
            {
                return default;
            }
        }
    }
}