Exemplo n.º 1
0
        public void TestEditComponent()
        {
            BarHitErrorMeter hitErrorMeter = null;

            AddStep("select bar hit error blueprint", () =>
            {
                var blueprint = skinEditor.ChildrenOfType <SkinBlueprint>().First(b => b.Item is BarHitErrorMeter);

                hitErrorMeter = (BarHitErrorMeter)blueprint.Item;
                skinEditor.SelectedComponents.Clear();
                skinEditor.SelectedComponents.Add(blueprint.Item);
            });

            AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault);

            AddStep("hover first slider", () =>
            {
                InputManager.MoveMouseTo(
                    skinEditor.ChildrenOfType <SkinSettingsToolbox>().First()
                    .ChildrenOfType <SettingsSlider <float> >().First()
                    .ChildrenOfType <SliderBar <float> >().First()
                    );
            });

            AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left));

            AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
        }
Exemplo n.º 2
0
        private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)
        {
            this.hitWindows = hitWindows;

            hitWindows?.SetDifficulty(overallDifficulty);

            Clear();

            Add(new FillFlowContainer
            {
                Anchor       = Anchor.Centre,
                Origin       = Anchor.Centre,
                Direction    = FillDirection.Vertical,
                AutoSizeAxes = Axes.Both,
                Children     = new[]
                {
                    new OsuSpriteText {
                        Text = $@"Great: {hitWindows?.WindowFor(HitResult.Great)}"
                    },
                    new OsuSpriteText {
                        Text = $@"Good: {hitWindows?.WindowFor(HitResult.Good)}"
                    },
                    new OsuSpriteText {
                        Text = $@"Meh: {hitWindows?.WindowFor(HitResult.Meh)}"
                    },
                }
            });

            Add(barMeter = new BarHitErrorMeter(hitWindows, true)
            {
                Anchor = Anchor.CentreRight,
                Origin = Anchor.CentreRight,
            });

            Add(barMeter2 = new BarHitErrorMeter(hitWindows, false)
            {
                Anchor = Anchor.CentreLeft,
                Origin = Anchor.CentreLeft,
            });

            Add(colourMeter = new ColourHitErrorMeter(hitWindows)
            {
                Anchor = Anchor.CentreRight,
                Origin = Anchor.CentreRight,
                Margin = new MarginPadding {
                    Right = 50
                }
            });

            Add(colourMeter2 = new ColourHitErrorMeter(hitWindows)
            {
                Anchor = Anchor.CentreLeft,
                Origin = Anchor.CentreLeft,
                Margin = new MarginPadding {
                    Left = 50
                }
            });
        }
Exemplo n.º 3
0
        private void createBar(bool rightAligned)
        {
            var display = new BarHitErrorMeter(hitWindows, rightAligned)
            {
                Margin = new MarginPadding(margin),
                Anchor = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
                Origin = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
                Alpha  = 0,
            };

            completeDisplayLoading(display);
        }
Exemplo n.º 4
0
        private void createBar(bool rightAligned)
        {
            var display = new BarHitErrorMeter(hitWindows, rightAligned)
            {
                Margin = new MarginPadding(margin),
                Anchor = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
                Origin = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
                Alpha  = 0,
            };

            Add(display);
            display.FadeInFromZero(fade_duration, Easing.OutQuint);
        }
Exemplo n.º 5
0
        private void createBar(Anchor anchor)
        {
            bool rightAligned  = (anchor & Anchor.x2) > 0;
            bool bottomAligned = (anchor & Anchor.y2) > 0;

            var display = new BarHitErrorMeter(hitWindows, rightAligned)
            {
                Margin   = new MarginPadding(margin),
                Anchor   = anchor,
                Origin   = bottomAligned ? Anchor.CentreLeft : anchor,
                Alpha    = 0,
                Rotation = bottomAligned ? 270 : 0
            };

            completeDisplayLoading(display);
        }
Exemplo n.º 6
0
        public void TestEditComponentDuringGameplay()
        {
            advanceToSongSelect();
            openSkinEditor();

            switchToGameplayScene();

            BarHitErrorMeter hitErrorMeter = null;

            AddUntilStep("select bar hit error blueprint", () =>
            {
                var blueprint = skinEditor.ChildrenOfType <SkinBlueprint>().FirstOrDefault(b => b.Item is BarHitErrorMeter);

                if (blueprint == null)
                {
                    return(false);
                }

                hitErrorMeter = (BarHitErrorMeter)blueprint.Item;
                skinEditor.SelectedComponents.Clear();
                skinEditor.SelectedComponents.Add(blueprint.Item);
                return(true);
            });

            AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault);

            AddStep("hover first slider", () =>
            {
                InputManager.MoveMouseTo(
                    skinEditor.ChildrenOfType <SkinSettingsToolbox>().First()
                    .ChildrenOfType <SettingsSlider <float> >().First()
                    .ChildrenOfType <SliderBar <float> >().First()
                    );
            });

            AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left));

            AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
        }
Exemplo n.º 7
0
        public void TestEditComponentDuringGameplay()
        {
            Screens.Select.SongSelect songSelect = null;
            PushAndConfirm(() => songSelect = new TestPlaySongSelect());
            AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);

            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

            SkinEditor skinEditor = null;

            AddStep("open skin editor", () =>
            {
                InputManager.PressKey(Key.ControlLeft);
                InputManager.PressKey(Key.ShiftLeft);
                InputManager.Key(Key.S);
                InputManager.ReleaseKey(Key.ControlLeft);
                InputManager.ReleaseKey(Key.ShiftLeft);
            });

            AddUntilStep("get skin editor", () => (skinEditor = Game.ChildrenOfType <SkinEditor>().FirstOrDefault()) != null);

            AddStep("Click gameplay scene button", () =>
            {
                skinEditor.ChildrenOfType <SkinEditorSceneLibrary.SceneButton>().First(b => b.Text == "Gameplay").TriggerClick();
            });

            AddUntilStep("wait for player", () =>
            {
                // dismiss any notifications that may appear (ie. muted notification).
                clickMouseInCentre();
                return(Game.ScreenStack.CurrentScreen is Player);
            });

            BarHitErrorMeter hitErrorMeter = null;

            AddUntilStep("select bar hit error blueprint", () =>
            {
                var blueprint = skinEditor.ChildrenOfType <SkinBlueprint>().FirstOrDefault(b => b.Item is BarHitErrorMeter);

                if (blueprint == null)
                {
                    return(false);
                }

                hitErrorMeter = (BarHitErrorMeter)blueprint.Item;
                skinEditor.SelectedComponents.Clear();
                skinEditor.SelectedComponents.Add(blueprint.Item);
                return(true);
            });

            AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault);

            AddStep("hover first slider", () =>
            {
                InputManager.MoveMouseTo(
                    skinEditor.ChildrenOfType <SkinSettingsToolbox>().First()
                    .ChildrenOfType <SettingsSlider <float> >().First()
                    .ChildrenOfType <SliderBar <float> >().First()
                    );
            });

            AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left));

            AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
        }