示例#1
0
        private void Awake()
        {
            _movieDataView    = FindObjectOfType <MovieDataView>();
            _movieLoaderModel = FindObjectOfType <MovieLoader>();

            _currentMovieIndex = 0;
        }
示例#2
0
        private void MoviesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            _movieDataView = FindObjectOfType <MovieDataView>();

            if (_movieDataView != null)
            {
                if (_movieDataView.IsUpdated == false)
                {
                    Shift(0);
                }

                if (_currentMovieIndex >= _movieLoaderModel.Movies.Count)
                {
                    Shift(_currentMovieIndex - _movieLoaderModel.Movies.Count);
                }
            }
        }
示例#3
0
        /// <summary>
        /// shifts in movie list and display it
        /// </summary>
        /// <param name="amount"></param>
        public void Shift(int amount)
        {
            if (_movieLoaderModel.Movies != null)
            {
                if ((_movieLoaderModel.Movies.Count > _currentMovieIndex + amount) && (_currentMovieIndex + amount >= 0))
                {
                    _currentMovieIndex += amount;
                    _currentMovieData   = _movieLoaderModel.Movies[_currentMovieIndex];

                    if (_movieDataView == null)
                    {
                        _movieDataView = FindObjectOfType <MovieDataView>();
                    }

                    _movieDataView.UpdateMovie(_currentMovieData);
                }
            }
        }