Пример #1
0
        public void TestVariousNotes()
        {
            DrawableNote     note1     = null;
            DrawableNote     note2     = null;
            DrawableHoldNote holdNote1 = null;
            DrawableHoldNote holdNote2 = null;

            AddStep("create notes", () =>
            {
                Child = new FillFlowContainer
                {
                    Clock        = new FramedClock(new ManualClock()),
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(20),
                    Children     = new[]
                    {
                        createNoteDisplay(ScrollingDirection.Down, 1, out note1),
                        createNoteDisplay(ScrollingDirection.Up, 2, out note2),
                        createHoldNoteDisplay(ScrollingDirection.Down, 1, out holdNote1),
                        createHoldNoteDisplay(ScrollingDirection.Up, 2, out holdNote2),
                    }
                };
            });

            AddAssert("note 1 facing downwards", () => verifyAnchors(note1, Anchor.y2));
            AddAssert("note 2 facing upwards", () => verifyAnchors(note2, Anchor.y0));
            AddAssert("hold note 1 facing downwards", () => verifyAnchors(holdNote1, Anchor.y2));
            AddAssert("hold note 2 facing upwards", () => verifyAnchors(holdNote2, Anchor.y0));
        }
        public void TestDragHoldNoteSelectionVertically()
        {
            setScrollStep(ScrollingDirection.Down);

            AddStep("setup beatmap", () =>
            {
                composer.EditorBeatmap.Clear();
                composer.EditorBeatmap.Add(new HoldNote
                {
                    Column  = 1,
                    EndTime = 200
                });
            });

            DrawableHoldNote holdNote = null;

            AddStep("grab hold note", () =>
            {
                holdNote = this.ChildrenOfType <DrawableHoldNote>().Single();
                InputManager.MoveMouseTo(holdNote);
                InputManager.PressButton(MouseButton.Left);
            });

            AddStep("move drag upwards", () =>
            {
                InputManager.MoveMouseTo(holdNote, new Vector2(0, -100));
                InputManager.ReleaseButton(MouseButton.Left);
            });

            AddAssert("head note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.BottomLeft, holdNote.Head.ScreenSpaceDrawQuad.BottomLeft));
            AddAssert("tail note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.TopLeft, holdNote.Tail.ScreenSpaceDrawQuad.BottomLeft));

            AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType <HoldNoteNoteSelectionBlueprint>().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
            AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType <HoldNoteNoteSelectionBlueprint>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
        }
Пример #3
0
        public HoldNoteNoteSelectionBlueprint(DrawableHoldNote holdNote, HoldNotePosition position)
            : base(holdNote)
        {
            this.position = position;
            InternalChild = new EditNotePiece {
                RelativeSizeAxes = Axes.X
            };

            Select();
        }
Пример #4
0
 public HoldNoteMask(DrawableHoldNote hold)
     : base(hold)
 {
     InternalChildren = new Drawable[]
     {
         new HoldNoteNoteMask(hold.Head),
         new HoldNoteNoteMask(hold.Tail),
         body = new BodyPiece
         {
             AccentColour = Color4.Transparent
         },
     };
 }
        public TestSceneHoldNoteSelectionBlueprint()
            : base(4)
        {
            for (int i = 0; i < 4; i++)
            {
                var holdNote = new HoldNote
                {
                    Column    = i,
                    StartTime = i * 100,
                    Duration  = 500
                };
                holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

                var drawableHitObject = new DrawableHoldNote(holdNote);
                Playfield.Add(drawableHitObject);
                AddBlueprint(new HoldNoteSelectionBlueprint(holdNote), drawableHitObject);
            }
        }
Пример #6
0
        private Drawable createHoldNoteDisplay(ScrollingDirection direction, int identifier, out DrawableHoldNote hitObject)
        {
            var note = new HoldNote {
                StartTime = 0, Duration = 5000
            };

            note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

            return(new ScrollingTestContainer(direction)
            {
                AutoSizeAxes = Axes.Both,
                Child = new NoteContainer(direction, $"hold note {identifier}, scrolling {direction.ToString().ToLowerInvariant()}")
                {
                    Child = hitObject = new DrawableHoldNote(note)
                    {
                        RelativeSizeAxes = Axes.Both,
                        AccentColour = { Value = Color4.OrangeRed },
                    }
                }
            });
        }
Пример #7
0
        public TestSceneHoldNoteSelectionBlueprint()
        {
            var holdNote = new HoldNote {
                Column = 0, Duration = 1000
            };

            holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

            base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
            {
                Anchor       = Anchor.Centre,
                Origin       = Anchor.Centre,
                AutoSizeAxes = Axes.Y,
                Width        = 50,
                Child        = drawableObject = new DrawableHoldNote(holdNote)
                {
                    Height       = 300,
                    AccentColour = OsuColour.Gray(0.3f)
                }
            };
        }
Пример #8
0
        public void TestHoldNoteHeadVisibility()
        {
            DrawableHoldNote note = null;

            AddStep("Add hold note", () =>
            {
                var h = new HoldNote
                {
                    StartTime = 0,
                    Duration  = 1000
                };
                h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
                column.Add(note = new DrawableHoldNote(h));
            });
            AddStep("Hold key", () =>
            {
                clock.CurrentTime = 0;
                note.OnPressed(new KeyBindingPressEvent <ManiaAction>(GetContainingInputManager().CurrentState, ManiaAction.Key1));
            });
            AddStep("progress time", () => clock.CurrentTime = 500);
            AddAssert("head is visible", () => note.Head.Alpha == 1);
        }
Пример #9
0
 private bool verifyAnchors(DrawableHoldNote holdNote, Anchor expectedAnchor)
 => verifyAnchors((DrawableHitObject)holdNote, expectedAnchor) && holdNote.NestedHitObjects.All(n => verifyAnchors(n, expectedAnchor));
Пример #10
0
        private void load(ISkinSource skin, IScrollingInfo scrollingInfo, DrawableHitObject drawableObject)
        {
            holdNote = (DrawableHoldNote)drawableObject;

            string imageName = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage)?.Value
                               ?? $"mania-note{FallbackColumnIndex}L";

            string lightImage = GetColumnSkinConfig <string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightImage)?.Value
                                ?? "lightingL";

            float lightScale = GetColumnSkinConfig <float>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightScale)?.Value
                               ?? 1;

            // Create a temporary animation to retrieve the number of frames, in an effort to calculate the intended frame length.
            // This animation is discarded and re-queried with the appropriate frame length afterwards.
            var    tmp         = skin.GetAnimation(lightImage, true, false);
            double frameLength = 0;

            if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
            {
                frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
            }

            light = skin.GetAnimation(lightImage, true, true, frameLength: frameLength).With(d =>
            {
                if (d == null)
                {
                    return;
                }

                d.Origin   = Anchor.Centre;
                d.Blending = BlendingParameters.Additive;
                d.Scale    = new Vector2(lightScale);
            });

            if (light != null)
            {
                lightContainer = new HitTargetInsetContainer
                {
                    Alpha = 0,
                    Child = light
                };
            }

            bodySprite = skin.GetAnimation(imageName, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true).With(d =>
            {
                if (d == null)
                {
                    return;
                }

                if (d is TextureAnimation animation)
                {
                    animation.IsPlaying = false;
                }

                d.Anchor           = Anchor.TopCentre;
                d.RelativeSizeAxes = Axes.Both;
                d.Size             = Vector2.One;
                d.FillMode         = FillMode.Stretch;
                // Todo: Wrap
            });

            if (bodySprite != null)
            {
                InternalChild = bodySprite;
            }

            direction.BindTo(scrollingInfo.Direction);
            isHitting.BindTo(holdNote.IsHitting);
        }
 public DrawableHoldNoteHead(DrawableHoldNote holdNote)
     : base(holdNote.HitObject.Head)
 {
 }
 public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
     : base(hold)
 {
 }