예제 #1
0
            public ConstArg(
                Vector2 relativeCursorLength,
                ScrollerAxis scrollerAxis,
                Vector2 rubberBandLimitMultiplier,
                Vector2 relativeCursorPosition,
                bool isEnabledInertia,
                float inertiaDecay,
                float newScrollSpeedThreshold,

                IGenericSingleElementScrollerAdaptor adaptor,
                ActivationMode activationMode

                ) : base(
                    relativeCursorLength,
                    scrollerAxis,
                    relativeCursorPosition,
                    rubberBandLimitMultiplier,
                    isEnabledInertia,
                    inertiaDecay,
                    newScrollSpeedThreshold,

                    adaptor,
                    activationMode
                    )
            {
            }
예제 #2
0
        public ScrollerConstArg(
            ScrollerAxis scrollerAxis,
            Vector2 relativeCursorPosition,
            Vector2 rubberBandLimitMultiplier,
            bool isEnabledInertia,
            float newScrollSpeedThreshold,

            IUIManager uim,
            IUISystemProcessFactory processFactory,
            IUIElementFactory uieFactory,
            IScrollerAdaptor uia,
            IUIImage uiImage,
            ActivationMode activationMode
            ) : base(
                uim,
                processFactory,
                uieFactory,
                uia,
                uiImage,
                activationMode
                )
        {
            thisScrollerAxis              = scrollerAxis;
            thisRelativeCursorPos         = relativeCursorPosition;
            thisRubberBandLimitMultiplier = rubberBandLimitMultiplier;
            thisIsEnabledInertia          = isEnabledInertia;
            thisNewScrollSpeedThreshold   = newScrollSpeedThreshold;
        }
예제 #3
0
            public ConstArg(
                int initiallyCursoredElementIndex,
                int[] cursorSize,
                float startSearchSpeed,
                bool activatesCursoredElementsOnly,

                Vector2 relativeCursorPosition,
                ScrollerAxis scrollerAxis,
                Vector2 rubberBandLimitMultiplier,
                bool isEnabledInertia,
                float inertiaDecay,
                bool swipeToSnapNext,
                float newScrollSpeedThreshold,

                IUIElementGroupScrollerAdaptor adaptor,
                ActivationMode activationMode
                ) : base(
                    scrollerAxis,
                    relativeCursorPosition,
                    rubberBandLimitMultiplier,
                    isEnabledInertia,
                    inertiaDecay,
                    newScrollSpeedThreshold,

                    adaptor,
                    activationMode
                    )
            {
                thisCursorSize = cursorSize;
                thisInitiallyCursoredElementIndex = initiallyCursoredElementIndex;
                thisStartSearchSpeed = startSearchSpeed;
                thisSwipeToSnapNext  = swipeToSnapNext;
                thisActivatesCursoredElementsOnly = activatesCursoredElementsOnly;
            }
예제 #4
0
        public GenericSingleElementScrollerConstArg(
            Vector2 relativeCursorLength,
            ScrollerAxis scrollerAxis,
            Vector2 rubberBandLimitMultiplier,
            Vector2 relativeCursorPosition,
            bool isEnabledInertia,
            float newScrollSpeedThreshold,

            IUIManager uim,
            IUISystemProcessFactory processFactory,
            IUIElementFactory uieFactory,
            IGenericSingleElementScrollerAdaptor uia,
            IUIImage image,
            ActivationMode activationMode

            ) : base(
                scrollerAxis,
                relativeCursorPosition,
                rubberBandLimitMultiplier,
                isEnabledInertia,
                newScrollSpeedThreshold,

                uim,
                processFactory,
                uieFactory,
                uia,
                image,
                activationMode
                )
        {
            thisRelativeCursorLength = relativeCursorLength;
        }
        public CyclableUIElementGroupScrollerConstArg(
            bool[] isCycleEnabled,
            int initiallyCursoredElementIndex,
            int[] cursorSize,
            float startSearchSpeed,
            bool activatesCursoredElementsOnly,

            Vector2 relativeCursorPosition,
            ScrollerAxis scrollerAxis,
            Vector2 rubberBandLimitMultiplier,
            bool isEnabledInertia,
            bool swipeToSnapNext,
            float newScrollSpeedThreshold,

            IUIManager uim,
            IUISystemProcessFactory processFactory,
            IUIElementFactory uieFactory,
            IUIElementGroupScrollerAdaptor uia,
            IUIImage image,
            ActivationMode activationMode
            ) : base(
                initiallyCursoredElementIndex,
                cursorSize,
                startSearchSpeed,
                activatesCursoredElementsOnly,

                relativeCursorPosition,
                scrollerAxis,
                rubberBandLimitMultiplier,
                isEnabledInertia,
                swipeToSnapNext,
                newScrollSpeedThreshold,

                uim,
                processFactory,
                uieFactory,
                uia,
                image,
                activationMode
                )
        {
            thisIsCycleEnabled = isCycleEnabled;
        }
    TestGenericSingleElementScroller CreateGenericSingleElementScroller(Vector2 relativeCursorLength)
    {
        ScrollerAxis            scrollerAxis = ScrollerAxis.Both;
        Vector2                 rubberBandLimitMultiplier = new Vector2(.1f, .1f);
        Vector2                 relativeCursorPosition    = new Vector2(.5f, .5f);
        IUIManager              uim              = Substitute.For <IUIManager>();
        IUISystemProcessFactory processFactory   = Substitute.For <IUISystemProcessFactory>();
        IUIElementFactory       uieFactory       = Substitute.For <IUIElementFactory>();
        IGenericSingleElementScrollerAdaptor uia = Substitute.For <IGenericSingleElementScrollerAdaptor>();
        Rect scrollerRect = new Rect(Vector2.zero, new Vector2(200f, 100f));

        uia.GetRect().Returns(scrollerRect);
        IUIElement child       = Substitute.For <IUIElement>();
        IUIAdaptor childUIA    = Substitute.For <IUIAdaptor>();
        Rect       elementRect = new Rect(Vector2.zero, new Vector2(100f, 100f));

        childUIA.GetRect().Returns(elementRect);
        child.GetUIAdaptor().Returns(childUIA);
        List <IUIElement> returnedList = new List <IUIElement>(new IUIElement[] { child });

        uia.GetChildUIEs().Returns(returnedList);
        IUIImage image = Substitute.For <IUIImage>();
        float    newScrollSpeedThreshold = 200f;

        IGenericSingleElementScrollerConstArg arg = new GenericSingleElementScrollerConstArg(
            relativeCursorLength,
            scrollerAxis,
            rubberBandLimitMultiplier,
            relativeCursorPosition,
            true,
            newScrollSpeedThreshold,

            uim,
            processFactory,
            uieFactory,
            uia,
            image,
            ActivationMode.None
            );

        return(new TestGenericSingleElementScroller(arg));
    }
    public void Calculate_Various(
        int[] arraySize,
        int[] cursorSize,
        ScrollerAxis scrollerAxis,
        Vector2 velocity,
        int[] currentElementUnderCursorArrayIndex,
        int[] expectedArrayIndex
        )
    {
        IUIElementGroup uieGroup = Substitute.For <IUIElementGroup>();

        for (int i = 0; i < 2; i++)
        {
            uieGroup.GetArraySize(i).Returns(arraySize[i]);
        }
        ISwipeNextTargetGroupElementArrayIndexCalculator calculator = new SwipeNextTargetGroupElementArrayIndexCalculator(uieGroup, cursorSize, scrollerAxis);

        int[] actual = calculator.Calculate(velocity, currentElementUnderCursorArrayIndex);

        Assert.That(actual, Is.EqualTo(expectedArrayIndex));
    }
