1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 12:02:54 +08:00

Make CountryName use LinkFlowContainer for consistency

This commit is contained in:
TheWildTree 2020-02-27 22:22:22 +01:00
parent 62e676feb5
commit 82cbd35e30

View File

@ -5,11 +5,10 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System;
using osu.Game.Users;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Rankings.Tables
{
@ -62,35 +61,22 @@ namespace osu.Game.Overlays.Rankings.Tables
}
};
private class CountryName : OsuHoverContainer
private class CountryName : LinkFlowContainer
{
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
[Resolved(canBeNull: true)]
private RankingsOverlay rankings { get; set; }
private readonly OsuSpriteText text;
private readonly Country country;
public CountryName(Country country)
public CountryName(Country country) : base(t => t.Font = OsuFont.GetFont(size: 12))
{
this.country = country;
AutoSizeAxes = Axes.Both;
Add(text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 12),
Text = country.FullName ?? string.Empty,
});
}
AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
TextAnchor = Anchor.CentreLeft;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Light2;
HoverColour = colourProvider.Content2;
Action = () => rankings?.ShowCountry(country);
AddLink(country.FullName ?? string.Empty, () => rankings?.ShowCountry(country));
}
}
}