1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Remove beatmap argument in Note

This commit is contained in:
Justus Franklin Tumacder 2021-04-24 19:30:16 +08:00
parent 7e3a611f95
commit f9905ebe68
32 changed files with 99 additions and 183 deletions

View File

@ -4,12 +4,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -30,9 +28,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
[Cached(typeof(IScrollingInfo))] [Cached(typeof(IScrollingInfo))]
private IScrollingInfo scrollingInfo; private IScrollingInfo scrollingInfo;
[Cached]
protected readonly Bindable<ManiaColourCode> configColourCode = new Bindable<ManiaColourCode>();
protected ManiaPlacementBlueprintTestScene() protected ManiaPlacementBlueprintTestScene()
{ {
scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo; scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo;
@ -46,13 +41,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
}); });
} }
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCode, configColourCode);
}
protected override SnapResult SnapForBlueprint(PlacementBlueprint blueprint) protected override SnapResult SnapForBlueprint(PlacementBlueprint blueprint)
{ {
var time = column.TimeAtScreenSpacePosition(InputManager.CurrentState.Mouse.Position); var time = column.TimeAtScreenSpacePosition(InputManager.CurrentState.Mouse.Position);

View File

@ -2,10 +2,8 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using osuTK.Graphics; using osuTK.Graphics;
@ -17,9 +15,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
[Cached(Type = typeof(IAdjustableClock))] [Cached(Type = typeof(IAdjustableClock))]
private readonly IAdjustableClock clock = new StopwatchClock(); private readonly IAdjustableClock clock = new StopwatchClock();
[Cached]
protected readonly Bindable<ManiaColourCode> configColourCode = new Bindable<ManiaColourCode>();
protected ManiaSelectionBlueprintTestScene() protected ManiaSelectionBlueprintTestScene()
{ {
Add(new Column(0) Add(new Column(0)
@ -31,13 +26,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
}); });
} }
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCode, configColourCode);
}
public ManiaPlayfield Playfield => null; public ManiaPlayfield Playfield => null;
} }
} }

View File

@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
public class TestSceneHoldNotePlacementBlueprint : ManiaPlacementBlueprintTestScene public class TestSceneHoldNotePlacementBlueprint : ManiaPlacementBlueprintTestScene
{ {
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHoldNote((HoldNote)hitObject); protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHoldNote((HoldNote)hitObject);
protected override PlacementBlueprint CreateBlueprint() => new HoldNotePlacementBlueprint(null); protected override PlacementBlueprint CreateBlueprint() => new HoldNotePlacementBlueprint();
} }
} }

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
public TestSceneHoldNoteSelectionBlueprint() public TestSceneHoldNoteSelectionBlueprint()
{ {
var holdNote = new HoldNote(null) { Column = 0, Duration = 1000 }; var holdNote = new HoldNote { Column = 0, Duration = 1000 };
holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down) base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)

View File

@ -159,7 +159,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
AddStep("setup beatmap", () => AddStep("setup beatmap", () =>
{ {
composer.EditorBeatmap.Clear(); composer.EditorBeatmap.Clear();
composer.EditorBeatmap.Add(new HoldNote(Beatmap.Value.Beatmap) composer.EditorBeatmap.Add(new HoldNote
{ {
Column = 1, Column = 1,
EndTime = 200 EndTime = 200
@ -201,10 +201,9 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
public TestComposer() public TestComposer()
{ {
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 4 });
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
EditorBeatmap = new EditorBeatmap(beatmap) EditorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 }))
{ {
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo } BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }
}, },
@ -212,7 +211,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
}; };
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
EditorBeatmap.Add(new Note(beatmap) { StartTime = 125 * i }); EditorBeatmap.Add(new Note { StartTime = 125 * i });
} }
} }
} }

View File

