Beispiel #1
0
        public IDigitPanelSet CreateDigitPanelSet(int digitPlace, IQuantityRoller quantityRoller, Vector2 panelDim, Vector2 padding)
        {
            IDigitPanelSetAdaptorInitializationData uiaInitData = new DigitPanelSetAdaptorInitializationData(
                digitPlace,
                panelDim,
                padding
                );
            float   panelSetWidth  = panelDim.x;
            float   panelSetHeight = panelDim.y * 2 + padding.y;
            Vector2 panelSetLength = new Vector2(panelSetWidth, panelSetHeight);
            IDigitPanelSetInstantiationData instData = new DigitPanelSetInstantiationData(
                panelSetLength,
                uiaInitData
                );
            DigitPanelSetAdaptor digitPanelSetAdaptor  = CreateInstatiableUIA <DigitPanelSetAdaptor>(instData);
            IUIAdaptor           quantityRollerAdaptor = quantityRoller.GetUIAdaptor();

            digitPanelSetAdaptor.SetParentUIA(quantityRollerAdaptor, true);
            IUIAdaptorBaseInitializationData baseInitData = quantityRollerAdaptor.GetDomainInitializationData();

            digitPanelSetAdaptor.GetReadyForActivation(
                baseInitData,
                false
                );
            IDigitPanelSet digitPanelSet = (IDigitPanelSet)digitPanelSetAdaptor.GetUIElement();

            return(digitPanelSet);
        }
 protected void SetUpElementLength(Vector2 elementLength)
 {
     thisElementLength = elementLength;
     foreach (IUIElement element in thisGroupElements)
     {
         IUIAdaptor elementUIA = element.GetUIAdaptor();
         elementUIA.SetRectLength(elementLength);
     }
 }
Beispiel #3
0
 public ConstArg(
     IUIAdaptor adaptor,
     ActivationMode activationMode
     ) : base(
         adaptor
         )
 {
     thisActivationMode = activationMode;
 }
Beispiel #4
0
        public void SetParentUIE(IUIElement newParentUIE, bool worldPositionStays)
        {
            IUIAdaptor newParentUIA    = newParentUIE.GetUIAdaptor();
            Transform  parentTransform = newParentUIA.GetTransform();

            this.transform.SetParent(parentTransform, worldPositionStays);

            newParentUIA.UpdateUIAdaptorHiearchy(true);
        }
Beispiel #5
0
        protected virtual void SetUpScrollerElementRect()
        {
            IUIAdaptor scrollerElementAdaptor = thisScrollerElement.GetUIAdaptor();

            thisScrollerElementRect   = scrollerElementAdaptor.GetRect();
            thisScrollerElementLength = new Vector2(
                thisScrollerElementRect.width,
                thisScrollerElementRect.height
                );
        }
 string GetUIAName(IUIAdaptor uia)
 {
     if (uia == null)
     {
         return("null");
     }
     else
     {
         return(uia.GetName());
     }
 }
Beispiel #7
0
        IUIAdaptor CalcParentUIAdaptor()
        {
            Transform parent = this.transform.parent;

            if (parent != null)
            {
                IUIAdaptor parentUIAdaptor = parent.GetComponent(typeof(IUIAdaptor)) as IUIAdaptor;
                return(parentUIAdaptor);
            }
            return(null);
        }
 public ConstArg(
     IUIManager uiManager,
     IUIElement uiElement,
     IUIAdaptor uiAdaptor,
     IUISystemProcessFactory processFactory
     )
 {
     thisUIManager      = uiManager;
     thisUIAdaptor      = uiAdaptor;
     thisUIElement      = uiElement;
     thisProcessFactory = processFactory;
 }
Beispiel #9
0
        protected override IRectCalculationData CreateRectCalculationData(
            IUIElement[] groupElements
            )
        {
            IUIAdaptor parentUIAdaptor = thisParentUIAdaptor;

            return(new ScrollerConstraintRectCalculationData(
                       elementToPaddingRatio,
                       parentUIAdaptor,
                       GetRectSize()
                       ));
        }
Beispiel #10
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);
        }
        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);
        }
Beispiel #12
0
        List <IUIAdaptor> CalcChildUIAdaptors()
        {
            List <IUIAdaptor> result = new List <IUIAdaptor>();

            for (int i = 0; i < transform.childCount; i++)
            {
                Transform  child    = transform.GetChild(i);
                IUIAdaptor childUIA = child.GetComponent(typeof(IUIAdaptor)) as IUIAdaptor;
                if (childUIA != null)
                {
                    result.Add(childUIA);
                }
            }
            return(result);
        }
