三国卡牌客户端基础资源仓库
yyl
2025-05-15 aac116baba3b0c43808e05458c2d4793a0729730
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 System;
 
namespace Cysharp.Threading.Tasks
{
    public abstract class MoveNextSource : IUniTaskSource<bool>
    {
        protected UniTaskCompletionSourceCore<bool> completionSource;
 
        public bool GetResult(short token)
        {
            return completionSource.GetResult(token);
        }
 
        public UniTaskStatus GetStatus(short token)
        {
            return completionSource.GetStatus(token);
        }
 
        public void OnCompleted(Action<object> continuation, object state, short token)
        {
            completionSource.OnCompleted(continuation, state, token);
        }
 
        public UniTaskStatus UnsafeGetStatus()
        {
            return completionSource.UnsafeGetStatus();
        }
 
        void IUniTaskSource.GetResult(short token)
        {
            completionSource.GetResult(token);
        }
 
        protected bool TryGetResult<T>(UniTask<T>.Awaiter awaiter, out T result)
        {
            try
            {
                result = awaiter.GetResult();
                return true;
            }
            catch (Exception ex)
            {
                completionSource.TrySetException(ex);
                result = default;
                return false;
            }
        }
 
        protected bool TryGetResult(UniTask.Awaiter awaiter)
        {
            try
            {
                awaiter.GetResult();
                return true;
            }
            catch (Exception ex)
            {
                completionSource.TrySetException(ex);
                return false;
            }
        }
    }
}