From ecdc5994e9beacf761a84cb9f8fbaf85dbd03fd9 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Mon, 9 Mar 2020 22:03:45 +0900 Subject: [PATCH 01/10] Add initial test file --- .../TestSceneSaitenAdjustmentScreen.cs | 26 ++++++++++++++ .../SaitenAdjustmentScreen.cs | 11 ++++++ .../UI/DrawableSaitenAdjustmentRuleset.cs | 34 +++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 osu.Game.Rulesets.Karaoke.Tests/TestSceneSaitenAdjustmentScreen.cs create mode 100644 osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs create mode 100644 osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs diff --git a/osu.Game.Rulesets.Karaoke.Tests/TestSceneSaitenAdjustmentScreen.cs b/osu.Game.Rulesets.Karaoke.Tests/TestSceneSaitenAdjustmentScreen.cs new file mode 100644 index 000000000..4c0a2a6f7 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke.Tests/TestSceneSaitenAdjustmentScreen.cs @@ -0,0 +1,26 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment; +using osu.Game.Screens; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Karaoke.Tests +{ + public class TestSceneSaitenAdjustmentScreen : OsuTestScene + { + private OsuScreenStack stack; + private SaitenAdjustmentScreen saitenAdjustmentScreen; + + [SetUp] + public virtual void SetUp() => Schedule(() => + { + var stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; + Child = stack; + + stack.Push(saitenAdjustmentScreen = new SaitenAdjustmentScreen()); + }); + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs new file mode 100644 index 000000000..4a0068c04 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs @@ -0,0 +1,11 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Screens; + +namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment +{ + public class SaitenAdjustmentScreen : OsuScreen + { + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs new file mode 100644 index 000000000..85dee8908 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs @@ -0,0 +1,34 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Karaoke.Objects; +using osu.Game.Rulesets.Karaoke.Objects.Drawables; +using osu.Game.Rulesets.Karaoke.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.UI; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI +{ + public class DrawableSaitenAdjustmentRuleset : DrawableKaraokeRuleset + { + public DrawableSaitenAdjustmentRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) + : base(ruleset, beatmap, mods) + { + } + + protected override Playfield CreatePlayfield() => new NotePlayfield(9); + + public override DrawableHitObject CreateDrawableRepresentation(KaraokeHitObject h) + { + // Only get drawable note here + var drawableHitObject = base.CreateDrawableRepresentation(h); + if (drawableHitObject is DrawableNote) + return drawableHitObject; + + return null; + } + } +} From e7ba4f5e6cba560afbf7ccd55983f6db80ab9263 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Mon, 9 Mar 2020 22:18:36 +0900 Subject: [PATCH 02/10] Add result beatmap --- .../Resources/Beatmaps/saiten-result.osu | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu diff --git a/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu b/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu new file mode 100644 index 000000000..505537e01 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu @@ -0,0 +1,56 @@ +karaoke file format v1 + +[General] +AudioFilename: saiten-adjustment.mp3 +AudioLeadIn: 0 +PreviewTime: 0 +Countdown: 0 +SampleSet: Normal +StackLeniency: 1 +Mode: 111 +LetterboxInBreaks: 0 +WidescreenStoryboard: 1 + +[Editor] +DistanceSpacing: 1 +BeatDivisor: 4 +GridSize: 4 +TimelineZoom: 1 + +[Metadata] +Title:Saiten result display +TitleUnicode:Saiten result display +Artist:andy840119 +ArtistUnicode:andy840119 +Creator:andy840119 +Version:Normal +Source:andy840119 +Tags:karaoke +BeatmapID:1 +BeatmapSetID:1 + +[Difficulty] +HPDrainRate:2 +CircleSize:3 +OverallDifficulty:2 +ApproachRate:4 +SliderMultiplier:0.8 +SliderTickRate:1 + +[Events] +//Background and Video events +Video,0,"video.mp4" +0,0,"bg.png",0,0 + +[Colours] + +[HitObjects] +@[00:00:00]Ra[00:01:00]Ra#[00:02:00]Ra[00:03:00]Ra#[00:04:00]Ra[00:05:00]Ra#[00:06:00]Ra[00:07:00]Ra#[00:08:00]Ra[00:09:00] +@note1=0,0#,1,1#,2,2#,3,3#,4 +@[00:15:00]Ra[00:16:00]Ra#[00:17:00]Ra[00:18:00]Ra#[00:19:00]Ra[00:20:00]Ra#[00:21:00]Ra[00:22:00]Ra#[00:23:00]Ra[00:24:00] +@note1=4,3#,3,2#,2,1#,1,0#,0 + +@[00:30:00]Ra[00:31:00]Ra#[00:32:00]Ra[00:33:00]Ra#[00:34:00]Ra[00:35:00]Ra#[00:36:00]Ra[00:37:00]Ra#[00:38:00]Ra[00:39:00] +@note1=0,-1#,-1,-2#,-2,-3#,-3,-4#,-4 +@[00:45:00]Ra[00:46:00]Ra#[00:47:00]Ra[00:48:00]Ra#[00:49:00]Ra[00:50:00]Ra#[00:51:00]Ra[00:52:00]Ra#[00:53:00]Ra[00:54:00] +@note1=-4,-4#,-3,-3#,-2,-2#,-1,-1#,0 \ No newline at end of file From 1d5c3bad438f902e96f3ddb3aeec7ffa9ff7920a Mon Sep 17 00:00:00 2001 From: andy840119 Date: Mon, 9 Mar 2020 22:52:22 +0900 Subject: [PATCH 03/10] 1. Adding saiten adjust wirking beatmap and add class to get internal resource 2. Implement screen --- .../Resources/Beatmaps/saiten-result.osu | 4 ++- .../Resources/KaraokeResources.cs | 30 +++++++++++++++++ .../SaitenAdjustmentWorkingBeatmap.cs | 28 ++++++++++++++++ .../SaitenAdjustmentScreen.cs | 32 +++++++++++++++++++ .../osu.Game.Rulesets.Karaoke.csproj | 3 ++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Karaoke/Resources/KaraokeResources.cs create mode 100644 osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs diff --git a/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu b/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu index 505537e01..966f3b97b 100644 --- a/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu +++ b/osu.Game.Rulesets.Karaoke/Resources/Beatmaps/saiten-result.osu @@ -53,4 +53,6 @@ Video,0,"video.mp4" @[00:30:00]Ra[00:31:00]Ra#[00:32:00]Ra[00:33:00]Ra#[00:34:00]Ra[00:35:00]Ra#[00:36:00]Ra[00:37:00]Ra#[00:38:00]Ra[00:39:00] @note1=0,-1#,-1,-2#,-2,-3#,-3,-4#,-4 @[00:45:00]Ra[00:46:00]Ra#[00:47:00]Ra[00:48:00]Ra#[00:49:00]Ra[00:50:00]Ra#[00:51:00]Ra[00:52:00]Ra#[00:53:00]Ra[00:54:00] -@note1=-4,-4#,-3,-3#,-2,-2#,-1,-1#,0 \ No newline at end of file +@note1=-4,-4#,-3,-3#,-2,-2#,-1,-1#,0 + +end \ No newline at end of file diff --git a/osu.Game.Rulesets.Karaoke/Resources/KaraokeResources.cs b/osu.Game.Rulesets.Karaoke/Resources/KaraokeResources.cs new file mode 100644 index 000000000..6f1fa6434 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Resources/KaraokeResources.cs @@ -0,0 +1,30 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.IO; +using osu.Framework.IO.Stores; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Formats; +using osu.Game.IO; + +namespace osu.Game.Rulesets.Karaoke.Resources +{ + public static class KaraokeResources + { + public static DllResourceStore GetStore() => new DllResourceStore(typeof(KaraokeResources).Assembly); + + public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}"); + + public static Stream OpenBeatmapResource(string name) => OpenResource($"Beatmaps/{name}.osu"); + + public static Beatmap OpenBeatmap(string name) + { + using (var resStream = OpenBeatmapResource(name)) + using (var stream = new LineBufferedReader(resStream)) + { + var decoder = Decoder.GetDecoder(stream); + return decoder.Decode(stream); + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs new file mode 100644 index 000000000..c8e11a033 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs @@ -0,0 +1,28 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Audio; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Video; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Karaoke.Beatmaps; + +namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps +{ + public class SaitenAdjustmentWorkingBeatmap : WorkingBeatmap + { + public SaitenAdjustmentWorkingBeatmap(Beatmap beatmap) : base(beatmap.BeatmapInfo, null) + { + } + + protected override Texture GetBackground() => null; + + protected override IBeatmap GetBeatmap() => new KaraokeBeatmap(); + + // TODO : get real treak from resourse + protected override Track GetTrack() => AudioManager.Tracks.GetVirtual(10000); + + protected override VideoSprite GetVideo() => null; + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs index 4a0068c04..d3877beb6 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs @@ -1,11 +1,43 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Karaoke.Configuration; +using osu.Game.Rulesets.Karaoke.Resources; +using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; using osu.Game.Screens; namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment { public class SaitenAdjustmentScreen : OsuScreen { + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + [BackgroundDependencyLoader] + private void load(RulesetConfigCache configCache) + { + var config = (KaraokeRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); + dependencies.Cache(new KaraokeSessionStatics(config, null)); + + var beatmap = KaraokeResources.OpenBeatmap("saiten-result"); + var workingBeatmap = new SaitenAdjustmentWorkingBeatmap(beatmap); + + var ruleset = new KaraokeRuleset(); + var drawableRuleset = ruleset.CreateDrawableRulesetWith(workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo)); + + AddInternal(new Container + { + RelativeSizeAxes = Axes.Both, + Children = new[] + { + drawableRuleset + } + }); + } } } diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index b2728cde3..32c13a44d 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -9,6 +9,9 @@ + + + From 7bb2b3eb904fb62548d4740a0792edf6ceaec893 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 14 Mar 2020 14:41:31 +0900 Subject: [PATCH 04/10] Make it work TODO : adjust UI and let `DrawableSaitenAdjustmentRuleset` use `NotePlayfield` only --- .../SaitenAdjustmentWorkingBeatmap.cs | 10 ++- .../SaitenAdjustmentScreen.cs | 24 +----- .../UI/DrawableSaitenAdjustmentRuleset.cs | 34 --------- .../UI/SaitenAdjustmantmentVisualization.cs | 75 +++++++++++++++++++ 4 files changed, 84 insertions(+), 59 deletions(-) delete mode 100644 osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs create mode 100644 osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs index c8e11a033..25bc8caf9 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs @@ -1,24 +1,26 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Karaoke.Beatmaps; namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps { public class SaitenAdjustmentWorkingBeatmap : WorkingBeatmap { - public SaitenAdjustmentWorkingBeatmap(Beatmap beatmap) : base(beatmap.BeatmapInfo, null) + private readonly IBeatmap beatmap; + + public SaitenAdjustmentWorkingBeatmap(Beatmap beatmap) + : base(beatmap.BeatmapInfo, null) { + this.beatmap = beatmap; } protected override Texture GetBackground() => null; - protected override IBeatmap GetBeatmap() => new KaraokeBeatmap(); + protected override IBeatmap GetBeatmap() => beatmap; // TODO : get real treak from resourse protected override Track GetTrack() => AudioManager.Tracks.GetVirtual(10000); diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs index d3877beb6..59d0f8dda 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs @@ -1,41 +1,23 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Karaoke.Configuration; -using osu.Game.Rulesets.Karaoke.Resources; -using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; +using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI; using osu.Game.Screens; namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment { public class SaitenAdjustmentScreen : OsuScreen { - private DependencyContainer dependencies; - - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - - [BackgroundDependencyLoader] - private void load(RulesetConfigCache configCache) + public SaitenAdjustmentScreen() { - var config = (KaraokeRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); - dependencies.Cache(new KaraokeSessionStatics(config, null)); - - var beatmap = KaraokeResources.OpenBeatmap("saiten-result"); - var workingBeatmap = new SaitenAdjustmentWorkingBeatmap(beatmap); - - var ruleset = new KaraokeRuleset(); - var drawableRuleset = ruleset.CreateDrawableRulesetWith(workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo)); - AddInternal(new Container { RelativeSizeAxes = Axes.Both, Children = new[] { - drawableRuleset + new SaitenAdjustmantmentVisualization() } }); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs deleted file mode 100644 index 85dee8908..000000000 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/DrawableSaitenAdjustmentRuleset.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Objects.Drawables; -using osu.Game.Rulesets.Karaoke.UI; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.UI; -using System.Collections.Generic; - -namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI -{ - public class DrawableSaitenAdjustmentRuleset : DrawableKaraokeRuleset - { - public DrawableSaitenAdjustmentRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) - : base(ruleset, beatmap, mods) - { - } - - protected override Playfield CreatePlayfield() => new NotePlayfield(9); - - public override DrawableHitObject CreateDrawableRepresentation(KaraokeHitObject h) - { - // Only get drawable note here - var drawableHitObject = base.CreateDrawableRepresentation(h); - if (drawableHitObject is DrawableNote) - return drawableHitObject; - - return null; - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs new file mode 100644 index 000000000..93e18e964 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs @@ -0,0 +1,75 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Karaoke.Objects; +using osu.Game.Rulesets.Karaoke.Objects.Drawables; +using osu.Game.Rulesets.Karaoke.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Configuration; +using osu.Game.Rulesets.Karaoke.Resources; +using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; +using osu.Game.Rulesets.Karaoke.Configuration; +using osu.Game.Rulesets.UI; + +namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI +{ + public class SaitenAdjustmantmentVisualization : Container + { + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + //var config = dependencies.Get().GetConfigFor(new KaraokeRuleset()); + //dependencies.Cache(config); + return dependencies; + } + + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets, RulesetConfigCache configCache) + { + var ruleset = rulesets.AvailableRulesets.FirstOrDefault(x => x.Name.ToLower().Contains("karaoke")).CreateInstance(); + var config = dependencies.Get().GetConfigFor(ruleset); + dependencies.Cache(config); + + var beatmap = KaraokeResources.OpenBeatmap("saiten-result"); + var workingBeatmap = new SaitenAdjustmentWorkingBeatmap(beatmap); + var convertedBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + + var drawableRuleset = new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null); + + Children = new[] + { + drawableRuleset + }; + } + + public class DrawableSaitenAdjustmentRuleset : DrawableKaraokeRuleset + { + public new NotePlayfield Playfield => (NotePlayfield)base.Playfield; + + public DrawableSaitenAdjustmentRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) + : base(ruleset, beatmap, mods) + { + } + + protected override Playfield CreatePlayfield() => new NotePlayfield(9); + + public override DrawableHitObject CreateDrawableRepresentation(KaraokeHitObject h) + { + // Only get drawable note here + var drawableHitObject = base.CreateDrawableRepresentation(h); + if (drawableHitObject is DrawableNote) + return drawableHitObject; + + return null; + } + } + } +} From 048dc30055b9e3628c2ee49d83166323fc58f0aa Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 14 Mar 2020 14:45:22 +0900 Subject: [PATCH 05/10] TODO : skin is not being applied --- .../SaitenAdjustment/SaitenAdjustmentScreen.cs | 5 ++++- .../UI/SaitenAdjustmantmentVisualization.cs | 18 ++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs index 59d0f8dda..dc104e9fc 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs @@ -17,7 +17,10 @@ public SaitenAdjustmentScreen() RelativeSizeAxes = Axes.Both, Children = new[] { - new SaitenAdjustmantmentVisualization() + new SaitenAdjustmantmentVisualization + { + RelativeSizeAxes = Axes.Both + } } }); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs index 93e18e964..e0e952f3a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs @@ -11,11 +11,9 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Game.Configuration; using osu.Game.Rulesets.Karaoke.Resources; using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; -using osu.Game.Rulesets.Karaoke.Configuration; -using osu.Game.Rulesets.UI; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI { @@ -26,8 +24,6 @@ public class SaitenAdjustmantmentVisualization : Container protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - //var config = dependencies.Get().GetConfigFor(new KaraokeRuleset()); - //dependencies.Cache(config); return dependencies; } @@ -42,25 +38,23 @@ private void load(RulesetStore rulesets, RulesetConfigCache configCache) var workingBeatmap = new SaitenAdjustmentWorkingBeatmap(beatmap); var convertedBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); - var drawableRuleset = new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null); - Children = new[] { - drawableRuleset + new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null) + { + RelativeSizeAxes = Axes.Both + } }; } public class DrawableSaitenAdjustmentRuleset : DrawableKaraokeRuleset { - public new NotePlayfield Playfield => (NotePlayfield)base.Playfield; - public DrawableSaitenAdjustmentRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) : base(ruleset, beatmap, mods) { + Playfield.LyricPlayfield.Hide(); } - protected override Playfield CreatePlayfield() => new NotePlayfield(9); - public override DrawableHitObject CreateDrawableRepresentation(KaraokeHitObject h) { // Only get drawable note here From 34c77dfa7fa1fe8d626982fa856de2e081ab41c0 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 14 Mar 2020 14:51:19 +0900 Subject: [PATCH 06/10] Apply skin source --- .../UI/SaitenAdjustmantmentVisualization.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs index e0e952f3a..4f9f53069 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs @@ -14,6 +14,8 @@ using osu.Game.Rulesets.Karaoke.Resources; using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; using osu.Framework.Graphics; +using osu.Game.Skinning; +using osu.Game.Rulesets.Karaoke.Skinning; namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI { @@ -38,11 +40,16 @@ private void load(RulesetStore rulesets, RulesetConfigCache configCache) var workingBeatmap = new SaitenAdjustmentWorkingBeatmap(beatmap); var convertedBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + var skin = new KaraokeLegacySkinTransformer(null); + Children = new[] { - new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null) + new SkinProvidingContainer(skin) { - RelativeSizeAxes = Axes.Both + Child = new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null) + { + RelativeSizeAxes = Axes.Both + } } }; } From 259c39682232611e7594dc750f6994054231254f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 14 Mar 2020 14:59:21 +0900 Subject: [PATCH 07/10] Clean-up code --- .../SaitenAdjustmentWorkingBeatmap.cs | 4 +-- .../SaitenAdjustmentScreen.cs | 2 +- ...on.cs => SaitenAdjustmentVisualization.cs} | 29 ++++++++++++++----- 3 files changed, 24 insertions(+), 11 deletions(-) rename osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/{SaitenAdjustmantmentVisualization.cs => SaitenAdjustmentVisualization.cs} (73%) diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs index 25bc8caf9..b06cd68b0 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs @@ -12,7 +12,7 @@ public class SaitenAdjustmentWorkingBeatmap : WorkingBeatmap { private readonly IBeatmap beatmap; - public SaitenAdjustmentWorkingBeatmap(Beatmap beatmap) + public SaitenAdjustmentWorkingBeatmap(IBeatmap beatmap) : base(beatmap.BeatmapInfo, null) { this.beatmap = beatmap; @@ -22,7 +22,7 @@ public SaitenAdjustmentWorkingBeatmap(Beatmap beatmap) protected override IBeatmap GetBeatmap() => beatmap; - // TODO : get real treak from resourse + // TODO : get real track from resource protected override Track GetTrack() => AudioManager.Tracks.GetVirtual(10000); protected override VideoSprite GetVideo() => null; diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs index dc104e9fc..5fbb29358 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/SaitenAdjustmentScreen.cs @@ -17,7 +17,7 @@ public SaitenAdjustmentScreen() RelativeSizeAxes = Axes.Both, Children = new[] { - new SaitenAdjustmantmentVisualization + new SaitenAdjustmentVisualization("saiten-result") { RelativeSizeAxes = Axes.Both } diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs similarity index 73% rename from osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs rename to osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs index 4f9f53069..6fc6314fb 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmantmentVisualization.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Game.Beatmaps; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Drawables; @@ -19,8 +20,15 @@ namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI { - public class SaitenAdjustmantmentVisualization : Container + public class SaitenAdjustmentVisualization : Container { + private readonly string beatmapName; + + public SaitenAdjustmentVisualization(string resourcesBeatmapName) + { + beatmapName = resourcesBeatmapName; + } + private DependencyContainer dependencies; protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -32,14 +40,21 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl [BackgroundDependencyLoader] private void load(RulesetStore rulesets, RulesetConfigCache configCache) { - var ruleset = rulesets.AvailableRulesets.FirstOrDefault(x => x.Name.ToLower().Contains("karaoke")).CreateInstance(); + // Get karaoke ruleset + var ruleset = rulesets.AvailableRulesets?.FirstOrDefault(x => x.Name.ToLower().Contains("karaoke"))?.CreateInstance(); + if (ruleset == null) + throw new ArgumentNullException($"{nameof(ruleset)} cannot be null."); + + // Cache var config = dependencies.Get().GetConfigFor(ruleset); dependencies.Cache(config); - var beatmap = KaraokeResources.OpenBeatmap("saiten-result"); + // Create beatmap + var beatmap = KaraokeResources.OpenBeatmap(beatmapName); var workingBeatmap = new SaitenAdjustmentWorkingBeatmap(beatmap); var convertedBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + // Create skin var skin = new KaraokeLegacySkinTransformer(null); Children = new[] @@ -54,11 +69,12 @@ private void load(RulesetStore rulesets, RulesetConfigCache configCache) }; } - public class DrawableSaitenAdjustmentRuleset : DrawableKaraokeRuleset + private class DrawableSaitenAdjustmentRuleset : DrawableKaraokeRuleset { public DrawableSaitenAdjustmentRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) : base(ruleset, beatmap, mods) { + // Hide lyric playfield Playfield.LyricPlayfield.Hide(); } @@ -66,10 +82,7 @@ public override DrawableHitObject CreateDrawableRepresentation { // Only get drawable note here var drawableHitObject = base.CreateDrawableRepresentation(h); - if (drawableHitObject is DrawableNote) - return drawableHitObject; - - return null; + return drawableHitObject is DrawableNote ? drawableHitObject : null; } } } From b51c4f9aeb88face4a36cf451f9d4f5ecffe2912 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 14 Mar 2020 15:07:25 +0900 Subject: [PATCH 08/10] Add session property --- .../SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs index 6fc6314fb..98de346a1 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Karaoke.Resources; using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; using osu.Framework.Graphics; +using osu.Game.Rulesets.Karaoke.Configuration; using osu.Game.Skinning; using osu.Game.Rulesets.Karaoke.Skinning; @@ -23,6 +24,9 @@ namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.UI public class SaitenAdjustmentVisualization : Container { private readonly string beatmapName; + private DrawableSaitenAdjustmentRuleset drawableRuleset; + + public KaraokeSessionStatics Session => drawableRuleset.Session; public SaitenAdjustmentVisualization(string resourcesBeatmapName) { @@ -61,7 +65,7 @@ private void load(RulesetStore rulesets, RulesetConfigCache configCache) { new SkinProvidingContainer(skin) { - Child = new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null) + Child = drawableRuleset = new DrawableSaitenAdjustmentRuleset(ruleset, convertedBeatmap, null) { RelativeSizeAxes = Axes.Both } From 47a5d103017b33ab557704ab703014c5c15fbb60 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 18 Mar 2020 23:06:54 +0900 Subject: [PATCH 09/10] Wait All the regist code can be removed? --- .../UI/SaitenAdjustmentVisualization.cs | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs index 98de346a1..9966bf48b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/UI/SaitenAdjustmentVisualization.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; using osu.Game.Beatmaps; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Drawables; @@ -9,13 +8,10 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using System.Collections.Generic; -using System.Linq; -using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Karaoke.Resources; using osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps; using osu.Framework.Graphics; -using osu.Game.Rulesets.Karaoke.Configuration; using osu.Game.Skinning; using osu.Game.Rulesets.Karaoke.Skinning; @@ -26,32 +22,12 @@ public class SaitenAdjustmentVisualization : Container private readonly string beatmapName; private DrawableSaitenAdjustmentRuleset drawableRuleset; - public KaraokeSessionStatics Session => drawableRuleset.Session; - public SaitenAdjustmentVisualization(string resourcesBeatmapName) { beatmapName = resourcesBeatmapName; - } - - private DependencyContainer dependencies; - - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - { - dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - return dependencies; - } - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets, RulesetConfigCache configCache) - { // Get karaoke ruleset - var ruleset = rulesets.AvailableRulesets?.FirstOrDefault(x => x.Name.ToLower().Contains("karaoke"))?.CreateInstance(); - if (ruleset == null) - throw new ArgumentNullException($"{nameof(ruleset)} cannot be null."); - - // Cache - var config = dependencies.Get().GetConfigFor(ruleset); - dependencies.Cache(config); + var ruleset = new KaraokeRuleset(); // Create beatmap var beatmap = KaraokeResources.OpenBeatmap(beatmapName); From a0fc6bf7a08d8d7150cbabf49265230757dd6064 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 14 May 2020 00:03:01 +0900 Subject: [PATCH 10/10] Fix compile error and remove extra setting in csproj --- .../osu.Game.Rulesets.Karaoke.Tests.csproj | 3 --- .../Beatmaps/SaitenAdjustmentWorkingBeatmap.cs | 3 --- 2 files changed, 6 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj b/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj index 7873f6303..3385311da 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj +++ b/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj @@ -19,9 +19,6 @@ - - - diff --git a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs index b06cd68b0..ea40586dd 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/SaitenAdjustment/Beatmaps/SaitenAdjustmentWorkingBeatmap.cs @@ -3,7 +3,6 @@ using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Video; using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Karaoke.Screens.SaitenAdjustment.Beatmaps @@ -24,7 +23,5 @@ public SaitenAdjustmentWorkingBeatmap(IBeatmap beatmap) // TODO : get real track from resource protected override Track GetTrack() => AudioManager.Tracks.GetVirtual(10000); - - protected override VideoSprite GetVideo() => null; } }