1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 01:33:01 +08:00

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. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -66,7 +65,7 @@ namespace osu.Game.Overlays.Mods
incompatibleIcon.Hide(); incompatibleIcon.Hide();
} }
public override ITooltip GetCustomTooltip() => new LocalPlayerModButtonTooltip(); public override ITooltip<Mod> GetCustomTooltip() => new LocalPlayerModButtonTooltip();
private class LocalPlayerModButtonTooltip : ModButtonTooltip private class LocalPlayerModButtonTooltip : ModButtonTooltip
{ {

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Mods
/// <summary> /// <summary>
/// Represents a clickable button which can cycle through one of more mods. /// Represents a clickable button which can cycle through one of more mods.
/// </summary> /// </summary>
public class ModButton : ModButtonEmpty, IHasCustomTooltip public class ModButton : ModButtonEmpty, IHasCustomTooltip<Mod>
{ {
private ModIcon foregroundIcon; private ModIcon foregroundIcon;
private ModIcon backgroundIcon; private ModIcon backgroundIcon;
@ -312,8 +312,8 @@ namespace osu.Game.Overlays.Mods
Mod = mod; 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. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -14,7 +13,7 @@ using osuTK;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
public class ModButtonTooltip : VisibilityContainer, ITooltip<ModButton> public class ModButtonTooltip : VisibilityContainer, ITooltip<Mod>
{ {
private readonly OsuSpriteText descriptionText; private readonly OsuSpriteText descriptionText;
private readonly Box background; private readonly Box background;
@ -61,11 +60,10 @@ namespace osu.Game.Overlays.Mods
private Mod lastMod; 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; lastMod = mod;