From a190801291d79d42115f8ed03805109228cda21e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 31 Aug 2021 19:36:27 +0300 Subject: [PATCH] Revert no longer required tooltip content changes --- osu.Game/Overlays/Mods/LocalPlayerModButton.cs | 3 +-- osu.Game/Overlays/Mods/ModButton.cs | 6 +++--- osu.Game/Overlays/Mods/ModButtonTooltip.cs | 10 ++++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Mods/LocalPlayerModButton.cs b/osu.Game/Overlays/Mods/LocalPlayerModButton.cs index 1d5ddfcf06..d26bbf344d 100644 --- a/osu.Game/Overlays/Mods/LocalPlayerModButton.cs +++ b/osu.Game/Overlays/Mods/LocalPlayerModButton.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -66,7 +65,7 @@ namespace osu.Game.Overlays.Mods incompatibleIcon.Hide(); } - public override ITooltip GetCustomTooltip() => new LocalPlayerModButtonTooltip(); + public override ITooltip GetCustomTooltip() => new LocalPlayerModButtonTooltip(); private class LocalPlayerModButtonTooltip : ModButtonTooltip { diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index cc8acb7513..979e2c8da3 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Mods /// /// Represents a clickable button which can cycle through one of more mods. /// - public class ModButton : ModButtonEmpty, IHasCustomTooltip + public class ModButton : ModButtonEmpty, IHasCustomTooltip { private ModIcon foregroundIcon; private ModIcon backgroundIcon; @@ -312,8 +312,8 @@ namespace osu.Game.Overlays.Mods Mod = mod; } - public virtual ITooltip GetCustomTooltip() => new ModButtonTooltip(); + public virtual ITooltip GetCustomTooltip() => new ModButtonTooltip(); - public object TooltipContent => this; + public Mod TooltipContent => SelectedMod ?? Mods.FirstOrDefault(); } } diff --git a/osu.Game/Overlays/Mods/ModButtonTooltip.cs b/osu.Game/Overlays/Mods/ModButtonTooltip.cs index 0ad479670b..2f50e38a5a 100644 --- a/osu.Game/Overlays/Mods/ModButtonTooltip.cs +++ b/osu.Game/Overlays/Mods/ModButtonTooltip.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -14,7 +13,7 @@ using osuTK; namespace osu.Game.Overlays.Mods { - public class ModButtonTooltip : VisibilityContainer, ITooltip + public class ModButtonTooltip : VisibilityContainer, ITooltip { private readonly OsuSpriteText descriptionText; private readonly Box background; @@ -61,11 +60,10 @@ namespace osu.Game.Overlays.Mods private Mod lastMod; - public virtual void SetContent(ModButton button) + public void SetContent(Mod mod) { - var mod = button.SelectedMod ?? button.Mods.First(); - - if (mod.Equals(lastMod)) return; + if (mod.Equals(lastMod)) + return; lastMod = mod;