1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00
This commit is contained in:
smoogipooo 2017-06-02 11:35:51 +09:00
parent d30706f640
commit 1da5d508fa
2 changed files with 60 additions and 23 deletions

View File

@ -16,6 +16,7 @@ using OpenTK.Input;
using osu.Framework.Timing;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Mania.Timing.Drawables;
using System.Linq;
namespace osu.Desktop.VisualTests.Tests
{
@ -54,7 +55,7 @@ namespace osu.Desktop.VisualTests.Tests
Scale = new Vector2(1, -1)
});
playField.Columns.ForEach(c => c.Add(new DrawableScrollingTimingChange(new TimingChange { BeatLength = 200 })));
playField.Columns.ForEach(c => c.Add(new DrawableGravityTimingChange(new TimingChange { BeatLength = 200 })));
for (int i = 0; i < cols; i++)
{
@ -81,16 +82,26 @@ namespace osu.Desktop.VisualTests.Tests
Clock = new FramedClock(rateAdjustClock)
});
playField.Columns.ForEach(c => c.Add(new DrawableScrollingTimingChange(new TimingChange { BeatLength = 200 })));
for (int t = 1000; t <= 2000; t += 100)
{
playField.Columns.ElementAt(0).Add(new DrawableGravityTimingChange(new TimingChange
{
BeatLength = 200,
Time = t
}));
playField.Add(new DrawableNote(new Note
{
StartTime = t,
Column = 0
}, new Bindable<Key>(Key.D)));
playField.Columns.ElementAt(3).Add(new DrawableGravityTimingChange(new TimingChange
{
BeatLength = 200,
Time = t
}));
playField.Add(new DrawableNote(new Note
{
StartTime = t,
@ -98,6 +109,12 @@ namespace osu.Desktop.VisualTests.Tests
}, new Bindable<Key>(Key.K)));
}
playField.Columns.ElementAt(1).Add(new DrawableGravityTimingChange(new TimingChange
{
BeatLength = 200,
Time = 1000
}));
playField.Add(new DrawableHoldNote(new HoldNote
{
StartTime = 1000,
@ -105,6 +122,12 @@ namespace osu.Desktop.VisualTests.Tests
Column = 1
}, new Bindable<Key>(Key.F)));
playField.Columns.ElementAt(2).Add(new DrawableGravityTimingChange(new TimingChange
{
BeatLength = 200,
Time = 1000
}));
playField.Add(new DrawableHoldNote(new HoldNote
{
StartTime = 1000,
@ -113,23 +136,23 @@ namespace osu.Desktop.VisualTests.Tests
}, 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("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("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", () => 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());
}

View File

@ -1,25 +1,39 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Physics;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Timing.Drawables
{
public class DrawableGravityTimingChange : DrawableTimingChange
{
private const float acceleration = 9.8f;
private const float terminal_velocity = 50f;
private const double acceleration = 9.8f;
private const double terminal_velocity = 50f;
private const double duration = 2000;
private RigidBodySimulation sim;
public DrawableGravityTimingChange(TimingChange timingChange)
: base(timingChange)
{
sim = new RigidBodySimulation(Content);
}
protected override void Update()
{
base.Update();
// Todo: Gravity calculations here
var parent = (TimingChangeContainer)Parent;
double elapsed = Math.Max(0, Time.Current - TimingChange.Time);
// @ Current == TimingChange.Time - duration -> Y = TimingChange.Time
// @ Current == TimingChange.Time -> Y = 0
// @ Current == TimingChange.Time + x -> Y = -f(x)
double acceleration = elapsed / 2 / 1000 / 1000;
Content.Y = (float)(TimingChange.Time - 1 / 2f * acceleration * elapsed * elapsed);
}
}
}