Esempio n. 1
0
        public override List <InputState> GetPendingStates()
        {
            var actions = new List <ManiaAction>();

            if (playfield == null)
            {
                playfield = (ManiaPlayfield)container.Playfield;
            }

            int activeColumns = (int)(CurrentFrame.MouseX ?? 0);
            int counter       = 0;

            while (activeColumns > 0)
            {
                if ((activeColumns & 1) > 0)
                {
                    actions.Add(playfield.Columns.ElementAt(counter).Action);
                }
                counter++;
                activeColumns >>= 1;
            }

            return(new List <InputState> {
                new ReplayState <ManiaAction> {
                    PressedActions = actions
                }
            });
        }
Esempio n. 2
0
        public virtual void ApplyToDrawableRuleset(DrawableRuleset <ManiaHitObject> drawableRuleset)
        {
            ManiaPlayfield maniaPlayfield = (ManiaPlayfield)drawableRuleset.Playfield;

            foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns))
            {
                HitObjectContainer hoc       = column.HitObjectArea.HitObjectContainer;
                Container          hocParent = (Container)hoc.Parent;

                hocParent.Remove(hoc);
                hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c =>
                {
                    c.RelativeSizeAxes = Axes.Both;
                    c.Direction        = ExpandDirection;
                    c.Coverage         = 0.5f;
                }));
            }
        }
Esempio n. 3
0
        private void createPlayfield(int cols, SpecialColumnPosition specialPos, bool inverted = false)
        {
            Clear();

            var inputManager = new ManiaInputManager(maniaRuleset, cols)
            {
                RelativeSizeAxes = Axes.Both
            };

            Add(inputManager);

            ManiaPlayfield playfield;

            inputManager.Add(playfield = new ManiaPlayfield(cols)
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                SpecialColumnPosition = specialPos
            });

            playfield.Inverted.Value = inverted;
        }
Esempio n. 4
0
        private ManiaPlayfield createPlayfield(List <StageDefinition> stages, bool inverted = false)
        {
            Clear();

            var inputManager = new ManiaInputManager(maniaRuleset, stages.Sum(g => g.Columns))
            {
                RelativeSizeAxes = Axes.Both
            };

            Add(inputManager);

            ManiaPlayfield playfield;

            inputManager.Add(playfield = new ManiaPlayfield(stages)
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
            });

            playfield.Inverted.Value = inverted;

            return(playfield);
        }
Esempio n. 5
0
        public TestSceneManiaBeatSnapGrid()
        {
            editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint {
                BeatLength = 200
            });
            editorBeatmap.ControlPointInfo.Add(10000, new TimingControlPoint {
                BeatLength = 200
            });

            BeatDivisor.Value = 3;

            // Some sane defaults
            scrollingInfo.Algorithm.Algorithm = ScrollVisualisationMethod.Constant;
            scrollingInfo.Direction.Value     = ScrollingDirection.Up;
            scrollingInfo.TimeRange.Value     = 1000;

            Children = new Drawable[]
            {
                Playfield = new ManiaPlayfield(new List <StageDefinition>
                {
                    new StageDefinition {
                        Columns = 4
                    },
                    new StageDefinition {
                        Columns = 3
                    }
                })
                {
                    Clock = new FramedClock(new StopwatchClock())
                },
                new TestHitObjectComposer(Playfield)
                {
                    Child = beatSnapGrid = new ManiaBeatSnapGrid()
                }
            };
        }
Esempio n. 6
0
        private void createPlayfieldWithNotes(bool inverted = false)
        {
            Clear();

            var rateAdjustClock = new StopwatchClock(true)
            {
                Rate = 1
            };

            var inputManager = new ManiaInputManager(maniaRuleset, 4)
            {
                RelativeSizeAxes = Axes.Both
            };

            Add(inputManager);

            ManiaPlayfield playfield;
            var            stages = new List <StageDefinition>
            {
                new StageDefinition {
                    Columns = 4
                },
            };

            inputManager.Add(playfield = new ManiaPlayfield(stages)
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Clock  = new FramedClock(rateAdjustClock)
            });

            playfield.Inverted.Value = inverted;

            for (double t = start_time; t <= start_time + duration; t += 100)
            {
                var note1 = new Note {
                    StartTime = t, Column = 0
                };
                var note2 = new Note {
                    StartTime = t, Column = 3
                };

                note1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
                note2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

                playfield.Add(new DrawableNote(note1, ManiaAction.Key1));
                playfield.Add(new DrawableNote(note2, ManiaAction.Key4));
            }

            var holdNote1 = new HoldNote {
                StartTime = start_time, Duration = duration, Column = 1
            };
            var holdNote2 = new HoldNote {
                StartTime = start_time, Duration = duration, Column = 2
            };

            holdNote1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
            holdNote2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

            playfield.Add(new DrawableHoldNote(holdNote1, ManiaAction.Key2));
            playfield.Add(new DrawableHoldNote(holdNote2, ManiaAction.Key3));
        }
