public void TestInitialButtonHover() { showOverlay(); AddStep("Hover first button", () => InputManager.MoveMouseTo(getButton(0))); AddStep("Hide overlay", () => pauseOverlay.Hide()); showOverlay(); AddAssert("First button selected", () => getButton(0).Selected.Value); }
/// <summary> /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred. /// </summary> private void testEnterWithoutSelection() { AddStep("Show overlay", () => pauseOverlay.Show()); AddStep("Press select", () => press(GlobalAction.Select)); AddAssert("Overlay still open", () => pauseOverlay.State == Visibility.Visible); AddStep("Hide overlay", () => pauseOverlay.Hide()); }
public void TestInitialButtonHover() { showOverlay(); AddStep("Hover first button", () => InputManager.MoveMouseTo(getButton(0))); AddStep("Hide overlay", () => pauseOverlay.Hide()); showOverlay(); AddAssert("First button not selected", () => !getButton(0).Selected.Value); AddStep("Move slightly", () => InputManager.MoveMouseTo(InputManager.CurrentState.Mouse.Position + new Vector2(1))); AddAssert("First button selected", () => getButton(0).Selected.Value); }
public override void Reset() { base.Reset(); retryCount = 0; Add(pauseOverlay = new PauseOverlay { OnResume = () => Logger.Log(@"Resume"), OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), }); Add(failOverlay = new FailOverlay { OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), }); AddStep(@"Pause", delegate { if (failOverlay.State == Visibility.Visible) { failOverlay.Hide(); } pauseOverlay.Show(); }); AddStep("Fail", delegate { if (pauseOverlay.State == Visibility.Visible) { pauseOverlay.Hide(); } failOverlay.Show(); }); AddStep("Add Retry", delegate { retryCount++; pauseOverlay.Retries = retryCount; failOverlay.Retries = retryCount; }); }
public GameScreen() { AddRange(new Drawable[] { pauseOverlay = new PauseOverlay { OnContinue = () => { pauseOverlay.Hide(); // TODO: add countdown timer }, OnRestart = () => { // TODO }, OnStop = Exit }, bg = new Background(@"Backgrounds/game_default") { FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre }, new Container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Children = new Drawable[] { circle1 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Right = 850, Bottom = 410 } }, circle2 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Right = 760, Bottom = 260 } }, circle3 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Right = 545, Bottom = 135 } }, circle4 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Bottom = 35, Right = 300 } }, circle5 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Bottom = 10 } }, circle6 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Bottom = 35, Left = 300 } }, circle7 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Left = 545, Bottom = 135 } }, circle8 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Left = 760, Bottom = 260 } }, circle9 = new HitCircle { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Left = 850, Bottom = 410 } } } } }); }