Skip to content

Commit

Permalink
Add configuration option to disable Taiko notes flying after hit
Browse files Browse the repository at this point in the history
In osu!stable, the "flying away" animation is shown only when the HUD
is active. This adds a configuration option to restore this behaviour
or to disable the animation altogether.
  • Loading branch information
aedoq committed Jan 24, 2025
1 parent 3c76397 commit ef45c1d
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 6 deletions.
20 changes: 20 additions & 0 deletions osu.Game.Rulesets.Taiko/Configuration/TaikoHitFlyingEnable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Localisation;
using osu.Game.Localisation;

namespace osu.Game.Rulesets.Taiko.Configuration
{
public enum TaikoHitFlyingEnable
{
[LocalisableDescription(typeof(RulesetSettingsStrings), nameof(RulesetSettingsStrings.FlyingHitEnableNever))]
Never,

[LocalisableDescription(typeof(RulesetSettingsStrings), nameof(RulesetSettingsStrings.FlyingHitEnableHUD))]
HUD,

[LocalisableDescription(typeof(RulesetSettingsStrings), nameof(RulesetSettingsStrings.FlyingHitEnableAlways))]
Always,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ protected override void InitialiseDefaults()
base.InitialiseDefaults();

SetDefault(TaikoRulesetSetting.TouchControlScheme, TaikoTouchControlScheme.KDDK);
SetDefault(TaikoRulesetSetting.HitFlyingEnable, TaikoHitFlyingEnable.Always);
}
}

public enum TaikoRulesetSetting
{
TouchControlScheme
TouchControlScheme,
HitFlyingEnable
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ protected override void LoadComplete()
{
base.LoadComplete();
ApplyMaxResult();

if (!ShowFlyingHits)
{
Hide();
}
}

protected override void LoadSamples()
Expand Down
41 changes: 36 additions & 5 deletions osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
using System.Diagnostics;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Configuration;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
using osuTK;
Expand Down Expand Up @@ -39,6 +42,9 @@ public TaikoAction? HitAction
private double? lastPressHandleTime;

private readonly Bindable<HitType> type = new Bindable<HitType>();
private readonly Bindable<TaikoHitFlyingEnable> hitFlyingEnableSetting = new Bindable<TaikoHitFlyingEnable>();
private readonly Bindable<HUDVisibilityMode> hudVisible = new Bindable<HUDVisibilityMode>();
protected bool ShowFlyingHits;

public DrawableHit()
: this(null)
Expand All @@ -51,6 +57,23 @@ public DrawableHit([CanBeNull] Hit hit)
FillMode = FillMode.Fit;
}

[BackgroundDependencyLoader]
private void load(TaikoRulesetConfigManager rulesetConfig, OsuConfigManager osuConfig)
{
rulesetConfig.BindWith(TaikoRulesetSetting.HitFlyingEnable, hitFlyingEnableSetting);
hitFlyingEnableSetting.BindValueChanged(_ => updateHitFlying());
osuConfig.BindWith(OsuSetting.HUDVisibilityMode, hudVisible);
hudVisible.BindValueChanged(_ => updateHitFlying(), true);
}

private void updateHitFlying()
{
var hitFlyingEnable = hitFlyingEnableSetting.Value;
var showHud = hudVisible.Value;
ShowFlyingHits = hitFlyingEnable == TaikoHitFlyingEnable.Always ||
(hitFlyingEnable == TaikoHitFlyingEnable.HUD && showHud == HUDVisibilityMode.Always);
}

protected override void OnApply()
{
type.BindTo(HitObject.TypeBindable);
Expand Down Expand Up @@ -168,13 +191,21 @@ protected override void UpdateHitStateTransforms(ArmedState state)
if (SnapJudgementLocation)
MainPiece.MoveToX(-X);

this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
if (ShowFlyingHits)
{
this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);

this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
.Then()
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);

this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
.Then()
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);
this.FadeOut(800);
}
else
{
Hide();
}

this.FadeOut(800);
break;
}
}
Expand Down
6 changes: 6 additions & 0 deletions osu.Game.Rulesets.Taiko/TaikoSettingsSubsection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ private void load()
{
LabelText = RulesetSettingsStrings.TouchControlScheme,
Current = config.GetBindable<TaikoTouchControlScheme>(TaikoRulesetSetting.TouchControlScheme)
},
new SettingsEnumDropdown<TaikoHitFlyingEnable>
{
ClassicDefault = TaikoHitFlyingEnable.HUD,
LabelText = RulesetSettingsStrings.FlyingHitEnable,
Current = config.GetBindable<TaikoHitFlyingEnable>(TaikoRulesetSetting.HitFlyingEnable)
}
};
}
Expand Down
20 changes: 20 additions & 0 deletions osu.Game/Localisation/RulesetSettingsStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ public static class RulesetSettingsStrings
/// </summary>
public static LocalisableString TouchControlScheme => new TranslatableString(getKey(@"touch_control_scheme"), @"Touch control scheme");

/// <summary>
/// "Circles fly off after successful hit"
/// </summary>
public static LocalisableString FlyingHitEnable => new TranslatableString(getKey(@"hit_flying_enable"), @"Circles fly off after successful hit");

/// <summary>
/// "Never"
/// </summary>
public static LocalisableString FlyingHitEnableNever => new TranslatableString(getKey(@"hit_flying_enable_never"), @"Never");

/// <summary>
/// "When HUD is visible"
/// </summary>
public static LocalisableString FlyingHitEnableHUD => new TranslatableString(getKey(@"hit_flying_enable_hud"), @"When HUD is visible");

/// <summary>
/// "Always"
/// </summary>
public static LocalisableString FlyingHitEnableAlways => new TranslatableString(getKey(@"hit_flying_enable_always"), @"Always");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}

0 comments on commit ef45c1d

Please sign in to comment.