private void Load() { Audio.Frequency.Set(1); Audio.Volume.Set(.05); _stack = new ScreenStack(false); Add(_stack); Window.Title = $"Qsor - {Version}"; AddInternal(KeyBindingInputHandler = new GlobalKeyBindingInputHandler(this)); if (!DebugUtils.IsDebugBuild) { _stack.Anchor = Anchor.Centre; _stack.Origin = Anchor.Centre; _stack.Push(new IntroScreen()); Scheduler.AddDelayed(() => { _stack.Exit(); Scheduler.AddDelayed(() => _stack.Push(new MainMenuScreen()), 2000); }, 6000); } else { _stack.Push(new MainMenuScreen()); } }
private void Load() { Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(typeof(QsorGame).Assembly), @"Resources")); Audio.Frequency.Set(1); Audio.Volume.Set(.2); AddInternal(BeatmapManager); _stack = new ScreenStack { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }; Add(_stack); _stack.Push(new BeatmapScreen { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }); }
public void TestTwoScreens() { var ss = new ScreenStack(); Assert.AreEqual(null, ss.CurrentScreen); var screen1 = new Screen(); var screen2 = new Screen(); ss.Push(screen1); ss.Update(0); Assert.AreSame(screen1, ss.CurrentScreen); screen1.Push(screen2); ss.Update(0); Assert.AreSame(screen2, ss.CurrentScreen); ss.Pop(); ss.Update(0); Assert.AreSame(screen1, ss.CurrentScreen); ss.Pop(); ss.Update(0); Assert.AreEqual(null, ss.CurrentScreen); Assert.Throws <InvalidOperationException>(ss.Pop); }
public void UnsupportedReplaceFactoryTest() { // - Arrange var registry = new ScreenRegistry(); var screenStack = new ScreenStack(); var specs = new NavigatorSpecification(false, false, false); var screenA = new Mock <Screen>().Object; var screenB = new ScreenStub(); var screenBResolver = new Mock <IScreenResolver>().Object; registry.Register(typeof(ScreenStub), screenBResolver); screenStack.Push(screenB, screenA, screenA); var cf = new DefaultCommandsFactory(registry); // - Act var commands = cf.ReplaceScreen(screenStack, specs, screenB); // - Assert Assert.AreEqual(2, commands.Count); Assert.IsInstanceOf <BackNavCommand>( commands.ElementAtOrDefault(0)); Assert.IsInstanceOf <ForwardNavCommand>( commands.ElementAtOrDefault(1)); }
private void load() { NotificationOverlay notifications; dependencies.Cache(notifications = new NotificationOverlay()); ConfirmationOverlay confirmationOverlay; dependencies.Cache(confirmationOverlay = new ConfirmationOverlay()); ScreenStack screens = new ScreenStack(); screens.Push(new MainMenuScreen()); Add(new BasicContextMenuContainer { RelativeSizeAxes = Axes.Both, Child = new IWannaTooltipContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { screens, notifications, confirmationOverlay } } }); }
private void load() { Window.WindowBorder = WindowBorder.Hidden; Window.Title = "The Cursed Constellations Installer"; Window.Size = new Size(1600, 900); Resources.AddStore(new DllResourceStore(mainResourceFile)); largeTextureStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"))); largeTextureStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); dependencies.Cache(largeTextureStore); // Fonts AddFont(Resources, @"Fonts/Ageo-Light"); AddFont(Resources, @"Fonts/Ageo-LightItalic"); AddFont(Resources, @"Fonts/Ageo-Medium"); AddFont(Resources, @"Fonts/Ageo-Regular"); AddFont(Resources, @"Fonts/Ageo-RegularItalic"); AddFont(Resources, @"Fonts/Ageo-Thin"); installerScreenStack = new ScreenStack(); installerScreenStack.RelativeSizeAxes = Axes.Both; Add(installerScreenStack); installerScreenStack.Push(backgroundScreen = new BackgroundScreen()); }
public ChimpanzeeMemoryTestGame() { Add(screenStack = new ScreenStack { RelativeSizeAxes = osu.Framework.Graphics.Axes.Both }); screenStack.Push(new PlayScreen()); }
private void updateSize() { if (targetMode == ScalingMode.NoScaling) { if (requiresBackgroundVisible) { if (backgroundStack == null) { AddInternal(backgroundStack = new ScreenStack { Alpha = 0, Depth = float.MaxValue }); // TODO: Replace this so consumers can add their own background screen for their scaling containers. backgroundStack?.Push(new SimpleBackgroundScreen()); } backgroundStack.FadeIn(200); } else { backgroundStack.FadeOut(200); } } sizableContainer.ScaleTo(scaleBindable.Value, 200, Easing.OutElastic); }
protected void LoadScreen(OsuScreen screen) { if (stack.CurrentScreen != null) { stack.Exit(); } stack.Push(screen); }
protected override void LoadComplete() { base.LoadComplete(); loadComponentSingleFile(new SerialMonitorOverlay(), overlayContainer.Add, true); loadComponentSingleFile(new SkeletonOverlay(), overlayContainer.Add, true); screenStack.Push(new MainScreen()); }
public HenHenGame() { Raylib_cs.Raylib.SetExitKey(Raylib_cs.KeyboardKey.KEY_NULL); LoadImages(); menuActionsHandler = new(Inputs); interfaceInputManager = new(ScreenStack, MenuActions.Next); menuActionsHandler.Propagator.Listeners.Add(interfaceInputManager); positionalInterfaceInputManager = new(Inputs, ScreenStack); ScreenStack.Push(new MainMenuScreen()); }
protected override void LoadComplete() { base.LoadComplete(); Add(stack = new ScreenStack() { RelativeSizeAxes = Axes.Both }); LoadComponent(loginContainer = new Login()); stack.Push(loginContainer); }
protected override void LoadContent() { TowerTemplate = new LevelTemplate(ChunkSet.FromTexture(Content.Load <Texture2D>("Levels/tower"), 1), 1, 1, false, "bg_entrance", null, null); VillageTemplate = new LevelTemplate(ChunkSet.FromTexture(Content.Load <Texture2D>("Levels/village"), 15), 12, 3, false, "bg_entrance", TowerTemplate, null); FountainTemplate = new LevelTemplate(ChunkSet.FromTexture(Content.Load <Texture2D>("Levels/fountain"), 2), 2, 1, false, "bg_fountain", VillageTemplate, "Sounds/fountain"); JungleTemplate = new LevelTemplate(ChunkSet.FromTexture(Content.Load <Texture2D>("Levels/jungle2"), 15), 8, 3, false, "bg_jungle", FountainTemplate, "Sounds/jungle"); TunnelTemplate = new LevelTemplate(ChunkSet.FromTexture(Content.Load <Texture2D>("Levels/tunnel"), 2), 2, 1, false, "bg_tunnel", JungleTemplate, null); EntranceTemplate = new LevelTemplate(ChunkSet.FromTexture(Content.Load <Texture2D>("Levels/entrance"), 2), 2, 1, true, "bg_entrance", TunnelTemplate, null); _screens.Push(new StartScreen(this)); }
private void load(OsuGameBase game) { Beatmap.Value = new DummyWorkingBeatmap(game); InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player { AllowPause = false, AllowLeadIn = false, AllowResults = false, }))); AddUntilStep(() => loader.IsCurrentScreen(), "wait for current"); AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre)); AddUntilStep(() => !loader.IsCurrentScreen(), "wait for no longer current"); AddStep("exit loader", () => loader.Exit()); AddUntilStep(() => !loader.IsAlive, "wait for no longer alive"); AddStep("load slow dummy beatmap", () => { SlowLoadPlayer slow = null; stack.Push(loader = new PlayerLoader(() => slow = new SlowLoadPlayer { AllowPause = false, AllowLeadIn = false, AllowResults = false, })); Scheduler.AddDelayed(() => slow.Ready = true, 5000); }); AddUntilStep(() => !loader.IsCurrentScreen(), "wait for no longer current"); }
private void AddGameplayScreen() { LoadComponent(_gameplayScreen = new GameplayScreen(path, mods) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(1f), }); Debug.Assert(_gameplayScreen != null, $"{nameof(_gameplayScreen)} is null!"); InputManager.MoveMouseTo(_gameplayScreen); _gameplayScreen.GameStarted.ValueChanged += (e) => { if (!e.NewValue) { return; } var timings = _gameplayScreen._RbPlayfield.objectList; Scheduler.UpdateClock(_gameplayScreen._RbPlayfield.Clock); for (int i = 0; i < timings.Count; i++) { Key?key = timings[i].Item1.direction switch { HitObject.Direction.Up => keys[0], HitObject.Direction.Left => keys[1], HitObject.Direction.Down => keys[2], HitObject.Direction.Right => keys[3], _ => null }; Scheduler.AddDelayed(() => { Debug.Assert(key.HasValue, "key is null"); if (InputManager.UseParentInput) { return; } InputManager.PressKey(key.Value); InputManager.ReleaseKey(key.Value); }, timings[i].Item2 + timings[i].Item1.Duration); } }; _stack.Push(_gameplayScreen); }
protected override void LoadComplete() { base.LoadComplete(); screenStack.ScreenPushed += screenPushed; screenStack.ScreenExited += screenExited; screenStack.Push(loungeSubScreen = CreateLounge()); apiState.BindTo(API.State); apiState.BindValueChanged(onlineStateChanged, true); }
public override void Complete() { // Check is need to go to generate ruby/romaji step or just skip. if (RubyRomajiManager.CanAutoGenerateRuby() || RubyRomajiManager.CanAutoGenerateRomaji()) { ScreenStack.Push(ImportLyricStep.GenerateRuby); } else { ScreenStack.Push(ImportLyricStep.GenerateTimeTag); } }
private void load() { ScreenStack screenStack; Child = screenStack = new ScreenStack { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre }; screenStack.Push(new BasicMainMenu()); }
public VisualTestsGame() { LoadResources(); var visualTesterScreen = new VisualTester(Inputs); inputActionHandler = new VisualTesterInputActionHandler(Inputs); inputActionHandler.Propagator.Listeners.Add(visualTesterScreen); positionalInterfaceInputManager = new(Inputs, ScreenStack); ScreenStack.Push(visualTesterScreen); }
public TestSceneEngineDisclaimer() { ScreenStack screenStack; Child = screenStack = new ScreenStack { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre }; screenStack.Push(new EngineLoader()); }
public void TestOneScreen() { var ss = new ScreenStack(); Assert.AreEqual(null, ss.CurrentScreen); var screen = new Screen(); ss.Push(screen); ss.Update(0); Assert.AreSame(screen, ss.CurrentScreen); ss.Pop(); ss.Update(0); Assert.AreEqual(null, ss.CurrentScreen); }
public void PushFirstScreenTest() { // - Arrange var screen = new ScreenStub(); var screenStack = new ScreenStack(); // - Act screenStack.Push(screen); // - Assert Assert.IsTrue(screenStack.IsRoot); Assert.AreEqual(1, screenStack.Count); Assert.AreSame(screen, screenStack.CurrentScreen); }
private void load() { ScreenStack screen = new ScreenStack(); game = new GameplayScreen(); textbox = new SpriteText { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Text = $"State: {game.CurrentState}" }; screen.Push(game); Add(screen); Add(textbox); }
private void Load() { var stack = new ScreenStack(); Add(stack); AddStep("Start sequence", () => { stack.Push(new IntroScreen()); }); AddStep("Exit sequence", () => { stack.Exit(); }); }
public void ClearStackWithOnlyRootScreen() { // - Arrange var rootScreen = new Mock <Screen>().Object; var screenStack = new ScreenStack(); screenStack.Push(rootScreen); // - Act screenStack.Clear(); // - Assert Assert.IsTrue(screenStack.IsRoot); Assert.AreEqual(rootScreen, screenStack.CurrentScreen); Assert.AreEqual(1, screenStack.Count); }
public VisualTester(Inputs inputs) { sceneInputActionHandler = new SceneInputActionHandler(inputs); RelativeSizeAxes = Axes.Both; scenesList = CreateScenesList(); scenesContainer = new ScreenStack { RelativeSizeAxes = Axes.Both }; var leftContainer = CreateLeftContainer(); AddChild(leftContainer); sceneTypes = new List <Type>(); buttons = new List <TestSceneButton>(); CreateAndAddButtons(); if (sceneTypes.Count is 0) { leftContainer.AddChild(new SpriteText { Text = "No test scenes.", RelativeSizeAxes = Axes.Both, AlignMiddle = true }); return; } var rightContainer = new Container { Padding = new MarginPadding { Left = 200 }, RelativeSizeAxes = Axes.Both }; AddChild(rightContainer); rightContainer.AddChild(scenesContainer); if (sceneTypes.Count > 0) { scenesContainer.Push(CreateVisualTestScene(sceneTypes[sceneIndex])); } UpdateButtonsColors(); }
public void ApplyBackNavCommandTest() { // - Arrange var screenStack = new ScreenStack(); screenStack.Push(new ScreenStub()); var navigatorMock = new Mock <Navigator>(); var command = new BackNavCommand(); // - Act command.Apply(navigatorMock.Object, screenStack); // - Assert Assert.AreEqual(0, screenStack.Count); navigatorMock.Verify(it => it.Back(), Times.Once); }
public void PushManyScreensTest() { // - Arrange var screenA = new Mock <Screen>().Object; var screenB = new Mock <Screen>().Object; var screenStack = new ScreenStack(); // - Act screenStack.Push(screenA, screenB); // - Assert Assert.IsFalse(screenStack.IsRoot); Assert.AreSame(screenB, screenStack.CurrentScreen); Assert.AreEqual(2, screenStack.Count); CollectionAssert.Contains(screenStack, screenA); }
protected override void LoadComplete() { base.LoadComplete(); screenStack.ScreenPushed += screenPushed; screenStack.ScreenExited += screenExited; screenStack.Push(loungeSubScreen = CreateLounge()); apiState.BindTo(API.State); apiState.BindValueChanged(onlineStateChanged, true); if (idleTracker != null) { isIdle.BindTo(idleTracker.IsIdle); isIdle.BindValueChanged(idle => UpdatePollingRate(idle.NewValue), true); } }
public void SetUp() { var screenStack = new ScreenStack(); screen = new Screen(); component1 = new TestComponent(1); component2 = new TestComponent(2); var componentContainer = new Container(); componentContainer.AddChild(component3Nested = new TestComponent(3)); componentContainer.AddChild(component4ContainerNested = new TestContainerComponent(4)); component4ContainerNested.AddChild(component5DoubleNested = new TestComponent(5)); componentContainer.AddChild(component6Nested = new TestComponent(6)); interfaceInputManager = new(screenStack); screen.AddChild(component1); screen.AddChild(component2); screen.AddChild(componentContainer); screenStack.Push(screen); }