From 946613e803f27025103eb8b0232a4562939877b3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 2 Dec 2020 15:22:45 +0900 Subject: [PATCH] Fix bananas not playing sounds --- osu.Game.Rulesets.Catch/Objects/Banana.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index 7734ebed12..a274f25200 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using osu.Framework.Utils; @@ -8,6 +10,7 @@ using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Utils; using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects @@ -53,19 +56,22 @@ private Color4 getBananaColour() private class BananaHitSampleInfo : HitSampleInfo, IEquatable { - private static readonly string[] lookup_names = { "metronomelow", "catch-banana" }; + private static readonly string[] lookup_names = { "Gameplay/metronomelow", "Gameplay/catch-banana" }; public override IEnumerable LookupNames => lookup_names; - public BananaHitSampleInfo() - : base(string.Empty) + public BananaHitSampleInfo(int volume = 0) + : base(string.Empty, volume: volume) { } - public bool Equals(BananaHitSampleInfo other) + public sealed override HitSampleInfo With(Optional newName = default, Optional newBank = default, Optional newSuffix = default, Optional newVolume = default) + => new BananaHitSampleInfo(newVolume.GetOr(Volume)); + + public bool Equals(BananaHitSampleInfo? other) => other != null; - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is BananaHitSampleInfo other && Equals(other); public override int GetHashCode() => lookup_names.GetHashCode();