Пример #1
0
        void CalcAndSetRectDimension(Vector2 panelDim, Vector2 rollerNormPos, Vector2 padding)
        {
            int        digitsCount  = thisAllDigitPanelSets.Count;
            IUIAdaptor parentUIA    = this.GetParentUIE().GetUIAdaptor();
            float      parentHeight = parentUIA.GetRect().height;
            float      parentWidth  = parentUIA.GetRect().width;

            float rollerHeight = panelDim.y + (padding.y * 2);
            float rollerWidth  = (panelDim.x * digitsCount) + (padding.x * (digitsCount + 1));
            float localX       = rollerNormPos.x * (parentWidth - rollerWidth);
            float localY       = rollerNormPos.y * (parentHeight - rollerHeight);

            ((IQuantityRollerAdaptor)thisUIA).SetRectDimension(rollerHeight, rollerWidth, localX, localY);
        }
Пример #2
0
        protected virtual void SetUpScrollerElementRect()
        {
            IUIAdaptor scrollerElementAdaptor = thisScrollerElement.GetUIAdaptor();

            thisScrollerElementRect   = scrollerElementAdaptor.GetRect();
            thisScrollerElementLength = new Vector2(
                thisScrollerElementRect.width,
                thisScrollerElementRect.height
                );
        }
Пример #3
0
        void CalcAndSetRectDimension(Vector2 panelDim, Vector2 padding)
        {
            IQuantityRoller roller      = (IQuantityRoller)this.GetParentUIE();
            IUIAdaptor      rollerUIA   = roller.GetUIAdaptor();
            Rect            rollerRect  = rollerUIA.GetRect();
            float           rollerWidth = rollerRect.width;

            float height = (panelDim.y * 2) + (padding.y * 3);
            float width  = panelDim.x;
            float localX = rollerWidth - ((width + padding.x) * (thisDigitPlace + 1));
            float localY = 0f;

            ((IDigitPanelSetAdaptor)this.GetUIAdaptor()).SetRectDimension(height, width, localX, localY);
        }
    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));
    }
    IGenericSingleElementScrollerConstArg CreateMockConstArg()
    {
        IGenericSingleElementScrollerConstArg arg = Substitute.For <IGenericSingleElementScrollerConstArg>();

        arg.relativeCursorLength.Returns(new Vector2(.5f, .5f));
        arg.scrollerAxis.Returns(ScrollerAxis.Both);
        arg.rubberBandLimitMultiplier.Returns(new Vector2(.1f, .1f));
        arg.relativeCursorPosition.Returns(new Vector2(0f, 0f));
        arg.isEnabledInertia.Returns(true);
        arg.uim.Returns(Substitute.For <IUIManager>());
        arg.processFactory.Returns(Substitute.For <IUISystemProcessFactory>());
        arg.uiElementFactory.Returns(Substitute.For <IUIElementFactory>());
        IGenericSingleElementScrollerAdaptor uia = Substitute.For <IGenericSingleElementScrollerAdaptor>();

        uia.GetRect().Returns(new Rect(Vector2.zero, new Vector2(200f, 100f)));
        uia.GetChildUIEs().Returns(new List <IUIElement>(new IUIElement[] { Substitute.For <IUIElement>() }));
        IUIAdaptor childAdaptor = Substitute.For <IUIAdaptor>();

        childAdaptor.GetRect().Returns(new Rect(Vector2.zero, new Vector2(100f, 100f)));
        uia.GetChildUIEs()[0].GetUIAdaptor().Returns(childAdaptor);
        arg.uia.Returns(uia);
        arg.image.Returns(Substitute.For <IUIImage>());
        return(arg);
    }