Skip to content

Commit 6835d76

Browse files
committed
Add toggle for rank change sound playback to default rank display
Because some people don't seem to like it. Defaults to on still.
1 parent 0de7320 commit 6835d76

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
2+
// See the LICENCE file in the repository root for full licence text.
3+
4+
using osu.Framework.Localisation;
5+
6+
namespace osu.Game.Localisation
7+
{
8+
public static class DefaultRankDisplayStrings
9+
{
10+
private const string prefix = @"osu.Game.Resources.Localisation.DefaultRankDisplay";
11+
12+
/// <summary>
13+
/// "Play samples on rank change"
14+
/// </summary>
15+
public static LocalisableString PlaySamplesOnRankChange => new TranslatableString(getKey(@"play_samples_on_rank_change"), @"Play samples on rank change");
16+
17+
private static string getKey(string key) => $@"{prefix}:{key}";
18+
}
19+
}

osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
using osu.Framework.Graphics;
77
using osu.Framework.Graphics.Containers;
88
using osu.Game.Audio;
9+
using osu.Game.Configuration;
910
using osu.Game.Online.Leaderboards;
1011
using osu.Game.Rulesets.Scoring;
1112
using osu.Game.Scoring;
1213
using osu.Game.Skinning;
1314
using osuTK;
15+
using osu.Game.Localisation;
1416

1517
namespace osu.Game.Screens.Play.HUD
1618
{
@@ -19,6 +21,9 @@ public partial class DefaultRankDisplay : CompositeDrawable, ISerialisableDrawab
1921
[Resolved]
2022
private ScoreProcessor scoreProcessor { get; set; } = null!;
2123

24+
[SettingSource(typeof(DefaultRankDisplayStrings), nameof(DefaultRankDisplayStrings.PlaySamplesOnRankChange))]
25+
public BindableBool PlaySamples { get; set; } = new BindableBool(true);
26+
2227
public bool UsesFixedAnchor { get; set; }
2328

2429
private UpdateableRank rankDisplay = null!;
@@ -55,7 +60,7 @@ protected override void LoadComplete()
5560
rank.BindValueChanged(r =>
5661
{
5762
// Don't play rank-down sfx on quit/retry
58-
if (r.NewValue != r.OldValue && r.NewValue > ScoreRank.F)
63+
if (r.NewValue != r.OldValue && r.NewValue > ScoreRank.F && PlaySamples.Value)
5964
{
6065
if (r.NewValue > rankDisplay.Rank)
6166
rankUpSample.Play();

0 commit comments

Comments
 (0)