2017-03-13 12:33:25 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-04-19 07:02:18 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2017-03-13 12:33:25 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Users
|
|
|
|
|
{
|
2017-03-19 03:09:58 +00:00
|
|
|
|
public class Country
|
2017-03-13 12:33:25 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2017-03-17 21:16:59 +00:00
|
|
|
|
/// The name of this country.
|
2017-03-13 12:33:25 +00:00
|
|
|
|
/// </summary>
|
2017-04-19 07:02:18 +00:00
|
|
|
|
[JsonProperty(@"name")]
|
2017-03-13 12:33:25 +00:00
|
|
|
|
public string FullName;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Short acronym which appears in the group boxes post-selection.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Acronym;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Two-letter flag acronym (ISO 3166 standard)
|
|
|
|
|
/// </summary>
|
2017-04-19 07:02:18 +00:00
|
|
|
|
[JsonProperty(@"code")]
|
2017-03-13 12:33:25 +00:00
|
|
|
|
public string FlagName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DrawableFlag : Container
|
|
|
|
|
{
|
2017-03-23 04:41:50 +00:00
|
|
|
|
private readonly Sprite sprite;
|
2017-03-13 12:33:25 +00:00
|
|
|
|
private TextureStore textures;
|
|
|
|
|
|
|
|
|
|
private string flagName;
|
|
|
|
|
public string FlagName
|
|
|
|
|
{
|
|
|
|
|
get { return flagName; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == flagName) return;
|
|
|
|
|
flagName = value;
|
|
|
|
|
sprite.Texture = textures.Get($@"Flags/{flagName}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(TextureStore ts)
|
|
|
|
|
{
|
|
|
|
|
textures = ts;
|
|
|
|
|
sprite.Texture = textures.Get($@"Flags/{flagName}");
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-15 05:06:22 +00:00
|
|
|
|
public DrawableFlag(string name = @"__")
|
2017-03-13 12:33:25 +00:00
|
|
|
|
{
|
|
|
|
|
flagName = name;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
sprite = new Sprite
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|