Esempio n. 7
0
        private void createPlayfieldWithNotes(bool gravity, bool inverted = false)
        {
            Clear();

            var rateAdjustClock = new StopwatchClock(true)
            {
                Rate = 1
            };

            var inputManager = new ManiaInputManager(maniaRuleset, 4)
            {
                RelativeSizeAxes = Axes.Both
            };

            Add(inputManager);

            ManiaPlayfield playfield;

            inputManager.Add(playfield = new ManiaPlayfield(4)
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Clock  = new FramedClock(rateAdjustClock)
            });

            playfield.Inverted.Value = inverted;

            if (!gravity)
            {
                playfield.Columns.ForEach(c => c.Add(createTimingChange(0, false)));
            }

            for (double t = start_time; t <= start_time + duration; t += 100)
            {
                if (gravity)
                {
                    playfield.Columns.ElementAt(0).Add(createTimingChange(t, true));
                }

                playfield.Add(new DrawableNote(new Note
                {
                    StartTime = t,
                    Column    = 0
                }, ManiaAction.Key1));

                if (gravity)
                {
                    playfield.Columns.ElementAt(3).Add(createTimingChange(t, true));
                }

                playfield.Add(new DrawableNote(new Note
                {
                    StartTime = t,
                    Column    = 3
                }, ManiaAction.Key4));
            }

            if (gravity)
            {
                playfield.Columns.ElementAt(1).Add(createTimingChange(start_time, true));
            }

            playfield.Add(new DrawableHoldNote(new HoldNote
            {
                StartTime = start_time,
                Duration  = duration,
                Column    = 1
            }, ManiaAction.Key2));

            if (gravity)
            {
                playfield.Columns.ElementAt(2).Add(createTimingChange(start_time, true));
            }

            playfield.Add(new DrawableHoldNote(new HoldNote
            {
                StartTime = start_time,
                Duration  = duration,
                Column    = 2
            }, ManiaAction.Key3));
        }
        public TestCaseManiaPlayfield()
        {
            Action <int, SpecialColumnPosition> createPlayfield = (cols, pos) =>
            {
                Clear();
                Add(new ManiaPlayfield(cols)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    SpecialColumnPosition = pos,
                    Scale = new Vector2(1, -1)
                });
            };

            const double start_time = 500;
            const double duration   = 500;

            Func <double, bool, SpeedAdjustmentContainer> createTimingChange = (time, gravity) => new ManiaSpeedAdjustmentContainer(new MultiplierControlPoint(time)
            {
                TimingPoint = { BeatLength = 1000 }
            }, gravity ? ScrollingAlgorithm.Gravity : ScrollingAlgorithm.Basic);

            Action <bool> createPlayfieldWithNotes = gravity =>
            {
                Clear();

                var rateAdjustClock = new StopwatchClock(true)
                {
                    Rate = 1
                };

                ManiaPlayfield playField;
                Add(playField = new ManiaPlayfield(4)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Scale  = new Vector2(1, -1),
                    Clock  = new FramedClock(rateAdjustClock)
                });

                if (!gravity)
                {
                    playField.Columns.ForEach(c => c.Add(createTimingChange(0, false)));
                }

                for (double t = start_time; t <= start_time + duration; t += 100)
                {
                    if (gravity)
                    {
                        playField.Columns.ElementAt(0).Add(createTimingChange(t, true));
                    }

                    playField.Add(new DrawableNote(new Note
                    {
                        StartTime = t,
                        Column    = 0
                    }, new Bindable <Key>(Key.D)));

                    if (gravity)
                    {
                        playField.Columns.ElementAt(3).Add(createTimingChange(t, true));
                    }

                    playField.Add(new DrawableNote(new Note
                    {
                        StartTime = t,
                        Column    = 3
                    }, new Bindable <Key>(Key.K)));
                }

                if (gravity)
                {
                    playField.Columns.ElementAt(1).Add(createTimingChange(start_time, true));
                }

                playField.Add(new DrawableHoldNote(new HoldNote
                {
                    StartTime = start_time,
                    Duration  = duration,
                    Column    = 1
                }, new Bindable <Key>(Key.F)));

                if (gravity)
                {
                    playField.Columns.ElementAt(2).Add(createTimingChange(start_time, true));
                }

                playField.Add(new DrawableHoldNote(new HoldNote
                {
                    StartTime = start_time,
                    Duration  = duration,
                    Column    = 2
                }, new Bindable <Key>(Key.J)));
            };

            AddStep("1 column", () => createPlayfield(1, SpecialColumnPosition.Normal));
            AddStep("4 columns", () => createPlayfield(4, SpecialColumnPosition.Normal));
            AddStep("Left special style", () => createPlayfield(4, SpecialColumnPosition.Left));
            AddStep("Right special style", () => createPlayfield(4, SpecialColumnPosition.Right));
            AddStep("5 columns", () => createPlayfield(5, SpecialColumnPosition.Normal));
            AddStep("8 columns", () => createPlayfield(8, SpecialColumnPosition.Normal));
            AddStep("Left special style", () => createPlayfield(8, SpecialColumnPosition.Left));
            AddStep("Right special style", () => createPlayfield(8, SpecialColumnPosition.Right));

            AddStep("Notes with input", () => createPlayfieldWithNotes(false));
            AddWaitStep((int)Math.Ceiling((start_time + duration) / TimePerAction));

            AddStep("Notes with gravity", () => createPlayfieldWithNotes(true));
            AddWaitStep((int)Math.Ceiling((start_time + duration) / TimePerAction));
        }
