From 565ba3a1194070c118c5a7f5130f8925f16ed153 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 5 Jul 2020 17:32:49 +0900 Subject: [PATCH 1/2] Clean-up some code and update readme. --- README.md | 24 ++++++++++--------- .../Beatmaps/Formats/LrcDecoderTest.cs | 2 +- .../Edit/TestSceneLyricEditorScreen.cs | 2 +- .../Edit/TestSceneLyricLineLayout.cs | 1 - .../Edit/TestSceneLyricLineStyle.cs | 1 - .../Edit/TestSceneSinger.cs | 1 - .../Mods/TestSceneKaraokeModDisableNote.cs | 2 +- .../TestSceneAutoGenerationBySinger.cs | 4 ++-- osu.Game.Rulesets.Karaoke.sln.DotSettings | 6 +++-- .../Formats/KaraokeLegacyBeatmapDecoder.cs | 4 ++-- .../Beatmaps/Formats/NicoKaraDecoder.cs | 2 +- .../Beatmaps/KaraokeBeatmapProcessor.cs | 1 - .../Beatmaps/Patterns/IPatternGenerator.cs | 5 ++-- .../Patterns/LegacyKaraokeLayoutGenerator.cs | 21 ++++++++-------- .../KaraokeTimelineBlueprintContainer.cs | 2 +- .../Mods/KaraokeModWindowsUpdate.cs | 2 +- .../Replays/KaraokeAutoGeneratorBySinger.cs | 4 ++-- 17 files changed, 42 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 0cb584a38..6c288a415 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ # karaoke! [![CodeFactor](https://www.codefactor.io/repository/github/karaoke-dev/karaoke/badge)](https://www.codefactor.io/repository/github/karaoke-dev/karaoke) -[![Build status](https://ci.appveyor.com/api/projects/status/toy4vlii1t2vl8yr?svg=true)](https://ci.appveyor.com/project/karaoke-dev/karaoke) +[![Build status](https://ci.appveyor.com/api/projects/status/07ytm0sei6l5oy08?svg=true)](https://ci.appveyor.com/project/andy840119/karaoke) [![NuGet](https://img.shields.io/badge/月子我婆-passed-ff69b4.svg)](https://github.com/karaoke-dev/karaoke) [![GitHub last commit](https://img.shields.io/github/last-commit/karaoke-dev/karaoke)](https://github.com/karaoke-dev/karaoke/releases) [![Tagged Release](https://github.com/karaoke-dev/karaoke/workflows/Tagged%20Release/badge.svg)](https://github.com/karaoke-dev/karaoke/releases) [![dev chat](https://discordapp.com/api/guilds/299006062323826688/widget.png?style=shield)](https://discord.gg/ga2xZXk) -The source code of `karaoke!` ruleset - -[Notice] : This is edge branch, some crash issue cause by using new package might be ignored. +The source code of `karaoke!` ruleset. ## How to run this project -The fastest way is run [launcher](https://github.com/karaoke-dev/launcher)(you might need to comile yourself). +The fastest way is download [release](https://github.com/karaoke-dev/karaoke/releases) `.dil` file and throw into lazer like [other customize ruleset](https://github.com/LumpBloom7/sentakki/wiki/Ruleset-installation-guide) do. +Or you can compile yourself. -Or compile `osu.Game.Rulesets.Karaoke`, then throw dll into official osu!lazer's folder(sometimes might not working). +If wants to try on other platform like android or ios, you might use [launcher](https://github.com/karaoke-dev/launcher). +Notice : Launcher is still under develop so it might not working. ## License @@ -23,16 +23,18 @@ This repo is under [GPL V3](LICENSE) license. ## Rules -1. If using this repo in commercial, please contact me(andy840119@gmail.com) to got permission first. +1. If using this repo in commercial, please contact me(andy840119@gmail.com) to get permission first. 2. Use this repo to create/use `PIRATED` karaoke beatmap is absolutely forbidden. ## Thanks to -[osu!](https://github.com/ppy/osu) and it's [framework](https://github.com/ppy/osu-framework), karaoke! is modified from them. +- [osu!](https://github.com/ppy/osu) and it's [framework](https://github.com/ppy/osu-framework), karaoke! is modified from them. -[RhythmKaTTE](http://juna-idler.blogspot.com/2016/05/rhythmkatte-version-01.html) and [RhythmicaLyrics](http://suwa.pupu.jp/RhythmicaLyrics.html), an open-source software to create lyric with time tag. +- [RhythmKaTTE](http://juna-idler.blogspot.com/2016/05/rhythmkatte-version-01.html) and [RhythmicaLyrics](http://suwa.pupu.jp/RhythmicaLyrics.html), an open-source software to create lyric with time tag. Some of lyric editor in this ruleset is inspired from them. -[ニコカラメーカー](http://shinta0806be.ldblog.jp/tag/%E3%83%8B%E3%82%B3%E3%82%AB%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%AB%E3%83%BC), a software to convert `.lrc` file into karaoke video with beautiful text effect. +- [ニコカラメーカー](http://shinta0806be.ldblog.jp/tag/%E3%83%8B%E3%82%B3%E3%82%AB%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%AB%E3%83%BC), a software to convert `.lrc` file into karaoke video with beautiful text effect. + +- [Jetbrain](https://www.jetbrains.com/?from=osu-karaoke), thanks for free [rider](https://www.jetbrains.com/rider/) license for clean-up code. -[Jetbrain](https://www.jetbrains.com/?from=osu-karaoke), thanks for free [rider](https://www.jetbrains.com/rider/) license for clean-up code. +- [Appveyor](https://www.appveyor.com/), [CodeFactor](https://www.codefactor.io/) and [Github action](https://github.com/features/actions) for providing free `CI`/`CD` service. diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/LrcDecoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/LrcDecoderTest.cs index 276971d39..184503bd0 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/LrcDecoderTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/LrcDecoderTest.cs @@ -39,7 +39,7 @@ public void TestDecodeLyric() } [Test] - public void TestDecodeLyricWithDulicatedTimeTag() + public void TestDecodeLyricWithDuplicatedTimeTag() { const string wrong_lyric_text = "[00:04.00]か[00:04.00]ら[00:05.00]お[00:06.00]け[00:07.00]"; Assert.Throws(() => decodeLrcLine(wrong_lyric_text)); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricEditorScreen.cs b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricEditorScreen.cs index c3e0227ca..fe6db77a9 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricEditorScreen.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricEditorScreen.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Edit { [TestFixture] - [Ignore("Will fail if run muliple tests. No idea how to fix that.")] + [Ignore("Will fail if run multiple tests. No idea how to fix that.")] public class TestSceneLyricEditorScreen : EditorClockTestScene { public TestSceneLyricEditorScreen() diff --git a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineLayout.cs b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineLayout.cs index e1f534ffb..2b387aedd 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineLayout.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineLayout.cs @@ -16,7 +16,6 @@ using osu.Game.Graphics.UserInterface; using osu.Game.IO; using osu.Game.Rulesets.Karaoke.Beatmaps.Formats; -using osu.Game.Rulesets.Karaoke.Edit.LyricEditor; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Drawables; using osu.Game.Rulesets.Karaoke.Skinning; diff --git a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineStyle.cs b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineStyle.cs index 090087659..7c837bca2 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineStyle.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneLyricLineStyle.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.Karaoke.Edit.LyricEditor; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Drawables; using osu.Game.Rulesets.Karaoke.Skinning; diff --git a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs index e5df2578e..85a930ef0 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs @@ -14,7 +14,6 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.Karaoke.Edit.LyricEditor; using osu.Game.Rulesets.Karaoke.Skinning; using osu.Game.Rulesets.Karaoke.Skinning.Components; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModDisableNote.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModDisableNote.cs index 4578c5736..1574c1ce9 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModDisableNote.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModDisableNote.cs @@ -28,7 +28,7 @@ public void TestCheckNoteExistInPlayfield() => CreateModTest(new ModTestData return false; // check has no note in playfield - return lyricPlayfield.AllHitObjects.Any() && notePlayfield.AllHitObjects.Count() == 0; + return lyricPlayfield.AllHitObjects.Any() && !notePlayfield.AllHitObjects.Any(); } }); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Replays/TestSceneAutoGenerationBySinger.cs b/osu.Game.Rulesets.Karaoke.Tests/Replays/TestSceneAutoGenerationBySinger.cs index 4c234242c..678587996 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Replays/TestSceneAutoGenerationBySinger.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Replays/TestSceneAutoGenerationBySinger.cs @@ -25,7 +25,7 @@ public void TestSingDemoSong() // Get generated frame and compare frame var karaokeFrames = generated.Frames.OfType().ToList(); - var compareFrame = GetCompareResultFromName("demo"); + var compareFrame = getCompareResultFromName("demo"); // Check total frames. Assert.AreEqual(karaokeFrames.Count, compareFrame.Count, $"Replay frame should have {compareFrame.Count}."); @@ -44,7 +44,7 @@ public void TestSingDemoSong() } } - private static IList GetCompareResultFromName(string name) + private static IList getCompareResultFromName(string name) { var data = TestResources.OpenResource($"Testing/Track/{name}.json"); diff --git a/osu.Game.Rulesets.Karaoke.sln.DotSettings b/osu.Game.Rulesets.Karaoke.sln.DotSettings index feb3d52fb..5e8d642ac 100644 --- a/osu.Game.Rulesets.Karaoke.sln.DotSettings +++ b/osu.Game.Rulesets.Karaoke.sln.DotSettings @@ -1,4 +1,4 @@ - + True True True @@ -915,6 +915,7 @@ private void load() True True True + True True True True @@ -931,4 +932,5 @@ private void load() True True True - True + True + True diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs index 1099ada6b..85dd9464f 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs @@ -95,7 +95,7 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line) } } - private void processNotes(Beatmap beatmap, IList noteLines) + private void processNotes(Beatmap beatmap, IList lines) { // Remove all karaoke note beatmap.HitObjects.RemoveAll(x => x is Note); @@ -105,7 +105,7 @@ private void processNotes(Beatmap beatmap, IList noteLines) for (int l = 0; l < lyricLines.Count; l++) { var lyricLine = lyricLines[l]; - var line = noteLines.ElementAtOrDefault(l)?.Split('=').Last(); + var line = lines.ElementAtOrDefault(l)?.Split('=').Last(); // Create default note if not exist if (string.IsNullOrEmpty(line)) diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs index 284396711..b9fbe2645 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs @@ -138,7 +138,7 @@ static Skinning.Components.BrushInfo convertBrushInfo(BrushInfo info) BrushGradients = brushGradient }; - Color4 convertColor(System.Drawing.Color color) => new Color4(color.R, color.G, color.B, color.A); + static Color4 convertColor(System.Drawing.Color color) => new Color4(color.R, color.G, color.B, color.A); } } } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs index 5c7422951..47cfe527f 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs @@ -1,7 +1,6 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Karaoke.Beatmaps.Patterns; diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/IPatternGenerator.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/IPatternGenerator.cs index 7ac267fa7..16ed5474d 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/IPatternGenerator.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/IPatternGenerator.cs @@ -2,11 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Game.Rulesets.Karaoke.Objects; namespace osu.Game.Rulesets.Karaoke.Beatmaps.Patterns { - public interface IPatternGenerator + public interface IPatternGenerator where TObject : KaraokeHitObject { - void Generate(IEnumerable hitObjects); + void Generate(IEnumerable hitObjects); } } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/LegacyKaraokeLayoutGenerator.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/LegacyKaraokeLayoutGenerator.cs index 7b53464d0..930044622 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/LegacyKaraokeLayoutGenerator.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Patterns/LegacyKaraokeLayoutGenerator.cs @@ -46,9 +46,8 @@ public void Generate(IEnumerable hitObjects) /// ****** (left) 12 /// ****** (right) 13 /// - /// - /// - private void assignLayoutArrangement(IList lyrics, bool bottomOnly = false) + /// Lyrics + private void assignLayoutArrangement(IList lyrics) { // Force change to new line if lyric has long time const int new_lyric_line_time = 15000; @@ -83,15 +82,15 @@ private void assignLyricTime(IList lyrics) var lastLyricLine = i >= number_of_line ? lyrics[i - number_of_line] : null; var lyricLine = lyrics[i]; - if (lastLyricLine != null) - { - // Adjust start time and end time - var lyricEndTime = lyricLine.EndTime; - lyricLine.StartTime = lastLyricLine.EndTime + 1000; + if (lastLyricLine == null) + continue; - // Should re-assign duration here - lyricLine.Duration = lyricEndTime - lyricLine.StartTime; - } + // Adjust start time and end time + var lyricEndTime = lyricLine.EndTime; + lyricLine.StartTime = lastLyricLine.EndTime + 1000; + + // Should re-assign duration here + lyricLine.Duration = lyricEndTime - lyricLine.StartTime; } } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Timelines/KaraokeTimelineBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Edit/Timelines/KaraokeTimelineBlueprintContainer.cs index 57251cac6..6f5ea4500 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Timelines/KaraokeTimelineBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Timelines/KaraokeTimelineBlueprintContainer.cs @@ -134,7 +134,7 @@ private void handleScrollViaDrag(DragEvent e) internal class TimelineSelectionHandler : SelectionHandler { - // for now we always allow movement. snapping is provided by the Timeline's "distance" snap implementation + // for now we always allow movement. snapping is provided by the time line's "distance" snap implementation public override bool HandleMovement(MoveSelectionEvent moveEvent) => true; } diff --git a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModWindowsUpdate.cs b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModWindowsUpdate.cs index f3a383d9d..4b6921193 100644 --- a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModWindowsUpdate.cs +++ b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModWindowsUpdate.cs @@ -97,7 +97,7 @@ public WindowsUpdateContainer() }; } - public class LoadingIcon : ModButton + private class LoadingIcon : ModButton { public LoadingIcon() : base(new KaraokeModWindowsUpdate()) diff --git a/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs b/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs index 131f07dcb..dcf99a2d6 100644 --- a/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs +++ b/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs @@ -22,8 +22,8 @@ public class KaraokeAutoGeneratorBySinger : AutoGenerator private readonly Task> readTask; /// - /// Using audio's vioce to generate replay frames - /// Logic is copird from + /// Using audio's voice to generate replay frames + /// Logic is copied from /// /// /// From 61199c8d728652c8aaba436a1d1581cd6ee6bf8e Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 5 Jul 2020 17:38:17 +0900 Subject: [PATCH 2/2] Add some context. --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c288a415..d37b89bdb 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,17 @@ [![dev chat](https://discordapp.com/api/guilds/299006062323826688/widget.png?style=shield)](https://discord.gg/ga2xZXk) -The source code of `karaoke!` ruleset. +The source code of `karaoke!` ruleset, running on [osu!lazer](https://github.com/ppy/osu). + +## Status + +Some feature is still developing, but exist feature should works fine. + +Feel free to report bugs if found. ## How to run this project -The fastest way is download [release](https://github.com/karaoke-dev/karaoke/releases) `.dil` file and throw into lazer like [other customize ruleset](https://github.com/LumpBloom7/sentakki/wiki/Ruleset-installation-guide) do. +The fastest way is download [release](https://github.com/karaoke-dev/karaoke/releases) dil file and throw into lazer like [other customize ruleset](https://github.com/LumpBloom7/sentakki/wiki/Ruleset-installation-guide) do. Or you can compile yourself. If wants to try on other platform like android or ios, you might use [launcher](https://github.com/karaoke-dev/launcher).