Skip to content

Commit

Permalink
Merge branch 'master' into Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Jul 8, 2020
2 parents fa0e08e + b39c054 commit ebd4d12
Show file tree
Hide file tree
Showing 37 changed files with 618 additions and 187 deletions.
2 changes: 1 addition & 1 deletion .grenrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"wontfix"
],
"template": {
"issue": "- {{name}} | [{{text}}]({{url}}) <sub>by [{{user_login}}]({{user_url}})</sub>",
"issue": "- {{name}} | [{{text}}]({{url}})",
"group": "\n### {{heading}}\n",
"changelogTitle": ""
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ private void testSingle(bool auto = false)
{
IsBreak = true,
StartTime = Time.Current + 1000,
Position = new Vector2(0, -66f),
Angle = 0,
EndPosition = new Vector2(0, -296.5f),
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
3 changes: 0 additions & 3 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneHoldNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ private void testSingle(double duration, bool auto = false)
{
StartTime = Time.Current + 1000,
EndTime = Time.Current + 1000 + duration,
Position = new Vector2(0, -66),
EndPosition = new Vector2(0, -296.5f),
Angle = 0f,
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
3 changes: 0 additions & 3 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTapNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ private void testSingle(bool auto = false)
var circle = new Tap
{
StartTime = Time.Current + 1000,
Position = new Vector2(0, -66f),
Angle = 0,
EndPosition = new Vector2(0, -296.5f),
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ private void testSingle(bool auto = false)
{
StartTime = Time.Current + 1000,
Duration = 5000,
Position = new Vector2(0, 0)
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using NUnit.Framework;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Sentakki.Statistics;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Tests.Visual;
using System.Collections.Generic;

namespace osu.Game.Rulesets.Sentakki.Tests.Statistics
{
[TestFixture]
public class TestSceneJudgementChart : OsuTestScene
{
private List<HitEvent> testevents = new List<HitEvent>
{
// Tap
new HitEvent(0,HitResult.Perfect,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Meh,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Meh,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Meh,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Miss,new Tap(),new Tap(), null),
new HitEvent(0,HitResult.Miss,new Tap(),new Tap(), null),
// Holds
new HitEvent(0,HitResult.Perfect,new Hold.HoldHead(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Hold.HoldTail(),new Tap(), null),
// Touch
new HitEvent(0,HitResult.Good,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Good,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Meh,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Meh,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Meh,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Miss,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Miss,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Touch(),new Tap(), null),
new HitEvent(0,HitResult.Perfect,new Touch(),new Tap(), null),
// Breaks
new HitEvent(0,HitResult.Perfect,new Tap(){IsBreak = true},new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(){IsBreak = true},new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(){IsBreak = true},new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(){IsBreak = true},new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(){IsBreak = true},new Tap(), null),
new HitEvent(0,HitResult.Good,new Tap(){IsBreak = true},new Tap(), null),
new HitEvent(0,HitResult.Meh,new Tap(){IsBreak = true},new Tap(), null),
};
public TestSceneJudgementChart()
{
Add(new JudgementChart(testevents));
}
}
}
31 changes: 31 additions & 0 deletions osu.Game.Rulesets.Sentakki.Tests/UI/TestSceneResumeOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Game.Rulesets.Sentakki.UI;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Sentakki.Tests.UI
{
public class TestSceneResumeOverlay : OsuTestScene
{
public TestSceneResumeOverlay()
{
CursorContainer cursor;
ResumeOverlay resume;

Children = new Drawable[]
{
cursor = new CursorContainer(),
resume = new SentakkiResumeOverlay
{
GameplayCursor = cursor
}
};

AddStep("Show ResumeOverlay", () => resume.Show());
AddAssert("Is overlay shown?", () => resume.State.Value == Visibility.Visible);
AddUntilStep("Wait for countdown to end", () => resume.State.Value == Visibility.Hidden);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject ori
Vector2 newPos = (original as IHasPosition)?.Position ?? Vector2.Zero;
newPos.Y = 384 - newPos.Y;

int path = newPos.GetDegreesFromPosition(CENTRE_POINT).GetNotePathFromDegrees();
int lane = newPos.GetDegreesFromPosition(CENTRE_POINT).GetNoteLaneFromDegrees();
List<SentakkiHitObject> objects = new List<SentakkiHitObject>();

if (EnabledExperiments.Value.HasFlag(ConversionExperiments.patternv2))
Expand All @@ -65,7 +65,7 @@ protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject ori
switch (original)
{
case IHasPathWithRepeats _:
objects.AddRange(Conversions.CreateHoldNote(original, path, beatmap, random, EnabledExperiments.Value));
objects.AddRange(Conversions.CreateHoldNote(original, lane, beatmap, random, EnabledExperiments.Value));
break;

case IHasDuration _:
Expand All @@ -74,9 +74,9 @@ protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject ori

default:
if (EnabledExperiments.Value.HasFlag(ConversionExperiments.touch) && (random2.Next() % 10 == 0))
objects.AddRange(Conversions.CreateTouchNote(original, path, random, EnabledExperiments.Value));
objects.AddRange(Conversions.CreateTouchNote(original, lane, random, EnabledExperiments.Value));
else
objects.AddRange(Conversions.CreateTapNote(original, path, random, EnabledExperiments.Value));
objects.AddRange(Conversions.CreateTapNote(original, lane, random, EnabledExperiments.Value));
break;
}

Expand Down
51 changes: 20 additions & 31 deletions osu.Game.Rulesets.Sentakki/Beatmaps/SentakkiNoteConversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Sentakki.Beatmaps
{
public static class Conversions
{
public static List<SentakkiHitObject> CreateTapNote(HitObject original, int path, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
public static List<SentakkiHitObject> CreateTapNote(HitObject original, int lane, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
{
List<SentakkiHitObject> notes = new List<SentakkiHitObject>();
bool strong = original.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH);
Expand All @@ -26,24 +26,20 @@ public static List<SentakkiHitObject> CreateTapNote(HitObject original, int path
notes.Add(new Tap
{
IsBreak = strong,
Angle = path.GetAngleFromPath(),
Lane = lane,
Samples = original.Samples,
StartTime = original.StartTime,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, path),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, path),
StartTime = original.StartTime
});
if (twin && experimental.HasFlag(ConversionExperiments.twins))
{
int newPath = path;
while (path == newPath) newPath = rng.Next(0, 8);
int newPath = lane;
while (lane == newPath) newPath = rng.Next(0, 8);
notes.Add(new Tap
{
IsBreak = strong,
Angle = newPath.GetAngleFromPath(),
Lane = newPath,
Samples = original.Samples,
StartTime = original.StartTime,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, newPath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, newPath),
StartTime = original.StartTime
});
foreach (var note in notes)
note.HasTwin = true;
Expand All @@ -52,7 +48,7 @@ public static List<SentakkiHitObject> CreateTapNote(HitObject original, int path
return notes;
}

public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int path, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int lane, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
{
Vector2 newPos = (original as IHasPosition)?.Position ?? Vector2.Zero;
newPos.Y = 384 - newPos.Y - 192;
Expand All @@ -62,7 +58,7 @@ public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int pa
{
Samples = original.Samples,
StartTime = original.StartTime,
Position = newPos,
Position = newPos
}};

return notes;
Expand All @@ -71,13 +67,12 @@ public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int pa
public static SentakkiHitObject CreateTouchHold(HitObject original)
=> new TouchHold
{
Position = Vector2.Zero,
StartTime = original.StartTime,
EndTime = (original as IHasDuration).EndTime,
Samples = original.Samples,
};

public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int path, IBeatmap beatmap, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int lane, IBeatmap beatmap, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
{
var curveData = original as IHasPathWithRepeats;

Expand All @@ -88,36 +83,32 @@ public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int pat
notes.Add(new Hold
{
IsBreak = strong,
Angle = path.GetAngleFromPath(),
Lane = lane,
NodeSamples = curveData.NodeSamples,
StartTime = original.StartTime,
EndTime = original.GetEndTime(),
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, path),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, path),
EndTime = original.GetEndTime()
});

if (experimental.HasFlag(ConversionExperiments.twins))
{
if (twin)
{
int newPath = path;
while (path == newPath) newPath = rng.Next(0, 8);
int newLane = lane;
while (lane == newLane) newLane = rng.Next(0, 8);
notes.Add(new Hold
{
IsBreak = strong,
Angle = newPath.GetAngleFromPath(),
Lane = newLane,
NodeSamples = curveData.NodeSamples,
StartTime = original.StartTime,
EndTime = original.GetEndTime(),
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, newPath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, newPath),
});
foreach (var note in notes)
note.HasTwin = true;
}
else
{
var taps = CreateTapFromTicks(original, path, beatmap, rng);
var taps = CreateTapFromTicks(original, lane, beatmap, rng);
if (taps.Any())
notes.AddRange(taps);
}
Expand All @@ -126,7 +117,7 @@ public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int pat
return notes;
}

public static List<SentakkiHitObject> CreateTapFromTicks(HitObject original, int path, IBeatmap beatmap, Random rng)
public static List<SentakkiHitObject> CreateTapFromTicks(HitObject original, int lane, IBeatmap beatmap, Random rng)
{
var curve = original as IHasPathWithRepeats;
double spanDuration = curve.Duration / (curve.RepeatCount + 1);
Expand All @@ -151,20 +142,18 @@ public static List<SentakkiHitObject> CreateTapFromTicks(HitObject original, int

foreach (var e in SliderEventGenerator.Generate(original.StartTime, spanDuration, velocity, tickDistance, curve.Path.Distance, curve.RepeatCount + 1, legacyLastTickOffset, CancellationToken.None))
{
int newPath = path;
while (newPath == path) newPath = rng.Next(0, 8);
int newLane = lane;
while (newLane == lane) newLane = rng.Next(0, 8);

switch (e.Type)
{
case SliderEventType.Tick:
case SliderEventType.Repeat:
hitObjects.Add(new Tap
{
Angle = newPath.GetAngleFromPath(),
Lane = newLane,
Samples = getTickSamples(original.Samples),
StartTime = e.Time,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, newPath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, newPath),
});
break;
}
Expand Down
Loading

0 comments on commit ebd4d12

Please sign in to comment.