Esempio n. 9
0
        public override void Reset()
        {
            base.Reset();

            Action <int, SpecialColumnPosition> createPlayfield = (cols, pos) =>
            {
                Clear();
                Add(new ManiaPlayfield(cols, new List <TimingChange>())
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    SpecialColumnPosition = pos,
                    Scale = new Vector2(1, -1)
                });
            };

            Action <int, SpecialColumnPosition> createPlayfieldWithNotes = (cols, pos) =>
            {
                Clear();

                ManiaPlayfield playField;
                Add(playField = new ManiaPlayfield(cols, new List <TimingChange> {
                    new TimingChange {
                        BeatLength = 200
                    }
                })
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    SpecialColumnPosition = pos,
                    Scale = new Vector2(1, -1)
                });

                for (int i = 0; i < cols; i++)
                {
                    playField.Add(new DrawableNote(new Note
                    {
                        StartTime = Time.Current + 1000,
                        Column    = i
                    }));
                }
            };

            Action createPlayfieldWithNotesAcceptingInput = () =>
            {
                Clear();

                var rateAdjustClock = new StopwatchClock(true)
                {
                    Rate = 0.5
                };

                ManiaPlayfield playField;
                Add(playField = new ManiaPlayfield(4, new List <TimingChange> {
                    new TimingChange {
                        BeatLength = 200
                    }
                })
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Scale  = new Vector2(1, -1),
                    Clock  = new FramedClock(rateAdjustClock)
                });

                for (int t = 1000; t <= 2000; t += 100)
                {
                    playField.Add(new DrawableNote(new Note
                    {
                        StartTime = t,
                        Column    = 0
                    }, new Bindable <Key>(Key.D)));

                    playField.Add(new DrawableNote(new Note
                    {
                        StartTime = t,
                        Column    = 3
                    }, new Bindable <Key>(Key.K)));
                }

                playField.Add(new DrawableHoldNote(new HoldNote
                {
                    StartTime = 1000,
                    Duration  = 1000,
                    Column    = 1
                }, new Bindable <Key>(Key.F)));

                playField.Add(new DrawableHoldNote(new HoldNote
                {
                    StartTime = 1000,
                    Duration  = 1000,
                    Column    = 2
                }, new Bindable <Key>(Key.J)));
            };

            AddStep("1 column", () => createPlayfield(1, SpecialColumnPosition.Normal));
            AddStep("4 columns", () => createPlayfield(4, SpecialColumnPosition.Normal));
            AddStep("Left special style", () => createPlayfield(4, SpecialColumnPosition.Left));
            AddStep("Right special style", () => createPlayfield(4, SpecialColumnPosition.Right));
            AddStep("5 columns", () => createPlayfield(5, SpecialColumnPosition.Normal));
            AddStep("8 columns", () => createPlayfield(8, SpecialColumnPosition.Normal));
            AddStep("Left special style", () => createPlayfield(8, SpecialColumnPosition.Left));
            AddStep("Right special style", () => createPlayfield(8, SpecialColumnPosition.Right));

            AddStep("Normal special style", () => createPlayfield(4, SpecialColumnPosition.Normal));

            AddStep("Notes", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Normal));
            AddWaitStep(10);
            AddStep("Left special style", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Left));
            AddWaitStep(10);
            AddStep("Right special style", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Right));
            AddWaitStep(10);

            AddStep("Notes with input", () => createPlayfieldWithNotesAcceptingInput());
        }