From 279a2844f045e7d699f88148c264d9fd38463709 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 16:08:37 +0900 Subject: [PATCH] Actually make ManiaHitObjectComposer constructible/testable --- .../TestCaseEditor.cs | 17 +++++++++++++++++ .../Edit/ManiaEditRulesetContainer.cs | 18 +----------------- .../Edit/ManiaHitObjectComposer.cs | 7 ++----- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 4 ++++ 4 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs new file mode 100644 index 0000000000..799bb9efd8 --- /dev/null +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Mania.Tests +{ + [TestFixture] + public class TestCaseEditor : EditorTestCase + { + public TestCaseEditor() + : base(new ManiaRuleset()) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index 442997f1f3..71ec668531 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -2,33 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaEditRulesetContainer : ManiaRulesetContainer { - public BindableBeatDivisor BeatDivisor; - - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) - { - BeatDivisor = beatDivisor; - } - - [BackgroundDependencyLoader] - private void load() - { - BeatDivisor.ValueChanged += OnBeatSnapDivisorChange; - OnBeatSnapDivisorChange(BeatDivisor.Value); - } - - public void OnBeatSnapDivisorChange(int newDivisor) { } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index f0e0f27818..d04c70ae16 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; using System.Collections.Generic; @@ -17,14 +16,12 @@ namespace osu.Game.Rulesets.Mania.Edit { public class ManiaHitObjectComposer : HitObjectComposer { - public BindableBeatDivisor BeatDivisor; - public ManiaHitObjectComposer(Ruleset ruleset, BindableBeatDivisor beatDivisor) + public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { - BeatDivisor = beatDivisor; } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap, BeatDivisor); + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] { diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 02ecb3afda..9d7c37d9e9 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -16,8 +16,10 @@ using osu.Game.Rulesets.Replays.Types; using osu.Game.Beatmaps.Legacy; using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Difficulty; +using osu.Game.Rulesets.Mania.Edit; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania @@ -28,6 +30,8 @@ public class ManiaRuleset : Ruleset public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap); public override PerformanceCalculator CreatePerformanceCalculator(IBeatmap beatmap, Score score) => new ManiaPerformanceCalculator(this, beatmap, score); + public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this); + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { if (mods.HasFlag(LegacyMods.Nightcore))