コード例 #1
0
        public CurrentHoveredTileCoordinateViewModel(ICurrentHoveredTileHolderGetRepository repository)
        {
            CoordinateLiveData = new LiveData <Coordinate?>();

            _disposable = repository.GetObservableStream()
                          .SubscribeOn(Scheduler.ThreadPool)
                          .ObserveOn(Scheduler.MainThread)
                          .Subscribe(
                holder =>
                CoordinateLiveData.PostValue(holder != null ? holder.Value.Coordinate : (Coordinate?)null)
                );
        }
コード例 #2
0
        public HoveredTileIndicatorViewModel(ICurrentHoveredTileHolderGetRepository hoveredTileHolderGetRepository,
                                             ICurrentSelectedTileHolderGetRepository selectedTileHolderGetRepository)
        {
            CurrentlyHoveredTileHolderLiveData  = new LiveData <TileHolder>();
            CurrentlySelectedTileHolderLiveData = new LiveData <TileHolder>();

            _disposable = new CompositeDisposable
            {
                hoveredTileHolderGetRepository
                .GetObservableStream()
                .Subscribe(CurrentlyHoveredTileHolderLiveData.PostValue),
                selectedTileHolderGetRepository
                .GetObservableStream()
                .Subscribe(CurrentlySelectedTileHolderLiveData.PostValue)
            };
        }