void Update() { if (lastCredit != null && lastCredit.transform.position.y > maxHeight.y) { ScrollDown.StopAllScrolling(); } }
void Awake() { health = shipData.health; playerControl = GetComponent <PlayerControl>(); scrollDown = GetComponent <ScrollDown>(); spriteRenderer = GetComponent <SpriteRenderer>(); uiController = UIController.Instance; spriteRenderer.sprite = shipData.sprites[0]; }
public async Task <string> GetFollowing(string profile, int position, bool enterProfile = true, bool openDialog = true) { if (enterProfile) { Enter(profile); } var followingsCount = GetFollowingsCount(profile); if (position > followingsCount) { return(null); } if (openDialog) { driver.Exec(driver.FindElement(By.XPath("//a[contains(@href,'/following/')]"), 60).Click, successWhen: () => driver.Url.Contains("/following")); } var liElements = driver.FindElements(By.CssSelector("ul > div:first-of-type > li span > a.notranslate"), 30); var users = liElements.Select(x => x.Text).ToHashSet(); Actions actions = new Actions(driver); while (position > users.Count()) { liElements = driver.FindElements(By.CssSelector("ul > div:first-of-type > li span > a.notranslate"), 60); await ScrollDown.ScrollInto(driver, liElements.Last()); foreach (var user in getUsers()) { users.Add(user); } } return(users.ElementAt(position - 1)); }
public async IAsyncEnumerable <string> GetAllFollowings(string profile, bool enterProfile = true, bool openDialog = true) { if (enterProfile) { Enter(profile); } var followingsCount = GetFollowingsCount(profile); if (openDialog) { driver.Exec(driver.FindElement(By.XPath("//a[contains(@href,'/following/')]"), 60).Click, successWhen: () => driver.Url.Contains("/following")); } var users = new HashSet <string>(); var lastTimeFoundNewUser = DateTime.Now; while (users.Count < followingsCount) { if ((DateTime.Now - lastTimeFoundNewUser).Seconds >= 60) { yield break; } foreach (var user in getUsers()) { if (users.Add(user)) { lastTimeFoundNewUser = DateTime.Now; yield return(user); } } var liElements = driver.FindElements(By.CssSelector("ul > div:first-of-type > li span > a.notranslate"), 60); await ScrollDown.ScrollInto(driver, liElements.Last()); } }
private async Task <KeyValuePair <string, IWebElement> > getPost(int number) { var posts = new Dictionary <string, IWebElement>(); foreach (var post in getPosts()) { posts.TryAdd(post.Key, post.Value); } while (number > posts.Count()) { await ScrollDown.Scroll(driver.FindElement(By.TagName("body"), 60)); foreach (var post in getPosts()) { posts.TryAdd(post.Key, post.Value); } } var foundPost = posts.ElementAt(number - 1); return(new KeyValuePair <string, IWebElement>(foundPost.Key, foundPost.Value)); }
private async void CheckVisible_Elapsed(object sender, ElapsedEventArgs e) { var Visibility = DetailScroll.ScrollY + DetailScroll.Height; if (Visibility < ShowImage.Height && !ScrollDown.IsVisible) { await Device.InvokeOnMainThreadAsync(async() => { ScrollDown.Opacity = 0; ScrollDown.IsVisible = true; await ScrollDown.FadeTo(1); }); } else if (Visibility > ShowImage.Height && ScrollDown.IsVisible) { await Device.InvokeOnMainThreadAsync(async() => { await ScrollDown.FadeTo(0); ScrollDown.IsVisible = false; }); } }
public static ITransition CreateTransition(TransitionEffect Effect) { ITransition transition = new CircleIn(); if (Effect == TransitionEffect.CircleIn) { transition = new CircleIn(); } else if (Effect == TransitionEffect.CircleOut) { transition = new CircleOut(); } else if (Effect == TransitionEffect.Star) { transition = new Star(); } else if (Effect == TransitionEffect.BarsDown) { transition = new BarsDown(); } else if (Effect == TransitionEffect.ScrollDown) { transition = new ScrollDown(); } else if (Effect == TransitionEffect.BarsDown2) { transition = new BarsDown2(); } else if (Effect == TransitionEffect.InRect) { transition = new InRect(); } else if (Effect == TransitionEffect.RotateClockWise) { transition = new RotateClockWise(); } return(transition); }
public static void Poll(GameTime time) { MouseState m = Mouse.GetState(); mousePosition = m.Position; leftMouseButtonTimer -= time.ElapsedGameTime.Milliseconds; rightMouseButtonTimer -= time.ElapsedGameTime.Milliseconds; middleMouseButtonTimer -= time.ElapsedGameTime.Milliseconds; #region LeftMouseButton if (leftMouseButton == MouseButtonState.InitialState) { if (m.LeftButton == ButtonState.Pressed) { leftMouseButton = MouseButtonState.PressedOnce; leftMouseButtonTimer = doubleClickTimeout; } } else if (leftMouseButton == MouseButtonState.PressedOnce) { if (leftMouseButtonTimer < 0)//CLICK TIMEOUT, BEGIN DRAGGING MODE { leftMouseButton = MouseButtonState.Dragging; Dragging?.Invoke(null, mousePosition - prevMousePosition); } else if (m.LeftButton == ButtonState.Released)//BUTTON RELEASED, WAIT FOR DOUBLE-CLICK { leftMouseButton = MouseButtonState.ReleasedFirst; } else if ((mousePosition - prevMousePosition).X != 0 || (mousePosition - prevMousePosition).Y != 0) { Dragging?.Invoke(null, mousePosition - prevMousePosition); } } else if (leftMouseButton == MouseButtonState.Dragging) { if (m.LeftButton == ButtonState.Released)//FINISH DRAGGING { leftMouseButton = MouseButtonState.InitialState; } else { Dragging?.Invoke(null, mousePosition - prevMousePosition); } } else if (leftMouseButton == MouseButtonState.ReleasedFirst) { if (leftMouseButtonTimer < 0)//DOUBLE-CLICK TIMEOUT EXPIRED, COUNT AS SINGLE CLICK { leftMouseButton = MouseButtonState.InitialState; LeftMouseButtonClick?.Invoke(null, null); } else if (m.LeftButton == ButtonState.Pressed)//PRESSED SECOND TIME { leftMouseButton = MouseButtonState.PressedTwice; } } else if (leftMouseButton == MouseButtonState.PressedTwice) { if (leftMouseButtonTimer < 0)//DOUBLE-CLICK TIMEOUT EXPIRED, COUNT AS DRAGGING { leftMouseButton = MouseButtonState.Dragging; Dragging?.Invoke(null, mousePosition - prevMousePosition); } else if (m.LeftButton == ButtonState.Released)//RELEASED SECOND TIME, COUNT AS DOUBLE-CLICK { leftMouseButton = MouseButtonState.InitialState; LeftMouseButtonDoubleClick?.Invoke(null, null); } else if ((mousePosition - prevMousePosition).X != 0 || (mousePosition - prevMousePosition).Y != 0) { Dragging?.Invoke(null, mousePosition - prevMousePosition); } } #endregion #region RightMouseButton if (rightMouseButton == MouseButtonState.InitialState) { if (m.RightButton == ButtonState.Pressed) { rightMouseButton = MouseButtonState.PressedOnce; rightMouseButtonTimer = doubleClickTimeout; } } else if (rightMouseButton == MouseButtonState.PressedOnce) { if (rightMouseButtonTimer < 0)//CLICK TIMEOUT, BEGIN DRAGGING MODE { rightMouseButton = MouseButtonState.Dragging; } else if (m.RightButton == ButtonState.Released)//BUTTON RELEASED, WAIT FOR DOUBLE-CLICK { rightMouseButton = MouseButtonState.ReleasedFirst; } } else if (rightMouseButton == MouseButtonState.Dragging) { if (m.RightButton == ButtonState.Released)//FINISH DRAGGING { rightMouseButton = MouseButtonState.InitialState; } } else if (rightMouseButton == MouseButtonState.ReleasedFirst) { if (rightMouseButtonTimer < 0)//DOUBLE-CLICK TIMEOUT EXPIRED, COUNT AS SINGLE CLICK { rightMouseButton = MouseButtonState.InitialState; RightMouseButtonClick?.Invoke(null, null); } else if (m.RightButton == ButtonState.Pressed)//PRESSED SECOND TIME { rightMouseButton = MouseButtonState.PressedTwice; } } else if (rightMouseButton == MouseButtonState.PressedTwice) { if (rightMouseButtonTimer < 0)//DOUBLE-CLICK TIMEOUT EXPIRED, COUNT AS DRAGGING { rightMouseButton = MouseButtonState.Dragging; } else if (m.RightButton == ButtonState.Released)//RELEASED SECOND TIME, COUNT AS DOUBLE-CLICK { rightMouseButton = MouseButtonState.InitialState; RightMouseButtonDoubleClick?.Invoke(null, null); } } #endregion #region MiddleMouseButton if (middleMouseButton == MouseButtonState.InitialState) { if (m.MiddleButton == ButtonState.Pressed) { middleMouseButton = MouseButtonState.PressedOnce; middleMouseButtonTimer = doubleClickTimeout; } } else if (middleMouseButton == MouseButtonState.PressedOnce) { if (middleMouseButtonTimer < 0)//CLICK TIMEOUT, BEGIN DRAGGING MODE { middleMouseButton = MouseButtonState.Dragging; } else if (m.MiddleButton == ButtonState.Released)//BUTTON RELEASED, WAIT FOR DOUBLE-CLICK { middleMouseButton = MouseButtonState.ReleasedFirst; } } else if (middleMouseButton == MouseButtonState.Dragging) { if (m.MiddleButton == ButtonState.Released)//FINISH DRAGGING { middleMouseButton = MouseButtonState.InitialState; } } else if (middleMouseButton == MouseButtonState.ReleasedFirst) { if (middleMouseButtonTimer < 0)//DOUBLE-CLICK TIMEOUT EXPIRED, COUNT AS SINGLE CLICK { middleMouseButton = MouseButtonState.InitialState; MiddleMouseButtonClick?.Invoke(null, null); } else if (m.MiddleButton == ButtonState.Pressed)//PRESSED SECOND TIME { middleMouseButton = MouseButtonState.PressedTwice; } } else if (middleMouseButton == MouseButtonState.PressedTwice) { if (middleMouseButtonTimer < 0)//DOUBLE-CLICK TIMEOUT EXPIRED, COUNT AS DRAGGING { middleMouseButton = MouseButtonState.Dragging; } else if (m.RightButton == ButtonState.Released)//RELEASED SECOND TIME, COUNT AS DOUBLE-CLICK { middleMouseButton = MouseButtonState.InitialState; MiddleMouseButtonDoubleClick?.Invoke(null, null); } } #endregion #region MouseScroll double scrollWheelValue = m.ScrollWheelValue; if (scrollWheelValue < prevScrollWheelValue) { ScrollDown?.Invoke(null, scrollWheelValue - prevScrollWheelValue); } else if (scrollWheelValue > prevScrollWheelValue) { ScrollUp?.Invoke(null, scrollWheelValue - prevScrollWheelValue); } prevScrollWheelValue = scrollWheelValue; #endregion prevMousePosition = mousePosition; }