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