Beispiel #13
0
    IIconGroupConstArg CreateStubIconGroupConstArg(int minSize, int maxSize)
    {
        IIconGroupConstArg thisArg = Substitute.For <IIconGroupConstArg>();
        IUIManager         uim     = Substitute.For <IUIManager>();
        IUIAdaptor         uia     = Substitute.For <IUIAdaptor>();
        IUIImage           image   = Substitute.For <IUIImage>();

        thisArg.uim.Returns(uim);
        thisArg.uia.Returns(uia);
        thisArg.image.Returns(image);
        thisArg.minSize.Returns(minSize);
        thisArg.maxSize.Returns(maxSize);

        return(thisArg);
    }
    public void Expire_NotHides_CallsEngineSwitchToShownState()
    {
        IAlphaPopUpProcessConstArg arg = CreateMockArg();
        IUIAdaptor uia = Substitute.For <IUIAdaptor>();

        uia.GetGroupAlpha().Returns(0f);    //required not to early break
        arg.popUp.GetUIAdaptor().Returns(uia);
        arg.hides.Returns(false);
        TestAlphaPopUpProcess process = new TestAlphaPopUpProcess(arg);

        process.Run();//required for interpolator set up

        process.Expire();

        arg.engine.Received(1).SwitchToShownState();
    }
    /*  */
    public EquipToolEquippedItemsPanel CreateEqpToolEqpItemsPanel(out IEquipToolPanelConstArg arg)
    {
        IUIManager uim = Substitute.For <IUIManager>();
        IPickUpSystemProcessFactory pickUpSystemProcessFactory = Substitute.For <IPickUpSystemProcessFactory>();
        IEquipToolUIEFactory        equipToolUIEFactory        = Substitute.For <IEquipToolUIEFactory>();
        IUIAdaptor                   uia           = Substitute.For <IUIAdaptor>();
        IUIImage                     image         = Substitute.For <IUIImage>();
        IEquippableIITAManager       eqpIITAM      = Substitute.For <IEquippableIITAManager>();
        IEquipTool                   eqpTool       = Substitute.For <IEquipTool>();
        IPanelTransactionStateEngine engine        = Substitute.For <IPanelTransactionStateEngine>();
        IEquipToolPanelConstArg      thisArg       = new EquipToolPanelConstArg(uim, pickUpSystemProcessFactory, equipToolUIEFactory, uia, image, eqpTool, eqpIITAM, engine);
        EquipToolEquippedItemsPanel  eqpItemsPanel = new EquipToolEquippedItemsPanel(thisArg);

        arg = thisArg;
        return(eqpItemsPanel);
    }
Beispiel #16
0
    public void GetLatestInitialValueDifference_Various(float currentGroupAlpha, bool doesActivate, float expectedValueDifference)
    {
        IAlphaActivatorUIEActivationProcessConstArg arg = CreateMockConstArg();

        arg.doesActivate.Returns(doesActivate);
        IUIAdaptor uia = Substitute.For <IUIAdaptor>();

        uia.GetGroupAlpha().Returns(currentGroupAlpha);
        arg.uiElement.GetUIAdaptor().Returns(uia);
        TestAlphaActivatorUIEActivationProcess process = new TestAlphaActivatorUIEActivationProcess(arg);


        float actual = process.GetLatestInitialValueDifference_Test();

        Assert.That(actual, Is.EqualTo(expectedValueDifference));
    }
Beispiel #17
0
        public UIElementConstArg(
            IUIManager uim,
            IUISystemProcessFactory processFactory,
            IUIElementFactory uiElementFactory,
            IUIAdaptor uia,
            IUIImage image,
            ActivationMode activationMode

            )
        {
            thisUIM              = uim;
            thisProcessFactory   = processFactory;
            thisUIElementFactory = uiElementFactory;
            thisUIA              = uia;
            thisImage            = image;
            thisActivationMode   = activationMode;
        }
        public UIAdaptorInputStateEngine(
            IConstArg arg
            )
        {
            IUIAdaptor uia = arg.uiAdaptor;

            thisUIE = arg.uiElement;
            IUISystemProcessFactory procFac = arg.processFactory;

            thisUIManager = arg.uiManager;

            IUIAdaptorInputStateConstArg pointerUpInputStateArg = new UIAdaptorInputStateConstArg(
                this
                );

            thisWaitingForFirstTouchState = new WaitingForFirstTouchState(
                pointerUpInputStateArg
                );

            IPointerDownInputProcessStateConstArg pointerDownProcessStateArg = new PointerDownInputProcessStateConstArg(
                this,
                thisUIManager,
                thisVelocityStackSize,
                // thisUIManager.GetSwipeVelocityThreshold(),
                // thisUIManager.GetSwipeDistanceThreshold(),
                procFac
                );

            thisWaitingForTapState = new WaitingForTapState(
                pointerDownProcessStateArg
                );
            thisWaitingForReleaseState = new WaitingForReleaseState(
                pointerDownProcessStateArg
                );

            IPointerUpInputProcessStateConstArg pointerUpInputProcessStateArg = new PointerUpInputProcessStateConstArg(
                this,
                procFac
                );

            thisWaitingForNextTouchState = new WaitingForNextTouchState(
                pointerUpInputProcessStateArg
                );
            SetWithInitState();
            ResetTouchCounter();
        }
