Пример #1
0
 public PlayerStreams(PlayerState playerState)
 {
     this.playerState = playerState;
     countStream      = UniTaskAsyncEnumerable
                        .EveryValueChanged(playerState, s => s.players.Count)
                        .Select(_ => playerState.players.Select(x => x.id))
                        .ToReadOnlyAsyncReactiveProperty(cts.Token);
 }
Пример #2
0
        private void Start()
        {
            this.Magenta($"[{GetType().Name}] Press {_triggerKey} to start fade-in and fade-out.");

            var token = this.GetCancellationTokenOnDestroy();

            UniTaskAsyncEnumerable.EveryValueChanged(this, fade => Input.GetKeyDown(_triggerKey))
            .SubscribeAwait(async _ => await DummyLoadingProgress(token), token);
        }
        private void Start()
        {
            var token = this.GetCancellationTokenOnDestroy();

            _cubeIndex.WithoutCurrent().Subscribe(OpenBottom, token);

            UniTaskAsyncEnumerable.EveryValueChanged(_activeCube, collection => collection.IsCompleted)
            .Where(completed => completed)
            .Subscribe(_ => OnCubeCompleted(), token);
        }