1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Merge pull request #4830 from peppy/move-tooltip-text

Move TooltipText to OsuClickableContainer
This commit is contained in:
Dean Herbert 2019-05-21 15:12:09 +09:00 committed by GitHub
commit 56396d576e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 23 deletions

View File

@ -4,11 +4,12 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Graphics.Containers
{
public class OsuClickableContainer : ClickableContainer
public class OsuClickableContainer : ClickableContainer, IHasTooltip
{
private readonly HoverSampleSet sampleSet;
@ -23,6 +24,8 @@ namespace osu.Game.Graphics.Containers
this.sampleSet = sampleSet;
}
public virtual string TooltipText { get; set; }
[BackgroundDependencyLoader]
private void load()
{

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 osu.Framework.Graphics.Cursor;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -16,7 +15,7 @@ namespace osu.Game.Online.Chat
/// <summary>
/// An invisible drawable that brings multiple <see cref="Drawable"/> pieces together to form a consumable clickable link.
/// </summary>
public class DrawableLinkCompiler : OsuHoverContainer, IHasTooltip
public class DrawableLinkCompiler : OsuHoverContainer
{
/// <summary>
/// Each word part of a chat link (split for word-wrap support).
@ -40,8 +39,6 @@ namespace osu.Game.Online.Chat
protected override IEnumerable<Drawable> EffectTargets => Parts;
public string TooltipText { get; set; }
private class LinkHoverSounds : HoverClickSounds
{
private readonly List<Drawable> parts;

View File

@ -9,8 +9,6 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
using osu.Game.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
@ -129,10 +127,5 @@ namespace osu.Game.Overlays.BeatmapSet
};
}
}
private class ClickableArea : OsuClickableContainer, IHasTooltip
{
public string TooltipText => @"View Profile";
}
}
}

View File

@ -4,7 +4,6 @@
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -12,10 +11,8 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components
{
public abstract class ProfileHeaderButton : OsuHoverContainer, IHasTooltip
public abstract class ProfileHeaderButton : OsuHoverContainer
{
public abstract string TooltipText { get; }
private readonly Box background;
private readonly Container content;

View File

@ -4,7 +4,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Sections
/// <summary>
/// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see <see cref="DrawableProfileRow"/>).
/// </summary>
public class BeatmapMetadataContainer : OsuHoverContainer, IHasTooltip
public class BeatmapMetadataContainer : OsuHoverContainer
{
private readonly BeatmapInfo beatmap;
@ -27,8 +26,6 @@ namespace osu.Game.Overlays.Profile.Sections
TooltipText = $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}";
}
public string TooltipText { get; }
[BackgroundDependencyLoader(true)]
private void load(BeatmapSetOverlay beatmapSetOverlay)
{

View File

@ -6,7 +6,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events;
@ -72,9 +71,9 @@ namespace osu.Game.Users
game?.ShowUser(user.Id);
}
private class ClickableArea : OsuClickableContainer, IHasTooltip
private class ClickableArea : OsuClickableContainer
{
public string TooltipText => Enabled.Value ? @"View Profile" : null;
public override string TooltipText => Enabled.Value ? @"View Profile" : null;
protected override bool OnClick(ClickEvent e)
{