From 592e05a2c8f44ceb66eb4d5458b824f0513a079b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sun, 12 Mar 2017 00:34:21 +0900 Subject: [PATCH 1/7] Better beatmap conversion model. --- .../Beatmaps/CatchBeatmapConverter.cs | 21 ++++++ .../CatchDifficultyCalculator.cs | 3 - osu.Game.Modes.Catch/CatchRuleset.cs | 6 ++ osu.Game.Modes.Catch/UI/CatchHitRenderer.cs | 3 - .../osu.Game.Modes.Catch.csproj | 1 + .../Beatmaps/ManiaBeatmapConverter.cs | 21 ++++++ .../ManiaDifficultyCalculator.cs | 3 - osu.Game.Modes.Mania/ManiaRuleset.cs | 6 ++ osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs | 3 - .../osu.Game.Modes.Mania.csproj | 2 + .../OsuBeatmapConverter.cs} | 39 +++++++---- osu.Game.Modes.Osu/OsuDifficultyCalculator.cs | 3 - osu.Game.Modes.Osu/OsuRuleset.cs | 6 ++ osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 3 - osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 2 +- .../Beatmaps/TaikoBeatmapConverter.cs | 20 ++++++ .../TaikoDifficultyCalculator.cs | 3 - osu.Game.Modes.Taiko/TaikoRuleset.cs | 6 ++ osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 3 - .../osu.Game.Modes.Taiko.csproj | 1 + osu.Game/Beatmaps/Beatmap.cs | 68 ++++++++++++++++--- osu.Game/Beatmaps/DifficultyCalculator.cs | 4 +- osu.Game/Beatmaps/IBeatmapCoverter.cs | 12 ++++ osu.Game/Modes/Ruleset.cs | 2 + osu.Game/Modes/UI/HitRenderer.cs | 20 ++---- osu.Game/osu.Game.csproj | 1 + 26 files changed, 196 insertions(+), 66 deletions(-) create mode 100644 osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs create mode 100644 osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs rename osu.Game.Modes.Osu/{Objects/OsuHitObjectConverter.cs => Beatmaps/OsuBeatmapConverter.cs} (87%) create mode 100644 osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs create mode 100644 osu.Game/Beatmaps/IBeatmapCoverter.cs diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs new file mode 100644 index 0000000000..6460751570 --- /dev/null +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Objects; +using System.Collections.Generic; + +namespace osu.Game.Modes.Catch.Beatmaps +{ + internal class CatchBeatmapConverter : IBeatmapConverter + { + public Beatmap Convert(Beatmap original) + { + return new Beatmap(original) + { + HitObjects = new List() // Todo: Convert HitObjects + }; + } + } +} diff --git a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs index ccc4097d59..01fa1a00d4 100644 --- a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs +++ b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs @@ -3,7 +3,6 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Objects; using System; using System.Collections.Generic; @@ -17,8 +16,6 @@ namespace osu.Game.Modes.Catch { } - protected override HitObjectConverter Converter => new CatchConverter(); - protected override double CalculateInternal(Dictionary categoryDifficulty) { return 0; diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 08edeb7bcb..2cdd35cf3a 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -4,6 +4,7 @@ using OpenTK.Input; using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Modes.Catch.Beatmaps; using osu.Game.Modes.Catch.UI; using osu.Game.Modes.Objects; using osu.Game.Modes.UI; @@ -91,5 +92,10 @@ namespace osu.Game.Modes.Catch public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new CatchDifficultyCalculator(beatmap); + + public override IBeatmapConverter CreateBeatmapConverter() + { + return (IBeatmapConverter)new CatchBeatmapConverter(); + } } } diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index ed0c8b4747..703eb6fe91 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -3,7 +3,6 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; @@ -16,8 +15,6 @@ namespace osu.Game.Modes.Catch.UI { } - protected override HitObjectConverter Converter => new CatchConverter(); - protected override Playfield CreatePlayfield() => new CatchPlayfield(); protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h); diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index 663d12bb4d..10abb312fc 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -47,6 +47,7 @@ + diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs new file mode 100644 index 0000000000..0f42da4ac8 --- /dev/null +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +using osu.Game.Beatmaps; +using osu.Game.Modes.Mania.Objects; +using System.Collections.Generic; + +namespace osu.Game.Modes.Mania.Beatmaps +{ + internal class ManiaBeatmapConverter : IBeatmapConverter + { + public Beatmap Convert(Beatmap original) + { + return new Beatmap(original) + { + HitObjects = new List() // Todo: Implement + }; + } + } +} diff --git a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs index 975b78c215..07c0749904 100644 --- a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs @@ -3,7 +3,6 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.Objects; using System; using System.Collections.Generic; @@ -20,8 +19,6 @@ namespace osu.Game.Modes.Mania this.columns = columns; } - protected override HitObjectConverter Converter => new ManiaConverter(columns); - protected override double CalculateInternal(Dictionary categoryDifficulty) { return 0; diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index e6e9cfd799..7d88942798 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -3,6 +3,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Modes.Mania.Beatmaps; using osu.Game.Modes.Mania.UI; using osu.Game.Modes.Objects; using osu.Game.Modes.UI; @@ -106,5 +107,10 @@ namespace osu.Game.Modes.Mania public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new ManiaDifficultyCalculator(beatmap); + + public override IBeatmapConverter CreateBeatmapConverter() + { + return (IBeatmapConverter)new ManiaBeatmapConverter(); + } } } diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs index 82dd2f2eeb..33b82738f8 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs @@ -3,7 +3,6 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; @@ -19,8 +18,6 @@ namespace osu.Game.Modes.Mania.UI this.columns = columns; } - protected override HitObjectConverter Converter => new ManiaConverter(columns); - protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns); protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h) diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index 354f0b8541..66e46f9e48 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -47,6 +47,7 @@ + @@ -85,6 +86,7 @@ +