Beispiel #19
0
        public IDigitPanel CreateDigitPanel(IDigitPanelSet parentDigitPanelSet, Vector2 panelDim, float localPosY)
        {
            IDigitPanelAdaptorInitializationData uiaInitData = new DigitPanelAdaptorInitializationData(panelDim, localPosY);
            IDigitPanelInstantiationData         instData    = new DigitPanelInstantiationData(panelDim, uiaInitData);
            DigitPanelAdaptor digitPanelAdaptor = CreateInstatiableUIA <DigitPanelAdaptor>(instData);
            IUIAdaptor        parentUIA         = parentDigitPanelSet.GetUIAdaptor();

            digitPanelAdaptor.SetParentUIA(parentUIA, true);
            IUIAdaptorBaseInitializationData baseInitData = parentUIA.GetDomainInitializationData();

            digitPanelAdaptor.GetReadyForActivation(
                baseInitData,
                false
                );
            IDigitPanel digitPanel = (IDigitPanel)digitPanelAdaptor.GetUIElement();

            return(digitPanel);
        }
    public void GetLatestInitialValueDifference_ReturnsVarious(
        float curGroupAlpha,
        bool hides,
        float expected
        )
    {
        IAlphaPopUpProcessConstArg arg = CreateMockArg();

        arg.hides.Returns(hides);
        IUIAdaptor uia = Substitute.For <IUIAdaptor>();

        uia.GetGroupAlpha().Returns(curGroupAlpha);
        arg.popUp.GetUIAdaptor().Returns(uia);
        TestAlphaPopUpProcess process = new TestAlphaPopUpProcess(arg);

        float actual = process.GetLatestInitialValueDifference_Test();

        Assert.That(actual, Is.EqualTo(expected));
    }
Beispiel #21
0
 /* Setting up UIA Hierarchy */
 public void UpdateUIAdaptorHiearchy(bool recursively)
 {
     UpdateUIAdaptorHiearchyImple();
     if (recursively)
     {
         foreach (IUIAdaptor childUIAdaptor in thisChildUIAdaptors)
         {
             childUIAdaptor.UpdateUIAdaptorHiearchy(true);
         }
     }
     else
     {
         IUIAdaptor parentUIA = thisParentUIAdaptor;
         if (parentUIA != null)
         {
             parentUIA.UpdateUIAdaptorHiearchy(false);
         }
     }
 }
    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));
    }
Beispiel #23
0
        IUIAdaptor[] GetChildUIAdaptors()
        {
            List <IUIAdaptor> resultList = new List <IUIAdaptor>();
            int childCount = transform.childCount;

            for (int i = 0; i < childCount; i++)
            {
                Transform   child      = transform.GetChild(i);
                Component[] components = child.GetComponents <Component>();
                foreach (Component comp in components)
                {
                    if (comp is IUIAdaptor)
                    {
                        IUIAdaptor adaptor = (IUIAdaptor)comp;
                        resultList.Add(adaptor);
                    }
                }
            }
            return(resultList.ToArray());
        }
        public DigitPanelSetConstArg(
            IUIManager uim,
            IUISystemProcessFactory processFactory,
            IUIElementFactory uiElementFactory, IUIAdaptor uia,
            IUIImage image,

            int digitPlace,
            Vector2 panelDim,
            Vector2 padding
            ) : base(
                uim,
                processFactory,
                uiElementFactory,
                uia,
                image,
                ActivationMode.None
                )
        {
            thisDigitPlace = digitPlace;
        }
