mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 04:43:22 +08:00
Add basic setup for TaikoHitObjectComposer
This commit is contained in:
parent
9b277d52e5
commit
7d4e60f05e
@ -0,0 +1,58 @@
|
||||
// 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.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneTaikoHitObjectComposer : EditorClockTestScene
|
||||
{
|
||||
private TestComposer composer;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
BeatDivisor.Value = 8;
|
||||
Clock.Seek(0);
|
||||
|
||||
Child = composer = new TestComposer { RelativeSizeAxes = Axes.Both };
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void BasicTest()
|
||||
{
|
||||
}
|
||||
|
||||
private class TestComposer : CompositeDrawable
|
||||
{
|
||||
[Cached(typeof(EditorBeatmap))]
|
||||
[Cached(typeof(IBeatSnapProvider))]
|
||||
public readonly EditorBeatmap EditorBeatmap;
|
||||
|
||||
public readonly TaikoHitObjectComposer Composer;
|
||||
|
||||
public TestComposer()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
EditorBeatmap = new EditorBeatmap(new TaikoBeatmap())
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo }
|
||||
},
|
||||
Composer = new TaikoHitObjectComposer(new TaikoRuleset())
|
||||
};
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
EditorBeatmap.Add(new Hit { StartTime = 125 * i });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
osu.Game.Rulesets.Taiko/TaikoHitObjectComposer.cs
Normal file
34
osu.Game.Rulesets.Taiko/TaikoHitObjectComposer.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.UI;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko
|
||||
{
|
||||
public class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject>
|
||||
{
|
||||
private DrawableTaikoRuleset drawableRuleset;
|
||||
|
||||
public TaikoHitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new List<HitObjectCompositionTool>();
|
||||
|
||||
protected override ComposeBlueprintContainer CreateBlueprintContainer() => new ComposeBlueprintContainer(drawableRuleset.Playfield.AllHitObjects);
|
||||
|
||||
protected override DrawableRuleset<TaikoHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||
{
|
||||
return drawableRuleset = new DrawableTaikoRuleset(ruleset, beatmap, mods);
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ using osu.Game.Rulesets.Taiko.Difficulty;
|
||||
using osu.Game.Rulesets.Taiko.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using System;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Taiko.Skinning;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -144,6 +145,8 @@ namespace osu.Game.Rulesets.Taiko
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = OsuIcon.RulesetTaiko };
|
||||
|
||||
public override HitObjectComposer CreateHitObjectComposer() => new TaikoHitObjectComposer(this);
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap);
|
||||
|
||||
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new TaikoPerformanceCalculator(this, beatmap, score);
|
||||
|
Loading…
Reference in New Issue
Block a user