-IHasDrawableRepresentation, User.Region -> Country

This commit is contained in:
DrabWeb 2017-03-19 00:09:58 -03:00
parent 0bc8ed9c9e
commit b0e7296e25
7 changed files with 18 additions and 41 deletions

View File

@ -33,7 +33,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 6602580, Id = 6602580,
Username = @"waaiiru", Username = @"waaiiru",
Region = new Country Country = new Country
{ {
FullName = @"Spain", FullName = @"Spain",
FlagName = @"ES", FlagName = @"ES",
@ -51,7 +51,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 4608074, Id = 4608074,
Username = @"Skycries", Username = @"Skycries",
Region = new Country Country = new Country
{ {
FullName = @"Brazil", FullName = @"Brazil",
FlagName = @"BR", FlagName = @"BR",
@ -69,7 +69,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 1014222, Id = 1014222,
Username = @"eLy", Username = @"eLy",
Region = new Country Country = new Country
{ {
FullName = @"Japan", FullName = @"Japan",
FlagName = @"JP", FlagName = @"JP",
@ -87,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 1541390, Id = 1541390,
Username = @"Toukai", Username = @"Toukai",
Region = new Country Country = new Country
{ {
FullName = @"Canada", FullName = @"Canada",
FlagName = @"CA", FlagName = @"CA",
@ -105,7 +105,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 2243452, Id = 2243452,
Username = @"Satoruu", Username = @"Satoruu",
Region = new Country Country = new Country
{ {
FullName = @"Venezuela", FullName = @"Venezuela",
FlagName = @"VE", FlagName = @"VE",
@ -123,7 +123,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 2705430, Id = 2705430,
Username = @"Mooha", Username = @"Mooha",
Region = new Country Country = new Country
{ {
FullName = @"France", FullName = @"France",
FlagName = @"FR", FlagName = @"FR",
@ -141,7 +141,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 7151382, Id = 7151382,
Username = @"Mayuri Hana", Username = @"Mayuri Hana",
Region = new Country Country = new Country
{ {
FullName = @"Thailand", FullName = @"Thailand",
FlagName = @"TH", FlagName = @"TH",
@ -159,7 +159,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 2051389, Id = 2051389,
Username = @"FunOrange", Username = @"FunOrange",
Region = new Country Country = new Country
{ {
FullName = @"Canada", FullName = @"Canada",
FlagName = @"CA", FlagName = @"CA",
@ -177,7 +177,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 6169483, Id = 6169483,
Username = @"-Hebel-", Username = @"-Hebel-",
Region = new Country Country = new Country
{ {
FullName = @"Mexico", FullName = @"Mexico",
FlagName = @"MX", FlagName = @"MX",
@ -195,7 +195,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
Id = 6702666, Id = 6702666,
Username = @"prhtnsm", Username = @"prhtnsm",
Region = new Country Country = new Country
{ {
FullName = @"Germany", FullName = @"Germany",
FlagName = @"DE", FlagName = @"DE",

View File

@ -1,12 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
namespace osu.Game.Graphics.UserInterface
{
public interface IHasDrawableRepresentation<out T> where T : Drawable
{
T CreateDrawable();
}
}

View File

@ -104,10 +104,6 @@ namespace osu.Game.Screens.Select.Leaderboards
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = HEIGHT; Height = HEIGHT;
var flag = Score.User?.Region.CreateDrawable() ?? new DrawableFlag();
flag.Width = 30;
flag.RelativeSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container
@ -189,7 +185,11 @@ namespace osu.Game.Screens.Select.Leaderboards
Masking = true, Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
flag, new DrawableFlag(Score.User?.Country?.FlagName ?? "__")
{
Width = 30,
RelativeSizeAxes = Axes.Y,
},
}, },
}, },
new FillFlowContainer new FillFlowContainer

View File

@ -10,7 +10,7 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Users namespace osu.Game.Users
{ {
public class Country : IHasDrawableRepresentation<DrawableFlag> public class Country
{ {
/// <summary> /// <summary>
/// The name of this country. /// The name of this country.
@ -26,11 +26,6 @@ namespace osu.Game.Users
/// Two-letter flag acronym (ISO 3166 standard) /// Two-letter flag acronym (ISO 3166 standard)
/// </summary> /// </summary>
public string FlagName; public string FlagName;
public DrawableFlag CreateDrawable()
{
return new DrawableFlag(FlagName);
}
} }
public class DrawableFlag : Container public class DrawableFlag : Container

View File

@ -6,13 +6,8 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Users namespace osu.Game.Users
{ {
public class Team : IHasDrawableRepresentation<Sprite> public class Team
{ {
public string Name; public string Name;
public Sprite CreateDrawable()
{
return new Sprite();
}
} }
} }

View File

@ -7,7 +7,7 @@ namespace osu.Game.Users
{ {
public int Id; public int Id;
public string Username; public string Username;
public Country Region; public Country Country;
public Team Team; public Team Team;
} }
} }

View File

@ -354,7 +354,6 @@
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" /> <Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
<Compile Include="Screens\Select\Leaderboards\Leaderboard.cs" /> <Compile Include="Screens\Select\Leaderboards\Leaderboard.cs" />
<Compile Include="Screens\Select\Leaderboards\LeaderboardScore.cs" /> <Compile Include="Screens\Select\Leaderboards\LeaderboardScore.cs" />
<Compile Include="Graphics\UserInterface\IHasDrawableRepresentation.cs" />
<Compile Include="Users\Country.cs" /> <Compile Include="Users\Country.cs" />
<Compile Include="Users\Team.cs" /> <Compile Include="Users\Team.cs" />
<Compile Include="Modes\ScoreRank.cs" /> <Compile Include="Modes\ScoreRank.cs" />