Revert no longer required tooltip content changes

This commit is contained in:
Salman Ahmed 2021-08-31 19:36:27 +03:00
parent 9afc482598
commit a190801291
3 changed files with 8 additions and 11 deletions

View File

@ -1,7 +1,6 @@
// 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 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<Mod> GetCustomTooltip() => new LocalPlayerModButtonTooltip();
private class LocalPlayerModButtonTooltip : ModButtonTooltip
{

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Mods
/// <summary>
/// Represents a clickable button which can cycle through one of more mods.
/// </summary>
public class ModButton : ModButtonEmpty, IHasCustomTooltip
public class ModButton : ModButtonEmpty, IHasCustomTooltip<Mod>
{
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<Mod> GetCustomTooltip() => new ModButtonTooltip();
public object TooltipContent => this;
public Mod TooltipContent => SelectedMod ?? Mods.FirstOrDefault();
}
}

View File

@ -1,7 +1,6 @@
// 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.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<ModButton>
public class ModButtonTooltip : VisibilityContainer, ITooltip<Mod>
{
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;