diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index 5c4fb50374..4fe7e805ec 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Platform; using osu.Framework.Screens.Testing; using osu.Game.Screens.Tournament; +using osu.Game.Screens.Tournament.Teams; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index d8d0e8a062..41d9b447df 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Tournament.Components; +using osu.Game.Screens.Tournament.Teams; using OpenTK; using OpenTK.Graphics; @@ -51,7 +52,7 @@ namespace osu.Game.Screens.Tournament this.storage = storage; if (TeamList == null) - TeamList = new FileTeamList(storage); + TeamList = new StorageBackedTeamList(storage); if (!TeamList.Teams.Any()) { @@ -244,7 +245,7 @@ namespace osu.Game.Screens.Tournament fullTeamNameText.Text = team.FullName; fullTeamNameText.FadeIn(200); - writeResults(groupsContainer.ToStringRepresentation()); + writeResults(groupsContainer.GetStringRepresentation()); } private void writeResults(string text) diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index f719ad4525..c3a911a791 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; +using osu.Game.Screens.Tournament.Teams; using OpenTK; using OpenTK.Graphics; @@ -58,7 +59,7 @@ namespace osu.Game.Screens.Tournament teams = new FillFlowContainer { RelativeSizeAxes = Axes.Both, - + Spacing = new Vector2(6f, 22), Margin = new MarginPadding @@ -111,7 +112,7 @@ namespace osu.Game.Screens.Tournament TeamsCount = 0; } - public string ToStringRepresentation() + public string GetStringRepresentation() { StringBuilder sb = new StringBuilder(); foreach (GroupTeam gt in allTeams) @@ -130,7 +131,7 @@ namespace osu.Game.Screens.Tournament { Team = team; - Size = new Vector2(36, 0); + Width = 36; AutoSizeAxes = Axes.Y; Children = new Drawable[] @@ -146,8 +147,6 @@ namespace osu.Game.Screens.Tournament Direction = FillDirection.Down, Spacing = new Vector2(0, 5f), - Scale = new Vector2(1.5f), - Children = new Drawable[] { flagSprite = new Sprite @@ -174,6 +173,7 @@ namespace osu.Game.Screens.Tournament protected override void LoadComplete() { base.LoadComplete(); + innerContainer.ScaleTo(1.5f); innerContainer.ScaleTo(1f, 200); } diff --git a/osu.Game/Screens/Tournament/GroupsContainer.cs b/osu.Game/Screens/Tournament/GroupsContainer.cs index a67d1a0d2d..feabac9942 100644 --- a/osu.Game/Screens/Tournament/GroupsContainer.cs +++ b/osu.Game/Screens/Tournament/GroupsContainer.cs @@ -1,33 +1,33 @@ -using OpenTK; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.Tournament.Teams; +using OpenTK; namespace osu.Game.Screens.Tournament { public class GroupsContainer : Container { - private FlowContainer topGroups; - private FlowContainer bottomGroups; - - private List allGroups = new List(); + private List groups = new List(); private int maxTeams; private int currentGroup; public GroupsContainer(int numGroups, int teamsPerGroup) { + FlowContainer bottomGroups; + FlowContainer topGroups; + maxTeams = teamsPerGroup; char nextGroupName = 'A'; Children = new[] { - topGroups = new FillFlowContainer() + topGroups = new FillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Tournament Spacing = new Vector2(7f, 0) }, - bottomGroups = new FillFlowContainer() + bottomGroups = new FillFlowContainer { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Tournament { Group g = new Group(nextGroupName.ToString()); - allGroups.Add(g); + groups.Add(g); nextGroupName++; if (i < (int)Math.Ceiling(numGroups / 2f)) @@ -63,37 +63,37 @@ namespace osu.Game.Screens.Tournament public void AddTeam(Team team) { - if (allGroups[currentGroup].TeamsCount == maxTeams) + if (groups[currentGroup].TeamsCount == maxTeams) return; - allGroups[currentGroup].AddTeam(team); + groups[currentGroup].AddTeam(team); - currentGroup = (currentGroup + 1) % allGroups.Count; + currentGroup = (currentGroup + 1) % groups.Count; } public bool ContainsTeam(string fullName) { - return allGroups.Any(g => g.ContainsTeam(fullName)); + return groups.Any(g => g.ContainsTeam(fullName)); } public void ClearTeams() { - foreach (Group g in allGroups) + foreach (Group g in groups) g.ClearTeams(); currentGroup = 0; } - public string ToStringRepresentation() + public string GetStringRepresentation() { StringBuilder sb = new StringBuilder(); - foreach (Group g in allGroups) + foreach (Group g in groups) { - if (g != allGroups.First()) + if (g != groups.First()) sb.AppendLine(); sb.AppendLine($"Group {g.GroupName}"); - sb.Append(g.ToStringRepresentation()); + sb.Append(g.GetStringRepresentation()); } return sb.ToString(); diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 64dd0f88b7..35369247ff 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Threading; +using osu.Game.Screens.Tournament.Teams; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Tournament/ITeamList.cs b/osu.Game/Screens/Tournament/Teams/ITeamList.cs similarity index 83% rename from osu.Game/Screens/Tournament/ITeamList.cs rename to osu.Game/Screens/Tournament/Teams/ITeamList.cs index b450b2fbb6..a4476b64c6 100644 --- a/osu.Game/Screens/Tournament/ITeamList.cs +++ b/osu.Game/Screens/Tournament/Teams/ITeamList.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace osu.Game.Screens.Tournament +namespace osu.Game.Screens.Tournament.Teams { public interface ITeamList { diff --git a/osu.Game/Screens/Tournament/FileTeamList.cs b/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs similarity index 90% rename from osu.Game/Screens/Tournament/FileTeamList.cs rename to osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs index 3eadec5114..7de48dd55b 100644 --- a/osu.Game/Screens/Tournament/FileTeamList.cs +++ b/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs @@ -1,21 +1,21 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Logging; -using osu.Framework.Platform; using System; using System.Collections.Generic; using System.IO; +using osu.Framework.Logging; +using osu.Framework.Platform; -namespace osu.Game.Screens.Tournament +namespace osu.Game.Screens.Tournament.Teams { - public class FileTeamList : ITeamList + public class StorageBackedTeamList : ITeamList { private const string teams_filename = "drawings.txt"; private Storage storage; - public FileTeamList(Storage storage) + public StorageBackedTeamList(Storage storage) { this.storage = storage; } diff --git a/osu.Game/Screens/Tournament/Team.cs b/osu.Game/Screens/Tournament/Teams/Team.cs similarity index 89% rename from osu.Game/Screens/Tournament/Team.cs rename to osu.Game/Screens/Tournament/Teams/Team.cs index 6e5fd7c35a..226f35ec1d 100644 --- a/osu.Game/Screens/Tournament/Team.cs +++ b/osu.Game/Screens/Tournament/Teams/Team.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Screens.Tournament +namespace osu.Game.Screens.Tournament.Teams { public class Team { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 55602110f6..4a84f91aa3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -216,10 +216,10 @@ - + - - + +