public void SetParentUIE(IUIElement newParentUIE, bool worldPositionStays) { IUIAdaptor newParentUIA = newParentUIE.GetUIAdaptor(); Transform parentTransform = newParentUIA.GetTransform(); this.transform.SetParent(parentTransform, worldPositionStays); newParentUIA.UpdateUIAdaptorHiearchy(true); }
protected virtual void SetUpScrollerElementRect() { IUIAdaptor scrollerElementAdaptor = thisScrollerElement.GetUIAdaptor(); thisScrollerElementRect = scrollerElementAdaptor.GetRect(); thisScrollerElementLength = new Vector2( thisScrollerElementRect.width, thisScrollerElementRect.height ); }
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)); }