Beispiel #25
0
 public ScrollerConstraintRectCalculationData(
     Vector2 elementToPaddingRatio,
     IUIAdaptor parentUIAdaptor,
     Vector2 groupLengthAsNonScrollerElement
     )
 {
     thisElementToPaddingRatio = elementToPaddingRatio;
     if (parentUIAdaptor != null)
     {
         if (parentUIAdaptor is IUIElementGroupScrollerAdaptor)
         {
             parentIsGroupScroller = true;
             IUIElementGroupScrollerAdaptor groupScrollerAdaptor = (IUIElementGroupScrollerAdaptor)parentUIAdaptor;
             thisGroupScrollerLength = groupScrollerAdaptor.GetRectSize();
             thisCursorSize          = groupScrollerAdaptor.GetCursorSize();
             return;
         }
     }
     thisGroupLengthAsNonScrollerElement = groupLengthAsNonScrollerElement;
 }
        IUIElement[] CreateUIEs()
        {
            List <IUIElement> resultList = new List <IUIElement>();

            for (int i = 0; i < groupElementCount; i++)
            {
                // GameObject go = GameObject.Instantiate(uiElementPrefab, this.GetTransform());
                GameObject go = GameObject.Instantiate(uiElementPrefab);
                go.transform.localScale = thisCanvasLocalScale;
                go.transform.SetParent(this.GetTransform());
                IUIAdaptor adaptor = (IUIAdaptor)go.GetComponent(typeof(IUIAdaptor));
                adaptor.SetIndex(i);
                adaptor.SetUpRecursively();
                adaptor.SetUpReferenceRecursively();

                IUIElement element = adaptor.GetUIElement();
                resultList.Add(element);
            }
            return(resultList.ToArray());
        }
Beispiel #27
0
 public PickableUIEConstArg(
     IUIManager uim,
     IPickUpSystemProcessFactory pickUpSystemProcessFactory,
     IPickUpSystemUIElementFactory pickUpSystemUIElementFactory,
     IUIAdaptor uia,
     IPickableUIImage pickableUIImage,
     IUITool tool,
     IDragImageImplementor dragImageImplementor,
     IVisualPickednessStateEngine visualPickednessStateEngine
     ) : base(
         uim,
         pickUpSystemProcessFactory,
         pickUpSystemUIElementFactory,
         uia,
         pickableUIImage,
         ActivationMode.None
         )
 {
     thisDragImageImplementor        = dragImageImplementor;
     thisVisualPickednessStateEngien = visualPickednessStateEngine;
 }
Beispiel #28
0
        public UIManager(
            IProcessManager processManager,
            IUIAdaptor rootUIAdaptor,
            RectTransform uieReserveTrans,
            bool showsInputability,

            float imageDarkenedBrightness,
            float imageDefaultBrightness,

            float swipeVelocityThreshold
            )
        {
            thisProcessManager    = processManager;
            thisRootUIAdaptor     = rootUIAdaptor;
            thisUIEReserveTrans   = uieReserveTrans;
            thisShowsInputability = showsInputability;

            thisImageDarknedBrightness = imageDarkenedBrightness;
            thisImageDefaultBrightnes  = imageDefaultBrightness;
            thisPopUpManager           = new PopUpManager();

            thisSwipeVelocityThreshold = swipeVelocityThreshold;
        }
        public ColorChangeButtonConstArg(
            IUIManager uim,
            IUISystemProcessFactory processFactory,
            IUIElementFactory uieFactory,
            IColorChangeButtonAdaptor uia,
            IUIImage uiImage,

            IUIAdaptor targetUIAdaptor,
            Color targetColor,
            Text targetText
            ) : base(
                uim,
                processFactory,
                uieFactory,
                uia,
                uiImage,
                ActivationMode.None
                )
        {
            thisTargetUIAdaptor = targetUIAdaptor;
            thisTargetColor     = targetColor;
            thisText            = targetText;
        }
        public EquipToolPanelConstArg(
            IUIManager uim,
            IPickUpSystemProcessFactory pickUpSystemProcessFactory,
            IEquipToolUIEFactory equipToolUIEFactory,
            IUIAdaptor uia,
            IUIImage image,


            IEquipTool eqpTool,
            IEquippableIITAManager eqpIITAM,
            IPanelTransactionStateEngine engine
            ) : base(
                uim,
                pickUpSystemProcessFactory,
                equipToolUIEFactory,
                uia,
                image,
                ActivationMode.None
                )
        {
            thisEqpIITAM = eqpIITAM;
            thisPanelTransactionStateEngine = engine;
            thisEquipTool = eqpTool;
        }