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)); }
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)); }
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 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()); }