mirror of
https://github.com/ppy/osu
synced 2024-12-23 23:33:36 +00:00
Update tooltip implementations
This commit is contained in:
parent
f64efdc4a9
commit
fa2bf42188
@ -259,10 +259,10 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
private readonly IBindable<StarDifficulty> starDifficulty = new Bindable<StarDifficulty>();
|
||||
|
||||
public bool SetContent(object content)
|
||||
public void SetContent(object content)
|
||||
{
|
||||
if (!(content is DifficultyIconTooltipContent iconContent))
|
||||
return false;
|
||||
return;
|
||||
|
||||
difficultyName.Text = iconContent.Beatmap.Version;
|
||||
|
||||
@ -273,8 +273,6 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
|
||||
difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
|
||||
}, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
|
@ -31,12 +31,9 @@ namespace osu.Game.Graphics.Cursor
|
||||
private readonly OsuSpriteText text;
|
||||
private bool instantMovement = true;
|
||||
|
||||
public override bool SetContent(object content)
|
||||
public override void SetContent(LocalisableString contentString)
|
||||
{
|
||||
if (!(content is LocalisableString contentString))
|
||||
return false;
|
||||
|
||||
if (contentString == text.Text) return true;
|
||||
if (contentString == text.Text) return;
|
||||
|
||||
text.Text = contentString;
|
||||
|
||||
@ -47,8 +44,6 @@ namespace osu.Game.Graphics.Cursor
|
||||
}
|
||||
else
|
||||
AutoSizeDuration = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public OsuTooltip()
|
||||
|
@ -12,7 +12,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Graphics
|
||||
{
|
||||
public class DateTooltip : VisibilityContainer, ITooltip
|
||||
public class DateTooltip : VisibilityContainer, ITooltip<DateTimeOffset>
|
||||
{
|
||||
private readonly OsuSpriteText dateText, timeText;
|
||||
private readonly Box background;
|
||||
@ -63,14 +63,10 @@ namespace osu.Game.Graphics
|
||||
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
|
||||
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
|
||||
|
||||
public bool SetContent(object content)
|
||||
public void SetContent(DateTimeOffset date)
|
||||
{
|
||||
if (!(content is DateTimeOffset date))
|
||||
return false;
|
||||
|
||||
dateText.Text = $"{date:d MMMM yyyy} ";
|
||||
timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
|
@ -18,7 +18,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModButtonTooltip : VisibilityContainer, ITooltip
|
||||
public class ModButtonTooltip : VisibilityContainer, ITooltip<Mod>
|
||||
{
|
||||
private readonly OsuSpriteText descriptionText;
|
||||
private readonly Box background;
|
||||
@ -82,12 +82,9 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private Mod lastMod;
|
||||
|
||||
public bool SetContent(object content)
|
||||
public void SetContent(Mod mod)
|
||||
{
|
||||
if (!(content is Mod mod))
|
||||
return false;
|
||||
|
||||
if (mod.Equals(lastMod)) return true;
|
||||
if (mod.Equals(lastMod)) return;
|
||||
|
||||
lastMod = mod;
|
||||
|
||||
@ -99,15 +96,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
incompatibleMods.Value = allMods.Where(m => m.GetType() != mod.GetType() && incompatibleTypes.Any(t => t.IsInstanceOfType(m))).ToList();
|
||||
|
||||
if (!incompatibleMods.Value.Any())
|
||||
{
|
||||
incompatibleText.Text = "Compatible with all mods";
|
||||
return true;
|
||||
}
|
||||
|
||||
incompatibleText.Text = "Incompatible with:";
|
||||
|
||||
return true;
|
||||
incompatibleText.Text = !incompatibleMods.Value.Any() ? "Compatible with all mods" : "Incompatible with:";
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
|
@ -81,14 +81,13 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
}
|
||||
|
||||
public override bool SetContent(object content)
|
||||
public override void SetContent(object content)
|
||||
{
|
||||
if (!(content is TooltipDisplayContent info))
|
||||
return false;
|
||||
return;
|
||||
|
||||
Counter.Text = info.Rank;
|
||||
BottomText.Text = info.Time;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,14 +50,13 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
this.tooltipCounterName = tooltipCounterName;
|
||||
}
|
||||
|
||||
public override bool SetContent(object content)
|
||||
public override void SetContent(object content)
|
||||
{
|
||||
if (!(content is TooltipDisplayContent info) || info.Name != tooltipCounterName)
|
||||
return false;
|
||||
return;
|
||||
|
||||
Counter.Text = info.Count;
|
||||
BottomText.Text = info.Date;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ namespace osu.Game.Overlays.Profile
|
||||
background.Colour = colours.Gray1;
|
||||
}
|
||||
|
||||
public abstract bool SetContent(object content);
|
||||
public abstract void SetContent(object content);
|
||||
|
||||
private bool instantMove = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user