@ -55,6 +55,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
private Note getNote() => this.ChildrenOfType<DrawableNote>().FirstOrDefault()?.HitObject; private Note getNote() => this.ChildrenOfType<DrawableNote>().FirstOrDefault()?.HitObject;
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableNote((Note)hitObject); protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableNote((Note)hitObject);
protected override PlacementBlueprint CreateBlueprint() => new NotePlacementBlueprint(null); protected override PlacementBlueprint CreateBlueprint() => new NotePlacementBlueprint();
} }
} }

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
public TestSceneNoteSelectionBlueprint() public TestSceneNoteSelectionBlueprint()
{ {
var note = new Note(null) { Column = 0 }; var note = new Note { Column = 0 };
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
DrawableNote drawableObject; DrawableNote drawableObject;

View File

@ -1,21 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests namespace osu.Game.Rulesets.Mania.Tests
{ {
public abstract class ManiaInputTestScene : OsuTestScene public abstract class ManiaInputTestScene : OsuTestScene
{ {
[Cached]
protected readonly Bindable<ManiaColourCode> configColourCode = new Bindable<ManiaColourCode>();
private readonly Container<Drawable> content; private readonly Container<Drawable> content;
protected override Container<Drawable> Content => content ?? base.Content; protected override Container<Drawable> Content => content ?? base.Content;
@ -24,13 +18,6 @@ namespace osu.Game.Rulesets.Mania.Tests
base.Content.Add(content = new LocalInputManager(keys)); base.Content.Add(content = new LocalInputManager(keys));
} }
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCode, configColourCode);
}
private class LocalInputManager : ManiaInputManager private class LocalInputManager : ManiaInputManager
{ {
public LocalInputManager(int variant) public LocalInputManager(int variant)

View File

@ -19,10 +19,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
[TestCase(false)] [TestCase(false)]
[TestCase(true)] [TestCase(true)]
public void TestNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Note(Beatmap.Value.Beatmap) { StartTime = 1000 }), shouldMiss); public void TestNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Note { StartTime = 1000 }), shouldMiss);
[TestCase(false)] [TestCase(false)]
[TestCase(true)] [TestCase(true)]
public void TestHoldNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new HoldNote(Beatmap.Value.Beatmap) { StartTime = 1000, EndTime = 3000 }), shouldMiss); public void TestHoldNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new HoldNote { StartTime = 1000, EndTime = 3000 }), shouldMiss);
} }
} }

View File

