Skip to content

Commit

Permalink
Merge pull request #89 from karaoke-dev/edge
Browse files Browse the repository at this point in the history
Create edge branch
  • Loading branch information
andy840119 authored Jun 26, 2020
2 parents aed4d0f + 189ac65 commit bac59e0
Show file tree
Hide file tree
Showing 45 changed files with 994 additions and 135 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

The source code of `karaoke!` ruleset

[Notice] : This is edge branch, some crash issue cause by using new package might be ignored.

## How to run this project

The fastest way is run [launcher](https://github.com/karaoke-dev/launcher)(you might need to comile yourself).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void TestEncodeBeatmapLyric()
{
// Because encoder is not fully implemented, so just test not crash during encoding.
const int start_time = 1000;
const int end_time = start_time + 2500;
const int duration = 2500;

var beatmap = new Beatmap
{
Expand All @@ -29,7 +29,7 @@ public void TestEncodeBeatmapLyric()
new LyricLine
{
StartTime = start_time,
EndTime = end_time,
Duration = duration,
Text = "カラオケ!",
TimeTags = new Dictionary<TimeTagIndex, double>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public TestKaraokeBeatmap(RulesetInfo ruleset)
Breaks = baseBeatmap.Breaks;
HitObjects = baseBeatmap.HitObjects;

BeatmapInfo.RulesetID = 1;
BeatmapInfo.Ruleset = ruleset;
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
Expand Down
5 changes: 1 addition & 4 deletions osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public class TestSceneEditor : EditorTestScene
{
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestKaraokeBeatmap(ruleset);

public TestSceneEditor()
: base(new KaraokeRuleset())
{
}
protected override Ruleset CreateEditorRuleset() => new KaraokeRuleset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public TestSceneLyricLineLayout()
private LyricLine createDefaultLyricLine(string text, string[] ruby, string[] romaji, string translate)
{
var startTime = Time.Current;
var endTime = Time.Current + 1000000;
var duration = 1000000;

using (var stream = new MemoryStream())
using (var writer = new StreamWriter(stream))
Expand All @@ -392,12 +392,12 @@ private LyricLine createDefaultLyricLine(string text, string[] ruby, string[] ro

// Apply property
lyric.StartTime = startTime;
lyric.EndTime = endTime;
lyric.Duration = duration;
lyric.TranslateText = translate;
lyric.TimeTags = new Dictionary<TimeTagIndex, double>
{
{ new TimeTagIndex(0), startTime },
{ new TimeTagIndex(4), endTime },
{ new TimeTagIndex(4), startTime + duration },
};

return lyric;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,12 @@ public TestSceneLyricLineStyle()
private LyricLine createDefaultLyricLine()
{
var startTime = Time.Current;
var endTime = Time.Current + 1000000;
var duration = 1000000;

return new LyricLine
{
StartTime = startTime,
EndTime = endTime,
Duration = duration,
Text = "カラオケ!",
TimeTags = new Dictionary<TimeTagIndex, double>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModAutoplay : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModAutoplay()
: base(new KaraokeRuleset())
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModAutoplayBySinger : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModAutoplayBySinger()
: base(new KaraokeRuleset())
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModDisableNote : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModDisableNote()
: base(new KaraokeRuleset())
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModFlashlight : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModFlashlight()
: base(new KaraokeRuleset())
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModFun : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModFun()
: base(new KaraokeRuleset())
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModPerfect : ModPerfectTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModPerfect()
: base(new KaraokeRuleset(), new KaraokeModPerfect())
: base(new KaraokeModPerfect())
{
}

Expand All @@ -22,7 +24,7 @@ public TestSceneKaraokeModPerfect()
public void TestLyric(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new LyricLine
{
StartTime = 1000,
EndTime = 2000,
Duration = 1000,
Text = "カラオケ!",
TimeTags = new Dictionary<TimeTagIndex, double>()
}), shouldMiss);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Mods
{
public class TestSceneKaraokeModPractice : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokeModPractice()
: base(new KaraokeRuleset())
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Game.Rulesets.Karaoke.Overlays;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Karaoke.Tests.Overlays
{
[TestFixture]
public class TestSceneKaraokeChangeLogOverlay : OsuTestScene
{
private TestChangelogOverlay changelog;

[SetUp]
public void SetUp() => Schedule(() =>
{
Child = changelog = new TestChangelogOverlay();
});

[Test]
public void ShowWithNoFetch()
{
AddStep(@"Show", () => changelog.Show());
AddAssert(@"listing displayed", () => changelog.Current.Value == null);
}

private class TestChangelogOverlay : KaraokeChangelogOverlay
{
public TestChangelogOverlay()
: base("karaoke-dev")
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void TestSingleShortNote()
{
Display = true,
StartTime = 1000,
EndTime = 1050,
Duration = 50,
Text = "karaoke!",
Tone = new Tone(0, true)
});
Expand All @@ -51,7 +51,7 @@ public void TestSingleNoteWithLongTime()
{
Display = true,
StartTime = 1000,
EndTime = 2000,
Duration = 1000,
Text = "karaoke!",
Tone = new Tone(0, true)
});
Expand All @@ -77,15 +77,15 @@ public void TestNoteStair()
{
Display = true,
StartTime = 1000,
EndTime = 1050,
Duration = 50,
Text = "kara",
Tone = new Tone(0, true)
});
beatmap.HitObjects.Add(new Note
{
Display = true,
StartTime = 1050,
EndTime = 1100,
Duration = 50,
Text = "oke!",
Tone = new Tone(1, true)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ private void load()
{
h.HitObject.StartTime = START_TIME;

if (h.HitObject is IHasEndTime hasEndTimeHitObject)
hasEndTimeHitObject.EndTime = START_TIME * 2;
if (h.HitObject is IHasDuration hasDurationHitObject)
hasDurationHitObject.Duration = DURATION;

h.AccentColour.Value = Color4.Orange;
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Karaoke.Configuration;
using osu.Game.Rulesets.Karaoke.Skinning;
using osu.Game.Rulesets.Karaoke.UI;
using osu.Game.Rulesets.Karaoke.UI.Position;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
Expand All @@ -25,6 +21,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Skinning
public abstract class KaraokeSkinnableColumnTestScene : KaraokeSkinnableTestScene
{
protected const double START_TIME = 1000000000;
protected const double DURATION = 1000000000;

public const int COLUMN_NUMBER = 9;

Expand All @@ -34,13 +31,6 @@ public abstract class KaraokeSkinnableColumnTestScene : KaraokeSkinnableTestScen
[Cached(Type = typeof(IPositionCalculator))]
private readonly PositionCalculator positionCalculator = new PositionCalculator(COLUMN_NUMBER);

public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(KaraokeRuleset),
typeof(KaraokeLegacySkinTransformer),
typeof(KaraokeSettingsSubsection)
};

protected override Ruleset CreateRulesetForSkinProvider() => new KaraokeRuleset();

protected KaraokeSkinnableColumnTestScene()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
Expand All @@ -15,12 +14,6 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Skinning
{
public class TestSceneDrawableJudgement : KaraokeSkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableJudgement),
typeof(DrawableNoteJudgement)
};

public TestSceneDrawableJudgement()
{
foreach (var result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Karaoke.Objects.Drawables;
using osu.Game.Rulesets.Karaoke.UI;
using osu.Game.Rulesets.Karaoke.UI.Components;
using osu.Game.Skinning;
Expand All @@ -21,12 +18,6 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Skinning
[TestFixture]
public class TestSceneHitExplosion : KaraokeSkinnableColumnTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableNote),
typeof(DrawableKaraokeHitObject),
};

public TestSceneHitExplosion()
{
int runCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Skinning
[TestFixture]
public class TestSceneLyricLine : KaraokeSkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableLyricLine)
};

public TestSceneLyricLine()
{
AddStep("Default Lyric", () => SetContents(() => testSingle()));
Expand All @@ -31,12 +26,12 @@ public TestSceneLyricLine()
private Drawable testSingle(bool auto = false, double timeOffset = 0)
{
var startTime = Time.Current + 1000 + timeOffset;
var endTime = startTime + 2500;
var duration = 2500;

var lyric = new LyricLine
{
StartTime = startTime,
EndTime = endTime,
Duration = duration,
Text = "カラオケ!",
TimeTags = new Dictionary<TimeTagIndex, double>
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override DrawableHitObject CreateHitObject()
var note = new Note
{
StartTime = 100,
EndTime = 900,
Duration = 800,
Text = "カラオケ"
};
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Karaoke.Tests/UI/TestSceneKaraokePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public class TestSceneKaraokePlayer : PlayerTestScene
{
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestKaraokeBeatmap(ruleset);

protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset();

public TestSceneKaraokePlayer()
: base(new KaraokeRuleset())
{
}
}
Expand Down
Loading

0 comments on commit bac59e0

Please sign in to comment.