public ScrollChangedEventWaiter(IScroll root, ScrollProperty scrollProperty, double expectedValue) : base(new PropertyChangedEventSource(root as UIObject, Scope.Element, UIProperty.Get("Scroll." + scrollProperty.ToString()))) { Log.Comment("ScrollChangedEventWaiter - Constructor for scrollProperty={0} and expectedValue={1}.", scrollProperty.ToString(), expectedValue.ToString()); this.root = root as UIObject; this.scrollProperty = scrollProperty; this.expectedDoubleValue = expectedValue; if (!double.IsNaN(this.expectedDoubleValue)) { switch (this.scrollProperty) { case ScrollProperty.HorizontalScrollPercent: this.AddFilter(new Predicate <WaiterEventArgs>(args => root.HorizontalScrollPercent == expectedValue)); break; case ScrollProperty.HorizontalViewSize: this.AddFilter(new Predicate <WaiterEventArgs>(args => root.HorizontalViewSize == expectedValue)); break; case ScrollProperty.VerticalScrollPercent: this.AddFilter(new Predicate <WaiterEventArgs>(args => root.VerticalScrollPercent == expectedValue)); break; case ScrollProperty.VerticalViewSize: this.AddFilter(new Predicate <WaiterEventArgs>(args => root.VerticalViewSize == expectedValue)); break; } } this.Reset(); }
public void SetScrollProperty(string objectName, GameObject objectImage1, GameObject objectImage2, int depth, float speed) { ScrollProperty prop = new ScrollProperty(objectName, objectImage1, objectImage2, depth, speed); scrollPropertyList.Add(prop); //Set Inital float objectHeight = scrollPropertyList[scrollPropertyList.Count - 1].ObjectImage1.GetComponent <SpriteRenderer>().bounds.size.y; scrollPropertyList[scrollPropertyList.Count - 1].ObjectImage1.GetComponent <Renderer>().sortingOrder = scrollPropertyList[scrollPropertyList.Count - 1].Depth; scrollPropertyList[scrollPropertyList.Count - 1].ObjectImage1.transform.position = new Vector3(0.0f, 0.0f, 0.0f); scrollPropertyList[scrollPropertyList.Count - 1].ObjectImage2.transform.position = new Vector3(0.0f, objectHeight, 0.0f); }
public static bool ForScrollChanged(Scroller scroller, ScrollProperty scrollProperty) { Log.Comment("Wait.ForScrollChanged call for {0}.", scrollProperty.ToString()); using (UIEventWaiter scrollChangedWaiter = (scrollProperty == ScrollProperty.HorizontallyScrollable || scrollProperty == ScrollProperty.VerticallyScrollable) ? scroller.GetScrollChangedWaiter(scrollProperty, null) : scroller.GetScrollChangedWaiter(scrollProperty, double.NaN)) { if (!scrollChangedWaiter.TryWait(TimeSpan.FromSeconds(5))) { Log.Comment("Timeout expired."); return(false); } } return(true); }
public ScrollChangedEventWaiter(IScroll root, ScrollProperty scrollProperty, bool?expectedValue) : base(new PropertyChangedEventSource(root as UIObject, Scope.Element, UIProperty.Get("Scroll." + scrollProperty.ToString()))) { Log.Comment("ScrollChangedEventWaiter - Constructor for scrollProperty={0} and expectedValue={1}.", scrollProperty.ToString(), expectedValue == null ? "null" : expectedValue.ToString()); this.root = root as UIObject; this.scrollProperty = scrollProperty; this.expectedBoolValue = expectedValue; if (this.expectedBoolValue != null) { switch (this.scrollProperty) { case ScrollProperty.HorizontallyScrollable: this.AddFilter(new Predicate <WaiterEventArgs>(args => root.HorizontallyScrollable == expectedValue)); break; case ScrollProperty.VerticallyScrollable: this.AddFilter(new Predicate <WaiterEventArgs>(args => root.VerticallyScrollable == expectedValue)); break; } } }
/// <summary> /// Called after the view is loaded. /// </summary> protected override void AfterLoad() { base.AfterLoad(); if (IgnoreObject) { return; } // add unity event system triggers if (!BeginDragProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, BeginDrag, EventTriggerType.BeginDrag); } if (!CancelProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Cancel, EventTriggerType.Cancel); } if (!DeselectProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Deselect, EventTriggerType.Deselect); } if (!DragProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Drag, EventTriggerType.Drag); } if (!DropProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Drop, EventTriggerType.Drop); } if (!EndDragProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, EndDrag, EventTriggerType.EndDrag); } if (!InitializePotentialDragProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, InitializePotentialDrag, EventTriggerType.InitializePotentialDrag); } if (!MoveProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Move, EventTriggerType.Move); } if (!ClickProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Click, EventTriggerType.PointerClick); } if (!MouseDownProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, MouseDown, EventTriggerType.PointerDown); } if (!MouseEnterProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, MouseEnter, EventTriggerType.PointerEnter); } if (!MouseExitProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, MouseExit, EventTriggerType.PointerExit); } if (!MouseUpProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, MouseUp, EventTriggerType.PointerUp); } if (!ScrollProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Scroll, EventTriggerType.Scroll); } if (!SelectProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Select, EventTriggerType.Select); } if (!SubmitProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, Submit, EventTriggerType.Submit); } if (!UpdateSelectedProperty.IsUndefined(this)) { GameObject.AddEventTrigger(this, UpdateSelected, EventTriggerType.UpdateSelected); } IsActiveChanged(false); }
public ScrollChangedEventWaiter GetScrollChangedWaiter(ScrollProperty scrollProperty, double expectedValue) { Log.Comment("Scroller.GetScrollChangedWaiter call for scrollProperty={0} and expectedValue={1}.", scrollProperty.ToString(), expectedValue.ToString()); return(new ScrollChangedEventWaiter(this, scrollProperty, expectedValue)); }