mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 17:27:24 +08:00
add TaikoModColorBind
This commit is contained in:
parent
7ce7846b01
commit
0219815a46
@ -0,0 +1,19 @@
|
|||||||
|
// 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.Game.Rulesets.Taiko.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
||||||
|
{
|
||||||
|
public partial class TestSceneTaikoModColorBind : TaikoModTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestColorBind() => CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new TaikoModColorBind(),
|
||||||
|
Autoplay = true,
|
||||||
|
PassCondition = () => true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
72
osu.Game.Rulesets.Taiko/Mods/TaikoModColorBind.cs
Normal file
72
osu.Game.Rulesets.Taiko/Mods/TaikoModColorBind.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
|
{
|
||||||
|
public class TaikoModColorBind : ModWithVisibilityAdjustment, IApplicableToDrawableRuleset<TaikoHitObject>
|
||||||
|
{
|
||||||
|
public override string Name => "ColorBind";
|
||||||
|
public override string Acronym => "CB";
|
||||||
|
|
||||||
|
public override LocalisableString Description => @"What these notes color?";
|
||||||
|
|
||||||
|
public override double ScoreMultiplier => 1.03;
|
||||||
|
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(TaikoModHidden) };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How far away from the hit target should hitobjects start to lose color.
|
||||||
|
/// Range: [0, 1]
|
||||||
|
/// </summary>
|
||||||
|
private const float fade_out_start_time = 1f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How long hitobjects take to lose color, in terms of the scrolling length.
|
||||||
|
/// Range: [0, 1]
|
||||||
|
/// </summary>
|
||||||
|
private const float fade_out_duration = 0.375f;
|
||||||
|
|
||||||
|
private DrawableTaikoRuleset drawableRuleset = null!;
|
||||||
|
|
||||||
|
public void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
||||||
|
{
|
||||||
|
this.drawableRuleset = (DrawableTaikoRuleset)drawableRuleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
ApplyNormalVisibilityState(hitObject, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
switch (hitObject)
|
||||||
|
{
|
||||||
|
case DrawableHit:
|
||||||
|
double preempt = drawableRuleset.TimeRange.Value / drawableRuleset.ControlPointAt(hitObject.HitObject.StartTime).Multiplier;
|
||||||
|
double start = hitObject.HitObject.StartTime - preempt * fade_out_start_time;
|
||||||
|
double duration = preempt * fade_out_duration;
|
||||||
|
|
||||||
|
using (hitObject.BeginAbsoluteSequence(start))
|
||||||
|
{
|
||||||
|
hitObject.TransformBindableTo(hitObject.AccentColour, Color4.Gray, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
// 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 System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -19,6 +21,8 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
public override LocalisableString Description => @"Beats fade out before you hit them!";
|
public override LocalisableString Description => @"Beats fade out before you hit them!";
|
||||||
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1;
|
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(TaikoModColorBind)).ToArray();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How far away from the hit target should hitobjects start to fade out.
|
/// How far away from the hit target should hitobjects start to fade out.
|
||||||
/// Range: [0, 1]
|
/// Range: [0, 1]
|
||||||
|
@ -152,6 +152,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
new MultiMod(new TaikoModDoubleTime(), new TaikoModNightcore()),
|
new MultiMod(new TaikoModDoubleTime(), new TaikoModNightcore()),
|
||||||
new TaikoModHidden(),
|
new TaikoModHidden(),
|
||||||
new TaikoModFlashlight(),
|
new TaikoModFlashlight(),
|
||||||
|
new TaikoModColorBind(),
|
||||||
new ModAccuracyChallenge(),
|
new ModAccuracyChallenge(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user