Esempio n. 1
0
        public void Start()
        {
            _currentIndex = TabSelectionControl.SelectedIndex.Value ?? 0;

            TabSelectionControl.SelectedIndex
            .WhereNotNull()
            .LazyThrottle(TimeSpan.FromSeconds(SelectionDelay))
            .DistinctUntilChanged()
            .SelectMany(x => ShowContent(x ?? 0))
            .Subscribe(x => _contentView.Value = x)
            .AddTo(this);

            _moveHandler.BindBidirectional(
                ContentTransitionControl,
                TabSelectionControl,
                (MoveDirection)TabPlacement);

            // Combining with view to select gameobject when view is loaded
            _moveHandler.SelectedGameObject
            .WhereNotNull()
            .CombineLatest(ContentTransitionControl.FirstView, (x, y) => x)
            .Where(x => x == ContentTransitionControl.gameObject)
            .Subscribe(x => ContentTransitionControl.FirstView.Value?.SelectDeferred())
            .AddTo(this);
        }