예제 #8
0
            public ConstArg(
                ScrollerAxis scrollerAxis,
                Vector2 relativeCursorPosition,
                Vector2 rubberBandLimitMultiplier,
                bool isEnabledInertia,
                float inertiaDecay,
                float newScrollSpeedThreshold,

                IScrollerAdaptor adaptor,
                ActivationMode activationMode
                ) : base(
                    adaptor,
                    activationMode
                    )
            {
                thisScrollerAxis              = scrollerAxis;
                thisRelativeCursorPos         = relativeCursorPosition;
                thisRubberBandLimitMultiplier = rubberBandLimitMultiplier;
                thisIsEnabledInertia          = isEnabledInertia;
                thisInertiaDecay              = inertiaDecay;
                thisNewScrollSpeedThreshold   = newScrollSpeedThreshold;
            }
예제 #9
0
    public IUIElementGroupScrollerConstArg CreateMockConstArg(
        int initiallyCursoredElementIndex,
        int[] cursorSize,
        Vector2 relativeCursorPosition,
        ScrollerAxis scrollerAxis,
        Vector2 rubberBandLimitMultiplier,
        Vector2 scrollerLength,
        Vector2 elementGroupLength
        )
    {
        IUIElementGroupScrollerConstArg arg = Substitute.For <IUIElementGroupScrollerConstArg>();

        arg.initiallyCursoredGroupElementIndex.Returns(initiallyCursoredElementIndex);
        arg.cursorSize.Returns(cursorSize);
        arg.startSearchSpeed.Returns(1f);
        arg.relativeCursorPosition.Returns(relativeCursorPosition);
        arg.scrollerAxis.Returns(scrollerAxis);
        arg.rubberBandLimitMultiplier.Returns(rubberBandLimitMultiplier);
        arg.isEnabledInertia.Returns(true);
        arg.swipeToSnapNext.Returns(false);
        arg.uim.Returns(Substitute.For <IUIManager>());
        arg.processFactory.Returns(Substitute.For <IUISystemProcessFactory>());
        arg.uiElementFactory.Returns(Substitute.For <IUIElementFactory>());
        IScrollerAdaptor scrollerAdaptor = Substitute.For <IScrollerAdaptor>();

        scrollerAdaptor.GetRect().Returns(new Rect(Vector2.zero, scrollerLength));
        IUIElementGroup uieGroup = Substitute.For <IUIElementGroup>();

        uieGroup.GetGroupElementArrayIndex(Arg.Any <IUIElement>()).Returns(new int[] { 0, 0 });
        IUIElementGroupAdaptor uieGroupAdaptor = Substitute.For <IUIElementGroupAdaptor>();

        uieGroup.GetUIAdaptor().Returns(uieGroupAdaptor);
        uieGroupAdaptor.GetRect().Returns(new Rect(Vector2.zero, elementGroupLength));
        scrollerAdaptor.GetChildUIEs().Returns(new List <IUIElement>(new IUIElement[] { uieGroup }));
        arg.uia.Returns(scrollerAdaptor);
        arg.image.Returns(Substitute.For <IUIImage>());
        return(arg);
    }
 public SwipeNextTargetGroupElementArrayIndexCalculator(IUIElementGroup uieGroup, int[] cursorSize, ScrollerAxis scrollerAxis)
 {
     thisUIElementGroup = uieGroup;
     thisCursorSize     = cursorSize;
     thisScrollerAxis   = scrollerAxis;
 }