@ -7,8 +7,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.UI.Scrolling.Algorithms; using osu.Game.Rulesets.UI.Scrolling.Algorithms;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -26,9 +24,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[Cached(Type = typeof(IScrollingInfo))] [Cached(Type = typeof(IScrollingInfo))]
private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo(); private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo();
[Cached]
protected readonly Bindable<ManiaColourCode> configColourCode = new Bindable<ManiaColourCode>();
protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset(); protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();
protected ManiaSkinnableTestScene() protected ManiaSkinnableTestScene()
@ -43,13 +38,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
}); });
} }
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCode, configColourCode);
}
[Test] [Test]
public void TestScrollingDown() public void TestScrollingDown()
{ {

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
protected override DrawableManiaHitObject CreateHitObject() protected override DrawableManiaHitObject CreateHitObject()
{ {
var note = new HoldNote(Beatmap.Value.Beatmap) { Duration = 1000 }; var note = new HoldNote { Duration = 1000 };
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
return new DrawableHoldNote(note); return new DrawableHoldNote(note);

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
protected override DrawableManiaHitObject CreateHitObject() protected override DrawableManiaHitObject CreateHitObject()
{ {
var note = new Note(Beatmap.Value.Beatmap); var note = new Note();
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
return new DrawableNote(note); return new DrawableNote(note);

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | // | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 1 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 1 });
beatmap.HitObjects.Add(new Note(beatmap) { StartTime = 1000 }); beatmap.HitObjects.Add(new Note { StartTime = 1000 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | // | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 1 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 1 });
beatmap.HitObjects.Add(new HoldNote(beatmap) { StartTime = 1000, Duration = 2000 }); beatmap.HitObjects.Add(new HoldNote { StartTime = 1000, Duration = 2000 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();
@ -69,8 +69,8 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | | // | | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 });
beatmap.HitObjects.Add(new Note(beatmap) { StartTime = 1000 }); beatmap.HitObjects.Add(new Note { StartTime = 1000 });
beatmap.HitObjects.Add(new Note(beatmap) { StartTime = 1000, Column = 1 }); beatmap.HitObjects.Add(new Note { StartTime = 1000, Column = 1 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();
@ -91,8 +91,8 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | | // | | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 });
beatmap.HitObjects.Add(new HoldNote(beatmap) { StartTime = 1000, Duration = 2000 }); beatmap.HitObjects.Add(new HoldNote { StartTime = 1000, Duration = 2000 });
beatmap.HitObjects.Add(new HoldNote(beatmap) { StartTime = 1000, Duration = 2000, Column = 1 }); beatmap.HitObjects.Add(new HoldNote { StartTime = 1000, Duration = 2000, Column = 1 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();
@ -114,8 +114,8 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | | // | | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 });
beatmap.HitObjects.Add(new Note(beatmap) { StartTime = 1000 }); beatmap.HitObjects.Add(new Note { StartTime = 1000 });
beatmap.HitObjects.Add(new Note(beatmap) { StartTime = 2000, Column = 1 }); beatmap.HitObjects.Add(new Note { StartTime = 2000, Column = 1 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();
@ -141,8 +141,8 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | | // | | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 });
beatmap.HitObjects.Add(new HoldNote(beatmap) { StartTime = 1000, Duration = 2000 }); beatmap.HitObjects.Add(new HoldNote { StartTime = 1000, Duration = 2000 });
beatmap.HitObjects.Add(new HoldNote(beatmap) { StartTime = 2000, Duration = 2000, Column = 1 }); beatmap.HitObjects.Add(new HoldNote { StartTime = 2000, Duration = 2000, Column = 1 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();
@ -168,8 +168,8 @@ namespace osu.Game.Rulesets.Mania.Tests
// | | | // | | |
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 }); var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 2 });
beatmap.HitObjects.Add(new HoldNote(beatmap) { StartTime = 1000, Duration = 2000 }); beatmap.HitObjects.Add(new HoldNote { StartTime = 1000, Duration = 2000 });
beatmap.HitObjects.Add(new Note(beatmap) { StartTime = 3000, Column = 1 }); beatmap.HitObjects.Add(new Note { StartTime = 3000, Column = 1 });
var generated = new ManiaAutoGenerator(beatmap).Generate(); var generated = new ManiaAutoGenerator(beatmap).Generate();

View File

@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
for (int i = 0; i < columns.Count; i++) for (int i = 0; i < columns.Count; i++)
{ {
var obj = new Note(null) { Column = i, StartTime = Time.Current + 2000 }; var obj = new Note { Column = i, StartTime = Time.Current + 2000 };
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
columns[i].Add(new DrawableNote(obj)); columns[i].Add(new DrawableNote(obj));
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
for (int i = 0; i < columns.Count; i++) for (int i = 0; i < columns.Count; i++)
{ {
var obj = new HoldNote(null) { Column = i, StartTime = Time.Current + 2000, Duration = 500 }; var obj = new HoldNote { Column = i, StartTime = Time.Current + 2000, Duration = 500 };
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
columns[i].Add(new DrawableHoldNote(obj)); columns[i].Add(new DrawableHoldNote(obj));

View File

@ -249,6 +249,21 @@ namespace osu.Game.Rulesets.Mania.Tests
var beatmap = new Beatmap<ManiaHitObject> var beatmap = new Beatmap<ManiaHitObject>
{ {
HitObjects =
{
new HoldNote
{
StartTime = 1000,
Duration = 500,
Column = 0,
},
new HoldNote
{
StartTime = 1000 + 500 + windows.WindowFor(HitResult.Miss) + 10,
Duration = 500,
Column = 0,
},
},
BeatmapInfo = BeatmapInfo =
{ {
BaseDifficulty = new BeatmapDifficulty BaseDifficulty = new BeatmapDifficulty
@ -259,20 +274,6 @@ namespace osu.Game.Rulesets.Mania.Tests
Ruleset = new ManiaRuleset().RulesetInfo Ruleset = new ManiaRuleset().RulesetInfo
}, },
}; };
beatmap.HitObjects = new List<ManiaHitObject> {
new HoldNote(beatmap)
{
StartTime = 1000,
Duration = 500,
Column = 0,
},
new HoldNote(beatmap)
{
StartTime = 1000 + 500 + windows.WindowFor(HitResult.Miss) + 10,
Duration = 500,
Column = 0,
},
};
performTest(new List<ReplayFrame> performTest(new List<ReplayFrame>
{ {
@ -296,21 +297,21 @@ namespace osu.Game.Rulesets.Mania.Tests
var beatmap = new Beatmap<ManiaHitObject> var beatmap = new Beatmap<ManiaHitObject>
{ {
HitObjects =
{
new HoldNote
{
StartTime = time_head,
Duration = time_tail - time_head,
Column = 0,
}
},
BeatmapInfo = BeatmapInfo =
{ {
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = tick_rate }, BaseDifficulty = new BeatmapDifficulty { SliderTickRate = tick_rate },
Ruleset = new ManiaRuleset().RulesetInfo Ruleset = new ManiaRuleset().RulesetInfo
}, },
}; };
beatmap.HitObjects = new List<ManiaHitObject>
{
new HoldNote(beatmap)
{
StartTime = time_head,
Duration = time_tail - time_head,
Column = 0,
}
};
performTest(new List<ReplayFrame> performTest(new List<ReplayFrame>
{ {
@ -328,17 +329,17 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
var beatmap = new Beatmap<ManiaHitObject> var beatmap = new Beatmap<ManiaHitObject>
{ {
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }, HitObjects =
};
beatmap.HitObjects = new List<ManiaHitObject>
{ {
new HoldNote(beatmap) new HoldNote
{ {
StartTime = 1000, StartTime = 1000,
Duration = 0, Duration = 0,
Column = 0, Column = 0,
}, },
}; },
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
};
performTest(new List<ReplayFrame> performTest(new List<ReplayFrame>
{ {
@ -373,21 +374,21 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
beatmap = new Beatmap<ManiaHitObject> beatmap = new Beatmap<ManiaHitObject>
{ {
HitObjects =
{
new HoldNote
{
StartTime = time_head,
Duration = time_tail - time_head,
Column = 0,
}
},
BeatmapInfo = BeatmapInfo =
{ {
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 4 }, BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 4 },
Ruleset = new ManiaRuleset().RulesetInfo Ruleset = new ManiaRuleset().RulesetInfo
}, },
}; };
beatmap.HitObjects = new List<ManiaHitObject>
{
new HoldNote(beatmap)
{
StartTime = time_head,
Duration = time_tail - time_head,
Column = 0,
}
};
beatmap.ControlPointInfo.Add(0, new DifficultyControlPoint { SpeedMultiplier = 0.1f }); beatmap.ControlPointInfo.Add(0, new DifficultyControlPoint { SpeedMultiplier = 0.1f });
} }

View File

@ -15,10 +15,8 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
@ -31,10 +29,6 @@ namespace osu.Game.Rulesets.Mania.Tests
[TestFixture] [TestFixture]
public class TestSceneNotes : OsuTestScene public class TestSceneNotes : OsuTestScene
{ {
[Cached]
protected readonly Bindable<ManiaColourCode> configColourCode = new Bindable<ManiaColourCode>();
[Test] [Test]
public void TestVariousNotes() public void TestVariousNotes()
{ {
@ -69,16 +63,9 @@ namespace osu.Game.Rulesets.Mania.Tests
AddAssert("hold note 2 facing upwards", () => verifyAnchors(holdNote2, Anchor.y0)); AddAssert("hold note 2 facing upwards", () => verifyAnchors(holdNote2, Anchor.y0));
} }
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCode, configColourCode);
}
private Drawable createNoteDisplay(ScrollingDirection direction, int identifier, out DrawableNote hitObject) private Drawable createNoteDisplay(ScrollingDirection direction, int identifier, out DrawableNote hitObject)
{ {
var note = new Note(null) { StartTime = 0 }; var note = new Note { StartTime = 0 };
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
return new ScrollingTestContainer(direction) return new ScrollingTestContainer(direction)
@ -93,7 +80,7 @@ namespace osu.Game.Rulesets.Mania.Tests
private Drawable createHoldNoteDisplay(ScrollingDirection direction, int identifier, out DrawableHoldNote hitObject) private Drawable createHoldNoteDisplay(ScrollingDirection direction, int identifier, out DrawableHoldNote hitObject)
{ {
var note = new HoldNote(null) { StartTime = 0, Duration = 5000 }; var note = new HoldNote { StartTime = 0, Duration = 5000 };
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
return new ScrollingTestContainer(direction) return new ScrollingTestContainer(direction)

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
double time = 1000 + i * 100; double time = 1000 + i * 100;
objects.Add(new Note(Beatmap.Value.Beatmap) { StartTime = time }); objects.Add(new Note { StartTime = time });
// don't hit the first note // don't hit the first note
if (i > 0) if (i > 0)
@ -60,12 +60,12 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
var objects = new List<ManiaHitObject> var objects = new List<ManiaHitObject>
{ {
new HoldNote(Beatmap.Value.Beatmap) new HoldNote
{ {
StartTime = 1000, StartTime = 1000,
EndTime = 1010, EndTime = 1010,
}, },
new HoldNote(Beatmap.Value.Beatmap) new HoldNote
{ {
StartTime = 1020, StartTime = 1020,
EndTime = 1030 EndTime = 1030
@ -83,12 +83,12 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
var objects = new List<ManiaHitObject> var objects = new List<ManiaHitObject>
{ {
new HoldNote(Beatmap.Value.Beatmap) new HoldNote
{ {
StartTime = 1000, StartTime = 1000,
EndTime = 1010, EndTime = 1010,
}, },
new HoldNote(Beatmap.Value.Beatmap) new HoldNote
{ {
StartTime = 1020, StartTime = 1020,
EndTime = 1030 EndTime = 1030

View File

@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
for (int i = 0; i < stage.Columns.Count; i++) for (int i = 0; i < stage.Columns.Count; i++)
{ {
var obj = new Note(null) { Column = i, StartTime = Time.Current + 2000 }; var obj = new Note { Column = i, StartTime = Time.Current + 2000 };
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
stage.Add(new DrawableNote(obj)); stage.Add(new DrawableNote(obj));
@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
for (int i = 0; i < stage.Columns.Count; i++) for (int i = 0; i < stage.Columns.Count; i++)
{ {
var obj = new HoldNote(null) { Column = i, StartTime = Time.Current + 2000, Duration = 500 }; var obj = new HoldNote { Column = i, StartTime = Time.Current + 2000, Duration = 500 };
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
stage.Add(new DrawableHoldNote(obj)); stage.Add(new DrawableHoldNote(obj));

View File

@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
if (HitObject is IHasDuration endTimeData) if (HitObject is IHasDuration endTimeData)
{ {
pattern.Add(new HoldNote(Beatmap) pattern.Add(new HoldNote
{ {
StartTime = HitObject.StartTime, StartTime = HitObject.StartTime,
Duration = endTimeData.Duration, Duration = endTimeData.Duration,
@ -258,7 +258,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
} }
else if (HitObject is IHasXPosition) else if (HitObject is IHasXPosition)
{ {
pattern.Add(new Note(Beatmap) pattern.Add(new Note
{ {
StartTime = HitObject.StartTime, StartTime = HitObject.StartTime,
Samples = HitObject.Samples, Samples = HitObject.Samples,

View File

@ -512,7 +512,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (startTime == endTime) if (startTime == endTime)
{ {
newObject = new Note(Beatmap) newObject = new Note
{ {
StartTime = startTime, StartTime = startTime,
Samples = sampleInfoListAt(startTime), Samples = sampleInfoListAt(startTime),
@ -521,7 +521,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
} }
else else
{ {
newObject = new HoldNote(Beatmap) newObject = new HoldNote
{ {
StartTime = startTime, StartTime = startTime,
Duration = endTime - startTime, Duration = endTime - startTime,

View File

@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (holdNote) if (holdNote)
{ {
newObject = new HoldNote(Beatmap) newObject = new HoldNote
{ {
StartTime = HitObject.StartTime, StartTime = HitObject.StartTime,
Duration = endTime - HitObject.StartTime, Duration = endTime - HitObject.StartTime,
@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
} }
else else
{ {
newObject = new Note(Beatmap) newObject = new Note
{ {
StartTime = HitObject.StartTime, StartTime = HitObject.StartTime,
Samples = HitObject.Samples, Samples = HitObject.Samples,

View File

@ -441,7 +441,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
/// <param name="column">The column to add the note to.</param> /// <param name="column">The column to add the note to.</param>
private void addToPattern(Pattern pattern, int column) private void addToPattern(Pattern pattern, int column)
{ {
pattern.Add(new Note(Beatmap) pattern.Add(new Note
{ {
StartTime = HitObject.StartTime, StartTime = HitObject.StartTime,
Samples = HitObject.Samples, Samples = HitObject.Samples,

View File

@ -5,7 +5,6 @@ using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
@ -24,8 +23,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
[Resolved] [Resolved]
private IScrollingInfo scrollingInfo { get; set; } private IScrollingInfo scrollingInfo { get; set; }
public HoldNotePlacementBlueprint(IBeatmap beatmap) public HoldNotePlacementBlueprint()
: base(new HoldNote(beatmap)) : base(new HoldNote())
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
@ -15,8 +14,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{ {
private readonly EditNotePiece piece; private readonly EditNotePiece piece;
public NotePlacementBlueprint(IBeatmap beatmap) public NotePlacementBlueprint()
: base(new Note(beatmap)) : base(new Note())
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;

View File

@ -5,22 +5,19 @@ using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Edit.Blueprints;
namespace osu.Game.Rulesets.Mania.Edit namespace osu.Game.Rulesets.Mania.Edit
{ {
public class HoldNoteCompositionTool : HitObjectCompositionTool public class HoldNoteCompositionTool : HitObjectCompositionTool
{ {
private ManiaBeatmap Beatmap; public HoldNoteCompositionTool()
public HoldNoteCompositionTool(ManiaBeatmap beatmap)
: base("Hold") : base("Hold")
{ {
Beatmap = beatmap;
} }
public override Drawable CreateIcon() => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders); public override Drawable CreateIcon() => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders);
public override PlacementBlueprint CreatePlacementBlueprint() => new HoldNotePlacementBlueprint(Beatmap); public override PlacementBlueprint CreatePlacementBlueprint() => new HoldNotePlacementBlueprint();
} }
} }

View File

@ -93,8 +93,8 @@ namespace osu.Game.Rulesets.Mania.Edit
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[] protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
{ {
new NoteCompositionTool(drawableRuleset.Beatmap), new NoteCompositionTool(),
new HoldNoteCompositionTool(drawableRuleset.Beatmap) new HoldNoteCompositionTool()
}; };
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()

View File

@ -5,7 +5,6 @@ using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Edit.Blueprints;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
@ -13,16 +12,13 @@ namespace osu.Game.Rulesets.Mania.Edit
{ {
public class NoteCompositionTool : HitObjectCompositionTool public class NoteCompositionTool : HitObjectCompositionTool
{ {
private ManiaBeatmap Beatmap; public NoteCompositionTool()
public NoteCompositionTool(ManiaBeatmap beatmap)
: base(nameof(Note)) : base(nameof(Note))
{ {
Beatmap = beatmap;
} }
public override Drawable CreateIcon() => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles); public override Drawable CreateIcon() => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles);
public override PlacementBlueprint CreatePlacementBlueprint() => new NotePlacementBlueprint(Beatmap); public override PlacementBlueprint CreatePlacementBlueprint() => new NotePlacementBlueprint();
} }
} }

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Mods
// Decrease the duration by at most a 1/4 beat to ensure there's no instantaneous notes. // Decrease the duration by at most a 1/4 beat to ensure there's no instantaneous notes.
duration = Math.Max(duration / 2, duration - beatLength / 4); duration = Math.Max(duration / 2, duration - beatLength / 4);
newColumnObjects.Add(new HoldNote(maniaBeatmap) newColumnObjects.Add(new HoldNote
{ {
Column = column.Key, Column = column.Key,
StartTime = locations[i].startTime, StartTime = locations[i].startTime,

View File

@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Mania.Objects
/// </summary> /// </summary>
public class HoldNote : ManiaHitObject, IHasDuration public class HoldNote : ManiaHitObject, IHasDuration
{ {
public IBeatmap Beatmap;
public double EndTime public double EndTime
{ {
get => StartTime + Duration; get => StartTime + Duration;
@ -86,11 +84,6 @@ namespace osu.Game.Rulesets.Mania.Objects
/// </summary> /// </summary>
private double tickSpacing = 50; private double tickSpacing = 50;
public HoldNote(IBeatmap beatmap) : base()
{
Beatmap = beatmap;
}
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{ {
base.ApplyDefaultsToSelf(controlPointInfo, difficulty); base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
@ -105,14 +98,14 @@ namespace osu.Game.Rulesets.Mania.Objects
createTicks(cancellationToken); createTicks(cancellationToken);
AddNested(Head = new Note(Beatmap) AddNested(Head = new Note
{ {
StartTime = StartTime, StartTime = StartTime,
Column = Column, Column = Column,
Samples = GetNodeSamples(0), Samples = GetNodeSamples(0),
}); });
AddNested(Tail = new TailNote(Beatmap) AddNested(Tail = new TailNote
{ {
StartTime = EndTime, StartTime = EndTime,
Column = Column, Column = Column,

View File

@ -28,9 +28,8 @@ namespace osu.Game.Rulesets.Mania.Objects
set => SnapBindable.Value = value; set => SnapBindable.Value = value;
} }
public Note(IBeatmap beatmap) : base() public Note()
{ {
Beatmap = beatmap;
this.StartTimeBindable.BindValueChanged(_ => SnapToBeatmap(), true); this.StartTimeBindable.BindValueChanged(_ => SnapToBeatmap(), true);
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Judgements;
@ -9,10 +8,6 @@ namespace osu.Game.Rulesets.Mania.Objects
{ {
public class TailNote : Note public class TailNote : Note
{ {
public TailNote(IBeatmap beatmap) : base(beatmap)
{
}
public override Judgement CreateJudgement() => new ManiaJudgement(); public override Judgement CreateJudgement() => new ManiaJudgement();
} }
} }

View File

@ -140,12 +140,12 @@ namespace osu.Game.Tests.Visual.Collections
AddStep("add dropdown", () => AddStep("add dropdown", () =>
{ {
Add(new CollectionFilterDropdown Add(new CollectionFilterDropdown
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Width = 0.4f, Width = 0.4f,
} }
); );
}); });
AddStep("add two collections with same name", () => manager.Collections.AddRange(new[] AddStep("add two collections with same name", () => manager.Collections.AddRange(new[]