예제 #1
0
        public void Init(IItemsProvider itemsProvider, IWidgetsProvider widgetsProvider)
        {
            _itemsProvider   = itemsProvider;
            _itemsViewport   = new ItemsViewport(itemsProvider);
            _widgetsViewport = new WidgetsViewport(_contentNode, widgetsProvider, _alignment, _spacing);
            Axis axis = AxisMaskDesc.WidgetsAlignmentAxis[_alignment];

            _scroller = GetComponent <Scroller>();
            _scroller.Init(_viewportNode, axis, _speedCoef, _inertiaCoef, _elasticityCoef);
            _scroller.onScroll += OnScroll;

            _scrollNavigation = GetComponent <ScrollNavigation>();
            _scrollNavigation.Init(_itemsViewport, _widgetsViewport, axis, InitialRefreshViewport);
            _scrollNavigation.onScroll         += OnScrollNavigation;
            _scrollNavigation.onScrollStarted  += OnScrollNavigationStarted;
            _scrollNavigation.onScrollFinished += OnScrollNavigationFinished;

            InitialRefreshViewport();
        }