Esempio n. 1
0
        public async Task AsyncKeyless()
        {
            this.asyncKeylessS.Subscribe(async(x, ct) =>
            {
                await Task.Delay(TimeSpan.FromSeconds(2), ct);
                Console.WriteLine("A:" + x.MyProperty);
            });

            var d = this.asyncKeylessS.Subscribe(async(x, ct) =>
            {
                await Task.Delay(TimeSpan.FromSeconds(1), ct);
                Console.WriteLine("B:" + x.MyProperty);
            });

            await asyncKeylessP.PublishAsync(new MyMessage()
            {
                MyProperty = "tako"
            });

            await asyncKeylessP.PublishAsync(new MyMessage()
            {
                MyProperty = "yaki"
            });

            Console.WriteLine("here?");

            d.Dispose();

            await asyncKeylessP.PublishAsync(new MyMessage()
            {
                MyProperty = "kamo"
            });
        }
Esempio n. 2
0
            public async UniTask SendAsync(MyEvent ev)
            {
                // Subscriberの購読処理が終わるまで待つ
                await _asyncPublisher.PublishAsync(ev);

                Debug.Log("イベント送信完了");
            }
Esempio n. 3
0
        public async UniTask OnStateBegan(CancellationToken cancellationToken)
        {
            GenerateLevel();

            await UniTask.WhenAll(
                _answersPublisher.PublishAsync(OwnState, _gameModel.answers, cancellationToken),
                _correctAnswerPublisher.PublishAsync(OwnState, _gameModel.correctAnswer, cancellationToken));
        }
Esempio n. 4
0
 public UniTask PublishAsync(TKey key, TMessage message, CancellationToken cancellationToken = default)
 {
     return(publisher.PublishAsync(key, message, cancellationToken));
 }
Esempio n. 5
0
 public async UniTask OnStateBegan(CancellationToken token)
 {
     await _answerResultPublisher.PublishAsync(OwnState, _gameModel.IsAnswerCorrect, token);
 }
Esempio n. 6
0
 public async UniTask OnStateBegan(CancellationToken token)
 {
     await _gameStatePublisher.PublishAsync(OwnState, token);
 }