2019-06-18 01:57:57 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-06-18 01:57:57 +08:00
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2021-06-26 01:10:04 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2019-06-18 01:57:57 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Users.Drawables
|
|
|
|
|
{
|
|
|
|
|
public class DrawableFlag : Sprite, IHasTooltip
|
|
|
|
|
{
|
|
|
|
|
private readonly Country country;
|
|
|
|
|
|
2021-06-26 01:10:04 +08:00
|
|
|
|
public LocalisableString TooltipText => country?.FullName;
|
2019-06-18 01:57:57 +08:00
|
|
|
|
|
2019-06-18 03:33:27 +08:00
|
|
|
|
public DrawableFlag(Country country)
|
|
|
|
|
{
|
|
|
|
|
this.country = country;
|
|
|
|
|
}
|
2019-06-18 01:57:57 +08:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(TextureStore ts)
|
|
|
|
|
{
|
|
|
|
|
if (ts == null)
|
|
|
|
|
throw new ArgumentNullException(nameof(ts));
|
|
|
|
|
|
2019-09-15 07:46:28 +08:00
|
|
|
|
Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}") ?? ts.Get(@"Flags/__");
|
2019-06-18 01:57:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|