diff --git a/osu-framework b/osu-framework index b25ed4291b..a093c6cb70 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b25ed4291bb8a8a38faf404c68b3f97efc9d3413 +Subproject commit a093c6cb70c145168ac359193e72176bf00ee20a diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 263319d4e5..4ef3face07 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -52,6 +52,12 @@ namespace osu.Game.Screens.Tournament { this.storage = storage; + // Todo: The way this is done is a haaaaaaaaaaaaaaack. + // Currently this store is being passed down all the way to ScrollingTeam/GroupTeam + // but it should replace the TextureStore DI item instead. This is pending some significant DI improvements. + TextureStore flagStore = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore(new StorageBackedResourceStore(storage), "Drawings"))); + flagStore.AddStore(textures); + if (TeamList == null) TeamList = new StorageBackedTeamList(storage); @@ -104,7 +110,7 @@ namespace osu.Game.Screens.Tournament Lines = 6 }, // Groups - groupsContainer = new GroupContainer(drawingsConfig.Get(DrawingsConfig.Groups), drawingsConfig.Get(DrawingsConfig.TeamsPerGroup)) + groupsContainer = new GroupContainer(drawingsConfig.Get(DrawingsConfig.Groups), drawingsConfig.Get(DrawingsConfig.TeamsPerGroup), flagStore) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -119,7 +125,7 @@ namespace osu.Game.Screens.Tournament } }, // Scrolling teams - teamsContainer = new ScrollingTeamContainer + teamsContainer = new ScrollingTeamContainer(flagStore) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 697ae17e95..36b8b29e26 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -73,9 +73,9 @@ namespace osu.Game.Screens.Tournament }; } - public void AddTeam(Team team) + public void AddTeam(Team team, TextureStore flagStore) { - GroupTeam gt = new GroupTeam(team); + GroupTeam gt = new GroupTeam(team, flagStore); if (TeamsCount < 8) { @@ -127,8 +127,12 @@ namespace osu.Game.Screens.Tournament private readonly FillFlowContainer innerContainer; private readonly Sprite flagSprite; - public GroupTeam(Team team) + private readonly TextureStore flagStore; + + public GroupTeam(Team team, TextureStore flagStore) { + this.flagStore = flagStore; + Team = team; Width = 36; @@ -178,9 +182,9 @@ namespace osu.Game.Screens.Tournament } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load() { - flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); + flagSprite.Texture = flagStore.Get($@"Flags/{Team.FlagName}"); } } } diff --git a/osu.Game/Screens/Tournament/GroupContainer.cs b/osu.Game/Screens/Tournament/GroupContainer.cs index bc4c3b71c3..e789c871b7 100644 --- a/osu.Game/Screens/Tournament/GroupContainer.cs +++ b/osu.Game/Screens/Tournament/GroupContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; using osu.Game.Screens.Tournament.Teams; +using osu.Framework.Graphics.Textures; namespace osu.Game.Screens.Tournament { @@ -19,8 +20,12 @@ namespace osu.Game.Screens.Tournament private readonly int maxTeams; private int currentGroup; - public GroupContainer(int numGroups, int teamsPerGroup) + private readonly TextureStore flagStore; + + public GroupContainer(int numGroups, int teamsPerGroup, TextureStore flagStore) { + this.flagStore = flagStore; + FlowContainer bottomGroups; FlowContainer topGroups; @@ -69,7 +74,7 @@ namespace osu.Game.Screens.Tournament if (groups[currentGroup].TeamsCount == maxTeams) return; - groups[currentGroup].AddTeam(team); + groups[currentGroup].AddTeam(team, flagStore); currentGroup = (currentGroup + 1) % groups.Count; } diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 4ae26d3a67..d46edd48f1 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -39,8 +39,12 @@ namespace osu.Game.Screens.Tournament private ScheduledDelegate delayedStateChangeDelegate; - public ScrollingTeamContainer() + private TextureStore flagStore; + + public ScrollingTeamContainer(TextureStore flagStore) { + this.flagStore = flagStore; + AutoSizeAxes = Axes.Y; Children = new Drawable[] @@ -272,7 +276,7 @@ namespace osu.Game.Screens.Tournament { foreach (Team t in availableTeams) { - Add(new ScrollingTeam(t) + Add(new ScrollingTeam(t, flagStore) { X = leftPos + DrawWidth }); @@ -340,8 +344,12 @@ namespace osu.Game.Screens.Tournament } } - public ScrollingTeam(Team team) + private TextureStore flagStore; + + public ScrollingTeam(Team team, TextureStore flagStore) { + this.flagStore = flagStore; + Team = team; Anchor = Anchor.CentreLeft; @@ -371,9 +379,9 @@ namespace osu.Game.Screens.Tournament } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load() { - flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); + flagSprite.Texture = flagStore.Get($@"Flags/{Team.FlagName}"); } } }