mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 00:43:25 +08:00
Team -> Region, +IHasDrawableRepresentation, +Badge(placeholder for now), +Region to User, LeaderboardScoreDisplay -> LeaderboardScore
This commit is contained in:
parent
5719c6656a
commit
9912f5f9e1
@ -7,6 +7,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Screens.Testing;
|
using osu.Framework.Screens.Testing;
|
||||||
using osu.Game.Screens.Tournament;
|
using osu.Game.Screens.Tournament;
|
||||||
using osu.Game.Screens.Tournament.Teams;
|
using osu.Game.Screens.Tournament.Teams;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -32,57 +33,57 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
class TestTeamList : ITeamList
|
class TestTeamList : ITeamList
|
||||||
{
|
{
|
||||||
public IEnumerable<Team> Teams { get; } = new[]
|
public IEnumerable<Region> Teams { get; } = new[]
|
||||||
{
|
{
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "GB",
|
FlagName = "GB",
|
||||||
FullName = "United Kingdom",
|
FullName = "United Kingdom",
|
||||||
Acronym = "UK"
|
Acronym = "UK"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "FR",
|
FlagName = "FR",
|
||||||
FullName = "France",
|
FullName = "France",
|
||||||
Acronym = "FRA"
|
Acronym = "FRA"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "CN",
|
FlagName = "CN",
|
||||||
FullName = "China",
|
FullName = "China",
|
||||||
Acronym = "CHN"
|
Acronym = "CHN"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "AU",
|
FlagName = "AU",
|
||||||
FullName = "Australia",
|
FullName = "Australia",
|
||||||
Acronym = "AUS"
|
Acronym = "AUS"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "JP",
|
FlagName = "JP",
|
||||||
FullName = "Japan",
|
FullName = "Japan",
|
||||||
Acronym = "JPN"
|
Acronym = "JPN"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "RO",
|
FlagName = "RO",
|
||||||
FullName = "Romania",
|
FullName = "Romania",
|
||||||
Acronym = "ROM"
|
Acronym = "ROM"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "IT",
|
FlagName = "IT",
|
||||||
FullName = "Italy",
|
FullName = "Italy",
|
||||||
Acronym = "PIZZA"
|
Acronym = "PIZZA"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "VE",
|
FlagName = "VE",
|
||||||
FullName = "Venezuela",
|
FullName = "Venezuela",
|
||||||
Acronym = "VNZ"
|
Acronym = "VNZ"
|
||||||
},
|
},
|
||||||
new Team
|
new Region
|
||||||
{
|
{
|
||||||
FlagName = "US",
|
FlagName = "US",
|
||||||
FullName = "United States of America",
|
FullName = "United States of America",
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests
|
namespace osu.Desktop.VisualTests
|
||||||
{
|
{
|
||||||
@ -38,7 +39,12 @@ namespace osu.Desktop.VisualTests
|
|||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
Username = @"peppy",
|
Username = @"peppy",
|
||||||
FlagName = @"AU",
|
Region = new Region
|
||||||
|
{
|
||||||
|
FullName = @"Australia",
|
||||||
|
Acronym = @"AUS",
|
||||||
|
FlagName = @"AU",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
// 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<T> where T : Drawable
|
||||||
|
{
|
||||||
|
T CreateDrawable();
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +1,18 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Colour;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
{
|
{
|
||||||
public class Leaderboard : Container
|
public class Leaderboard : Container
|
||||||
{
|
{
|
||||||
private ScrollContainer scrollContainer;
|
private ScrollContainer scrollContainer;
|
||||||
private FillFlowContainer<LeaderboardScoreDisplay> scrollFlow;
|
private FillFlowContainer<LeaderboardScore> scrollFlow;
|
||||||
|
|
||||||
private Score[] scores;
|
private Score[] scores;
|
||||||
public Score[] Scores
|
public Score[] Scores
|
||||||
@ -30,10 +23,10 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
if (value == scores) return;
|
if (value == scores) return;
|
||||||
scores = value;
|
scores = value;
|
||||||
|
|
||||||
var scoreDisplays = new List<LeaderboardScoreDisplay>();
|
var scoreDisplays = new List<LeaderboardScore>();
|
||||||
for (int i = 0; i < value.Length; i++)
|
for (int i = 0; i < value.Length; i++)
|
||||||
{
|
{
|
||||||
scoreDisplays.Add(new LeaderboardScoreDisplay(value[i], i + 1));
|
scoreDisplays.Add(new LeaderboardScore(value[i], i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollFlow.Children = scoreDisplays;
|
scrollFlow.Children = scoreDisplays;
|
||||||
@ -51,7 +44,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
ScrollDraggerVisible = false,
|
ScrollDraggerVisible = false,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
scrollFlow = new FillFlowContainer<LeaderboardScoreDisplay>
|
scrollFlow = new FillFlowContainer<LeaderboardScore>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
@ -13,15 +13,16 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
{
|
{
|
||||||
public class LeaderboardScoreDisplay : Container
|
public class LeaderboardScore : Container
|
||||||
{
|
{
|
||||||
private const float height = 70;
|
private const float height = 70;
|
||||||
private const float corner_radius = 5;
|
private const float corner_radius = 5;
|
||||||
private const float edge_margin = 10;
|
private const float edge_margin = 10;
|
||||||
private const float background_opacity = 0.25f;
|
private const float background_alpha = 0.25f;
|
||||||
private const float score_letter_size = 20f;
|
private const float score_letter_size = 20f;
|
||||||
|
|
||||||
private readonly EdgeEffect imageShadow = new EdgeEffect
|
private readonly EdgeEffect imageShadow = new EdgeEffect
|
||||||
@ -33,7 +34,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
private Box background;
|
private Box background;
|
||||||
private Container content;
|
private Container content;
|
||||||
private Sprite avatar, flag;
|
private Sprite avatar;
|
||||||
private FillFlowContainer<ScoreModIcon> modsContainer;
|
private FillFlowContainer<ScoreModIcon> modsContainer;
|
||||||
|
|
||||||
private readonly int index;
|
private readonly int index;
|
||||||
@ -43,18 +44,17 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
private void load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
avatar.Texture = textures.Get($@"https://a.ppy.sh/{Score.User.Id}") ?? textures.Get(@"Online/avatar-guest");
|
avatar.Texture = textures.Get($@"https://a.ppy.sh/{Score.User.Id}") ?? textures.Get(@"Online/avatar-guest");
|
||||||
flag.Texture = textures.Get($@"Flags/{Score.User.FlagName}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(Framework.Input.InputState state)
|
protected override bool OnHover(Framework.Input.InputState state)
|
||||||
{
|
{
|
||||||
background.FadeColour(Color4.Black.Opacity(0.5f), 300, EasingTypes.OutQuint);
|
background.FadeTo(0.5f, 300, EasingTypes.OutQuint);
|
||||||
return base.OnHover(state);
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(Framework.Input.InputState state)
|
protected override void OnHoverLost(Framework.Input.InputState state)
|
||||||
{
|
{
|
||||||
background.FadeColour(Color4.Black.Opacity(background_opacity), 200, EasingTypes.OutQuint);
|
background.FadeTo(background_alpha, 200, EasingTypes.OutQuint);
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public LeaderboardScoreDisplay(Score score, int i)
|
public LeaderboardScore(Score score, int i)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
index = i;
|
index = i;
|
||||||
@ -81,6 +81,10 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = height;
|
Height = height;
|
||||||
|
|
||||||
|
var flag = Score.User.Region.CreateDrawable();
|
||||||
|
flag.Width = 30;
|
||||||
|
flag.RelativeSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -115,7 +119,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black.Opacity(background_opacity),
|
Colour = Color4.Black,
|
||||||
|
Alpha = background_alpha,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -167,18 +172,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
flag = new Sprite
|
flag,
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = 30f,
|
|
||||||
},
|
|
||||||
new Sprite
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomRight,
|
|
||||||
Anchor = Anchor.BottomRight,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = 50f,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
@ -21,6 +21,7 @@ using osu.Game.Screens.Tournament.Components;
|
|||||||
using osu.Game.Screens.Tournament.Teams;
|
using osu.Game.Screens.Tournament.Teams;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
private GroupContainer groupsContainer;
|
private GroupContainer groupsContainer;
|
||||||
private OsuSpriteText fullTeamNameText;
|
private OsuSpriteText fullTeamNameText;
|
||||||
|
|
||||||
private List<Team> allTeams = new List<Team>();
|
private List<Region> allTeams = new List<Region>();
|
||||||
|
|
||||||
private DrawingsConfigManager drawingsConfig;
|
private DrawingsConfigManager drawingsConfig;
|
||||||
|
|
||||||
@ -238,7 +239,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
reset(true);
|
reset(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTeamSelected(Team team)
|
private void onTeamSelected(Region team)
|
||||||
{
|
{
|
||||||
groupsContainer.AddTeam(team);
|
groupsContainer.AddTeam(team);
|
||||||
|
|
||||||
@ -278,13 +279,13 @@ namespace osu.Game.Screens.Tournament
|
|||||||
teamsContainer.ClearTeams();
|
teamsContainer.ClearTeams();
|
||||||
allTeams.Clear();
|
allTeams.Clear();
|
||||||
|
|
||||||
foreach (Team t in TeamList.Teams)
|
foreach (Region r in TeamList.Teams)
|
||||||
{
|
{
|
||||||
if (groupsContainer.ContainsTeam(t.FullName))
|
if (groupsContainer.ContainsTeam(r.FullName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
allTeams.Add(t);
|
allTeams.Add(r);
|
||||||
teamsContainer.AddTeam(t);
|
teamsContainer.AddTeam(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +315,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
if (line.ToUpper().StartsWith("GROUP"))
|
if (line.ToUpper().StartsWith("GROUP"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Team teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line);
|
Region teamToAdd = allTeams.FirstOrDefault(r => r.FullName == line);
|
||||||
|
|
||||||
if (teamToAdd == null)
|
if (teamToAdd == null)
|
||||||
continue;
|
continue;
|
||||||
|
@ -14,6 +14,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Screens.Tournament.Teams;
|
using osu.Game.Screens.Tournament.Teams;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
@ -73,7 +74,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTeam(Team team)
|
public void AddTeam(Region team)
|
||||||
{
|
{
|
||||||
GroupTeam gt = new GroupTeam(team);
|
GroupTeam gt = new GroupTeam(team);
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
return allTeams.Any(t => t.Team.FullName == fullName);
|
return allTeams.Any(t => t.Team.FullName == fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveTeam(Team team)
|
public bool RemoveTeam(Region team)
|
||||||
{
|
{
|
||||||
allTeams.RemoveAll(gt => gt.Team == team);
|
allTeams.RemoveAll(gt => gt.Team == team);
|
||||||
|
|
||||||
@ -122,12 +123,12 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
class GroupTeam : Container
|
class GroupTeam : Container
|
||||||
{
|
{
|
||||||
public Team Team;
|
public Region Team;
|
||||||
|
|
||||||
private FillFlowContainer innerContainer;
|
private FillFlowContainer innerContainer;
|
||||||
private Sprite flagSprite;
|
private Sprite flagSprite;
|
||||||
|
|
||||||
public GroupTeam(Team team)
|
public GroupTeam(Region team)
|
||||||
{
|
{
|
||||||
Team = team;
|
Team = team;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Screens.Tournament.Teams;
|
using osu.Game.Screens.Tournament.Teams;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
@ -61,7 +62,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTeam(Team team)
|
public void AddTeam(Region team)
|
||||||
{
|
{
|
||||||
if (groups[currentGroup].TeamsCount == maxTeams)
|
if (groups[currentGroup].TeamsCount == maxTeams)
|
||||||
return;
|
return;
|
||||||
|
@ -12,18 +12,18 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Screens.Tournament.Teams;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
public class ScrollingTeamContainer : Container
|
public class ScrollingTeamContainer : Container
|
||||||
{
|
{
|
||||||
public event Action OnScrollStarted;
|
public event Action OnScrollStarted;
|
||||||
public event Action<Team> OnSelected;
|
public event Action<Region> OnSelected;
|
||||||
|
|
||||||
private readonly List<Team> availableTeams = new List<Team>();
|
private readonly List<Region> availableTeams = new List<Region>();
|
||||||
|
|
||||||
private Container tracker;
|
private Container tracker;
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTeam(Team team)
|
public void AddTeam(Region team)
|
||||||
{
|
{
|
||||||
if (availableTeams.Contains(team))
|
if (availableTeams.Contains(team))
|
||||||
return;
|
return;
|
||||||
@ -162,12 +162,12 @@ namespace osu.Game.Screens.Tournament
|
|||||||
scrollState = ScrollState.Idle;
|
scrollState = ScrollState.Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTeams(IEnumerable<Team> teams)
|
public void AddTeams(IEnumerable<Region> teams)
|
||||||
{
|
{
|
||||||
if (teams == null)
|
if (teams == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (Team t in teams)
|
foreach (Region t in teams)
|
||||||
AddTeam(t);
|
AddTeam(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
scrollState = ScrollState.Idle;
|
scrollState = ScrollState.Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveTeam(Team team)
|
public void RemoveTeam(Region team)
|
||||||
{
|
{
|
||||||
availableTeams.Remove(team);
|
availableTeams.Remove(team);
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
public const float WIDTH = 58;
|
public const float WIDTH = 58;
|
||||||
public const float HEIGHT = 41;
|
public const float HEIGHT = 41;
|
||||||
|
|
||||||
public Team Team;
|
public Region Team;
|
||||||
|
|
||||||
private Sprite flagSprite;
|
private Sprite flagSprite;
|
||||||
private Box outline;
|
private Box outline;
|
||||||
@ -339,7 +339,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScrollingTeam(Team team)
|
public ScrollingTeam(Region team)
|
||||||
{
|
{
|
||||||
Team = team;
|
Team = team;
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament.Teams
|
namespace osu.Game.Screens.Tournament.Teams
|
||||||
{
|
{
|
||||||
public interface ITeamList
|
public interface ITeamList
|
||||||
{
|
{
|
||||||
IEnumerable<Team> Teams { get; }
|
IEnumerable<Region> Teams { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament.Teams
|
namespace osu.Game.Screens.Tournament.Teams
|
||||||
{
|
{
|
||||||
@ -20,11 +21,11 @@ namespace osu.Game.Screens.Tournament.Teams
|
|||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Team> Teams
|
public IEnumerable<Region> Teams
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var teams = new List<Team>();
|
var teams = new List<Region>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -52,7 +53,7 @@ namespace osu.Game.Screens.Tournament.Teams
|
|||||||
string acronym = split.Length >= 3 ? split[2].Trim() : teamName;
|
string acronym = split.Length >= 3 ? split[2].Trim() : teamName;
|
||||||
acronym = acronym.Substring(0, Math.Min(3, acronym.Length));
|
acronym = acronym.Substring(0, Math.Min(3, acronym.Length));
|
||||||
|
|
||||||
teams.Add(new Team()
|
teams.Add(new Region()
|
||||||
{
|
{
|
||||||
FlagName = flagName,
|
FlagName = flagName,
|
||||||
FullName = teamName,
|
FullName = teamName,
|
||||||
|
@ -1,23 +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
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament.Teams
|
|
||||||
{
|
|
||||||
public class Team
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The name of this team.
|
|
||||||
/// </summary>
|
|
||||||
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>
|
|
||||||
public string FlagName;
|
|
||||||
}
|
|
||||||
}
|
|
23
osu.Game/Users/Badge.cs
Normal file
23
osu.Game/Users/Badge.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Users
|
||||||
|
{
|
||||||
|
public class Badge : IHasDrawableRepresentation<Sprite>
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public Texture Texture; // TODO: Replace this with something better
|
||||||
|
|
||||||
|
public Sprite CreateDrawable()
|
||||||
|
{
|
||||||
|
return new Sprite
|
||||||
|
{
|
||||||
|
Texture = Texture,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
73
osu.Game/Users/Region.cs
Normal file
73
osu.Game/Users/Region.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Users
|
||||||
|
{
|
||||||
|
public class Region : IHasDrawableRepresentation<DrawableFlag>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of this team.
|
||||||
|
/// </summary>
|
||||||
|
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>
|
||||||
|
public string FlagName;
|
||||||
|
|
||||||
|
public DrawableFlag CreateDrawable()
|
||||||
|
{
|
||||||
|
return new DrawableFlag(FlagName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DrawableFlag : Container
|
||||||
|
{
|
||||||
|
private Sprite sprite;
|
||||||
|
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}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawableFlag(string name)
|
||||||
|
{
|
||||||
|
flagName = name;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
sprite = new Sprite
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,15 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Users
|
namespace osu.Game.Users
|
||||||
{
|
{
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
public int Id;
|
public int Id;
|
||||||
public string Username;
|
public string Username;
|
||||||
|
public Region Region;
|
||||||
/// <summary>
|
public IEnumerable<Badge> Badges;
|
||||||
/// Two-letter flag acronym (ISO 3166 standard)
|
|
||||||
/// </summary>
|
|
||||||
public string FlagName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,6 @@
|
|||||||
<Compile Include="Screens\Tournament\GroupContainer.cs" />
|
<Compile Include="Screens\Tournament\GroupContainer.cs" />
|
||||||
<Compile Include="Screens\Tournament\Teams\ITeamList.cs" />
|
<Compile Include="Screens\Tournament\Teams\ITeamList.cs" />
|
||||||
<Compile Include="Screens\Tournament\ScrollingTeamContainer.cs" />
|
<Compile Include="Screens\Tournament\ScrollingTeamContainer.cs" />
|
||||||
<Compile Include="Screens\Tournament\Teams\Team.cs" />
|
|
||||||
<Compile Include="Screens\Tournament\Teams\StorageBackedTeamList.cs" />
|
<Compile Include="Screens\Tournament\Teams\StorageBackedTeamList.cs" />
|
||||||
<Compile Include="Users\User.cs" />
|
<Compile Include="Users\User.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
|
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
|
||||||
@ -311,7 +310,10 @@
|
|||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsRemoveFromUnplayedButton.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsRemoveFromUnplayedButton.cs" />
|
||||||
<Compile Include="Screens\Select\Leaderboards\Leaderboard.cs" />
|
<Compile Include="Screens\Select\Leaderboards\Leaderboard.cs" />
|
||||||
<Compile Include="Screens\Select\Leaderboards\LeaderboardScoreDisplay.cs" />
|
<Compile Include="Screens\Select\Leaderboards\LeaderboardScore.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\IHasDrawableRepresentation.cs" />
|
||||||
|
<Compile Include="Users\Region.cs" />
|
||||||
|
<Compile Include="Users\Badge.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
|
Loading…
Reference in New Issue
Block a user