2021-04-21 14:14:31 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-07-11 00:00:48 +08:00
|
|
|
using System.Diagnostics;
|
2021-04-21 14:14:31 +08:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2021-08-02 18:39:30 +08:00
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
using osu.Game.Rulesets.Taiko.UI;
|
|
|
|
using osu.Game.Rulesets.UI;
|
2021-04-21 14:14:31 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Mods
|
|
|
|
{
|
2021-08-02 18:39:30 +08:00
|
|
|
public class TaikoModClassic : ModClassic, IApplicableToDrawableRuleset<TaikoHitObject>, IUpdatableByPlayfield
|
2021-04-21 14:14:31 +08:00
|
|
|
{
|
2022-07-11 00:00:48 +08:00
|
|
|
private DrawableTaikoRuleset? drawableTaikoRuleset;
|
2021-08-02 18:39:30 +08:00
|
|
|
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
|
|
|
{
|
|
|
|
drawableTaikoRuleset = (DrawableTaikoRuleset)drawableRuleset;
|
2022-03-13 13:21:52 +08:00
|
|
|
drawableTaikoRuleset.LockPlayfieldAspect.Value = false;
|
2022-04-03 06:31:51 +08:00
|
|
|
|
|
|
|
var playfield = (TaikoPlayfield)drawableRuleset.Playfield;
|
|
|
|
playfield.ClassicHitTargetPosition.Value = true;
|
2021-08-02 18:39:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Update(Playfield playfield)
|
|
|
|
{
|
2022-07-11 00:00:48 +08:00
|
|
|
Debug.Assert(drawableTaikoRuleset != null);
|
|
|
|
|
2021-08-02 18:39:30 +08:00
|
|
|
// Classic taiko scrolls at a constant 100px per 1000ms. More notes become visible as the playfield is lengthened.
|
|
|
|
const float scroll_rate = 10;
|
|
|
|
|
|
|
|
// Since the time range will depend on a positional value, it is referenced to the x480 pixel space.
|
|
|
|
float ratio = drawableTaikoRuleset.DrawHeight / 480;
|
|
|
|
|
|
|
|
drawableTaikoRuleset.TimeRange.Value = (playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate;
|
|
|
|
}
|
2021-04-21 14:14:31 +08:00
|
|
|
}
|
|
|
|
}
|