Back to sanity.

This commit is contained in:
smoogipooo 2017-05-02 14:21:22 +09:00
parent f17046abaf
commit 91e000fd44
5 changed files with 20 additions and 35 deletions

@ -1 +1 @@
Subproject commit a093c6cb70c145168ac359193e72176bf00ee20a
Subproject commit cc69416da0e6b04c9a372ac821bfe201cec0d174

View File

@ -47,17 +47,18 @@ namespace osu.Game.Screens.Tournament
public ITeamList TeamList;
protected override DependencyContainer CreateLocalDependencies(DependencyContainer parent) => new DependencyContainer(parent);
[BackgroundDependencyLoader]
private void load(TextureStore textures, Storage storage)
private void load(TextureStore textures, Storage storage, DependencyContainer dependencies)
{
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<byte[]>(new StorageBackedResourceStore(storage), "Drawings")));
flagStore.AddStore(textures);
dependencies.Cache(flagStore);
if (TeamList == null)
TeamList = new StorageBackedTeamList(storage);
@ -110,7 +111,7 @@ namespace osu.Game.Screens.Tournament
Lines = 6
},
// Groups
groupsContainer = new GroupContainer(drawingsConfig.Get<int>(DrawingsConfig.Groups), drawingsConfig.Get<int>(DrawingsConfig.TeamsPerGroup), flagStore)
groupsContainer = new GroupContainer(drawingsConfig.Get<int>(DrawingsConfig.Groups), drawingsConfig.Get<int>(DrawingsConfig.TeamsPerGroup))
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@ -125,7 +126,7 @@ namespace osu.Game.Screens.Tournament
}
},
// Scrolling teams
teamsContainer = new ScrollingTeamContainer(flagStore)
teamsContainer = new ScrollingTeamContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -73,9 +73,9 @@ namespace osu.Game.Screens.Tournament
};
}
public void AddTeam(Team team, TextureStore flagStore)
public void AddTeam(Team team)
{
GroupTeam gt = new GroupTeam(team, flagStore);
GroupTeam gt = new GroupTeam(team);
if (TeamsCount < 8)
{
@ -127,12 +127,8 @@ namespace osu.Game.Screens.Tournament
private readonly FillFlowContainer innerContainer;
private readonly Sprite flagSprite;
private readonly TextureStore flagStore;
public GroupTeam(Team team, TextureStore flagStore)
public GroupTeam(Team team)
{
this.flagStore = flagStore;
Team = team;
Width = 36;
@ -182,9 +178,9 @@ namespace osu.Game.Screens.Tournament
}
[BackgroundDependencyLoader]
private void load()
private void load(TextureStore textures)
{
flagSprite.Texture = flagStore.Get($@"Flags/{Team.FlagName}");
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
}
}
}

View File

@ -20,12 +20,8 @@ namespace osu.Game.Screens.Tournament
private readonly int maxTeams;
private int currentGroup;
private readonly TextureStore flagStore;
public GroupContainer(int numGroups, int teamsPerGroup, TextureStore flagStore)
public GroupContainer(int numGroups, int teamsPerGroup)
{
this.flagStore = flagStore;
FlowContainer<Group> bottomGroups;
FlowContainer<Group> topGroups;
@ -74,7 +70,7 @@ namespace osu.Game.Screens.Tournament
if (groups[currentGroup].TeamsCount == maxTeams)
return;
groups[currentGroup].AddTeam(team, flagStore);
groups[currentGroup].AddTeam(team);
currentGroup = (currentGroup + 1) % groups.Count;
}

View File

@ -39,12 +39,8 @@ namespace osu.Game.Screens.Tournament
private ScheduledDelegate delayedStateChangeDelegate;
private TextureStore flagStore;
public ScrollingTeamContainer(TextureStore flagStore)
public ScrollingTeamContainer()
{
this.flagStore = flagStore;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
@ -276,7 +272,7 @@ namespace osu.Game.Screens.Tournament
{
foreach (Team t in availableTeams)
{
Add(new ScrollingTeam(t, flagStore)
Add(new ScrollingTeam(t)
{
X = leftPos + DrawWidth
});
@ -344,12 +340,8 @@ namespace osu.Game.Screens.Tournament
}
}
private TextureStore flagStore;
public ScrollingTeam(Team team, TextureStore flagStore)
public ScrollingTeam(Team team)
{
this.flagStore = flagStore;
Team = team;
Anchor = Anchor.CentreLeft;
@ -379,9 +371,9 @@ namespace osu.Game.Screens.Tournament
}
[BackgroundDependencyLoader]
private void load()
private void load(TextureStore textures)
{
flagSprite.Texture = flagStore.Get($@"Flags/{Team.FlagName}");
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
}
}
}