diff --git a/osu-framework b/osu-framework index 58c108309f..72525837cf 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 58c108309f72462d8dc45aa488ab78cd6db08cf1 +Subproject commit 72525837cf68aa9967cfede6fbe95489ed3b05ec diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index a0463516de..ebc9930f93 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using osu.Framework.Testing; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; -using osu.Game.Users; namespace osu.Desktop.VisualTests.Tests { @@ -25,57 +24,57 @@ namespace osu.Desktop.VisualTests.Tests private class TestTeamList : ITeamList { - public IEnumerable Teams { get; } = new[] + public IEnumerable Teams { get; } = new[] { - new Country + new DrawingsTeam { FlagName = "GB", FullName = "United Kingdom", Acronym = "UK" }, - new Country + new DrawingsTeam { FlagName = "FR", FullName = "France", Acronym = "FRA" }, - new Country + new DrawingsTeam { FlagName = "CN", FullName = "China", Acronym = "CHN" }, - new Country + new DrawingsTeam { FlagName = "AU", FullName = "Australia", Acronym = "AUS" }, - new Country + new DrawingsTeam { FlagName = "JP", FullName = "Japan", Acronym = "JPN" }, - new Country + new DrawingsTeam { FlagName = "RO", FullName = "Romania", Acronym = "ROM" }, - new Country + new DrawingsTeam { FlagName = "IT", FullName = "Italy", Acronym = "PIZZA" }, - new Country + new DrawingsTeam { FlagName = "VE", FullName = "Venezuela", Acronym = "VNZ" }, - new Country + new DrawingsTeam { FlagName = "US", FullName = "United States of America", diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs index 44430fe6bc..8b7a099b9a 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Mods protected override Score CreateReplayScore(Beatmap beatmap) => new Score { User = new User { Username = "mekkadosu!" }, - Replay = new TaikoAutoReplay(beatmap).Generate(), + Replay = new TaikoAutoGenerator(beatmap).Generate(), }; } } diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs similarity index 90% rename from osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs rename to osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index 0af8e2822b..eec614426f 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -7,16 +7,24 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Replays; +using osu.Game.Users; namespace osu.Game.Rulesets.Taiko.Replays { - public class TaikoAutoReplay : AutoGenerator + public class TaikoAutoGenerator : AutoGenerator { private const double swell_hit_speed = 50; - public TaikoAutoReplay(Beatmap beatmap) + public TaikoAutoGenerator(Beatmap beatmap) : base(beatmap) { + Replay = new Replay + { + User = new User + { + Username = @"Autoplay", + } + }; } protected Replay Replay; diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f890e32f90..983dc72d9e 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -79,7 +79,7 @@ - + diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 9798b4e479..eada42a53e 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -21,7 +21,7 @@ using osu.Game.Screens.Tournament.Components; using osu.Game.Screens.Tournament.Teams; using OpenTK; using OpenTK.Graphics; -using osu.Game.Users; +using osu.Framework.IO.Stores; namespace osu.Game.Screens.Tournament { @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Tournament private GroupContainer groupsContainer; private OsuSpriteText fullTeamNameText; - private readonly List allTeams = new List(); + private readonly List allTeams = new List(); private DrawingsConfigManager drawingsConfig; @@ -47,11 +47,21 @@ 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; + TextureStore flagStore = new TextureStore(); + // Local flag store + flagStore.AddStore(new RawTextureLoaderStore(new NamespacedResourceStore(new StorageBackedResourceStore(storage), "Drawings"))); + // Default texture store + flagStore.AddStore(textures); + + dependencies.Cache(flagStore); + if (TeamList == null) TeamList = new StorageBackedTeamList(storage); @@ -239,7 +249,7 @@ namespace osu.Game.Screens.Tournament reset(true); } - private void onTeamSelected(Country team) + private void onTeamSelected(DrawingsTeam team) { groupsContainer.AddTeam(team); @@ -276,7 +286,7 @@ namespace osu.Game.Screens.Tournament teamsContainer.ClearTeams(); allTeams.Clear(); - foreach (Country t in TeamList.Teams) + foreach (DrawingsTeam t in TeamList.Teams) { if (groupsContainer.ContainsTeam(t.FullName)) continue; @@ -312,7 +322,7 @@ namespace osu.Game.Screens.Tournament if (line.ToUpper().StartsWith("GROUP")) continue; - Country teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line); + DrawingsTeam teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line); if (teamToAdd == null) continue; diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 6847c97be8..f5695ae1cb 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -using osu.Game.Users; +using osu.Game.Screens.Tournament.Teams; namespace osu.Game.Screens.Tournament { @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Tournament }; } - public void AddTeam(Country team) + public void AddTeam(DrawingsTeam team) { GroupTeam gt = new GroupTeam(team); @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Tournament return allTeams.Any(t => t.Team.FullName == fullName); } - public bool RemoveTeam(Country team) + public bool RemoveTeam(DrawingsTeam team) { allTeams.RemoveAll(gt => gt.Team == team); @@ -122,12 +122,12 @@ namespace osu.Game.Screens.Tournament private class GroupTeam : Container { - public readonly Country Team; + public readonly DrawingsTeam Team; private readonly FillFlowContainer innerContainer; private readonly Sprite flagSprite; - public GroupTeam(Country team) + public GroupTeam(DrawingsTeam team) { Team = team; diff --git a/osu.Game/Screens/Tournament/GroupContainer.cs b/osu.Game/Screens/Tournament/GroupContainer.cs index a3c53f2076..ba73a61c92 100644 --- a/osu.Game/Screens/Tournament/GroupContainer.cs +++ b/osu.Game/Screens/Tournament/GroupContainer.cs @@ -8,7 +8,7 @@ using System.Text; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; -using osu.Game.Users; +using osu.Game.Screens.Tournament.Teams; namespace osu.Game.Screens.Tournament { @@ -64,7 +64,7 @@ namespace osu.Game.Screens.Tournament } } - public void AddTeam(Country team) + public void AddTeam(DrawingsTeam team) { if (groups[currentGroup].TeamsCount == maxTeams) return; diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 5783893b3d..3eea239f55 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -15,16 +15,16 @@ using osu.Framework.Graphics.Transforms; using osu.Framework.Threading; using OpenTK; using OpenTK.Graphics; -using osu.Game.Users; +using osu.Game.Screens.Tournament.Teams; namespace osu.Game.Screens.Tournament { public class ScrollingTeamContainer : Container { public event Action OnScrollStarted; - public event Action OnSelected; + public event Action OnSelected; - private readonly List availableTeams = new List(); + private readonly List availableTeams = new List(); private readonly Container tracker; @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Tournament } } - public void AddTeam(Country team) + public void AddTeam(DrawingsTeam team) { if (availableTeams.Contains(team)) return; @@ -169,12 +169,12 @@ namespace osu.Game.Screens.Tournament scrollState = ScrollState.Idle; } - public void AddTeams(IEnumerable teams) + public void AddTeams(IEnumerable teams) { if (teams == null) return; - foreach (Country t in teams) + foreach (DrawingsTeam t in teams) AddTeam(t); } @@ -185,7 +185,7 @@ namespace osu.Game.Screens.Tournament scrollState = ScrollState.Idle; } - public void RemoveTeam(Country team) + public void RemoveTeam(DrawingsTeam team) { availableTeams.Remove(team); @@ -270,7 +270,7 @@ namespace osu.Game.Screens.Tournament private void addFlags() { - foreach (Country t in availableTeams) + foreach (DrawingsTeam t in availableTeams) { Add(new ScrollingTeam(t) { @@ -320,7 +320,7 @@ namespace osu.Game.Screens.Tournament public const float WIDTH = 58; public const float HEIGHT = 41; - public Country Team; + public DrawingsTeam Team; private readonly Sprite flagSprite; private readonly Box outline; @@ -340,7 +340,7 @@ namespace osu.Game.Screens.Tournament } } - public ScrollingTeam(Country team) + public ScrollingTeam(DrawingsTeam team) { Team = team; diff --git a/osu.Game/Screens/Tournament/Teams/DrawingsTeam.cs b/osu.Game/Screens/Tournament/Teams/DrawingsTeam.cs new file mode 100644 index 0000000000..2739711c35 --- /dev/null +++ b/osu.Game/Screens/Tournament/Teams/DrawingsTeam.cs @@ -0,0 +1,23 @@ +// 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.Teams +{ + public class DrawingsTeam + { + /// + /// The name of this team. + /// + public string FullName; + + /// + /// Short acronym which appears in the group boxes post-selection. + /// + public string Acronym; + + /// + /// Name of the file containing the flag. + /// + public string FlagName; + } +} diff --git a/osu.Game/Screens/Tournament/Teams/ITeamList.cs b/osu.Game/Screens/Tournament/Teams/ITeamList.cs index d4b644e2aa..9427ebc7fb 100644 --- a/osu.Game/Screens/Tournament/Teams/ITeamList.cs +++ b/osu.Game/Screens/Tournament/Teams/ITeamList.cs @@ -2,12 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Game.Users; namespace osu.Game.Screens.Tournament.Teams { public interface ITeamList { - IEnumerable Teams { get; } + IEnumerable Teams { get; } } } diff --git a/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs b/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs index 7dd333cdbc..1b2d84a666 100644 --- a/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs +++ b/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using osu.Framework.Logging; using osu.Framework.Platform; -using osu.Game.Users; namespace osu.Game.Screens.Tournament.Teams { @@ -21,16 +20,16 @@ namespace osu.Game.Screens.Tournament.Teams this.storage = storage; } - public IEnumerable Teams + public IEnumerable Teams { get { - var teams = new List(); + var teams = new List(); try { using (Stream stream = storage.GetStream(teams_filename, FileAccess.Read, FileMode.Open)) - using (StreamReader sr = new StreamReader(stream)) + using (var sr = new StreamReader(stream)) { while (sr.Peek() != -1) { @@ -53,7 +52,7 @@ namespace osu.Game.Screens.Tournament.Teams string acronym = split.Length >= 3 ? split[2].Trim() : teamName; acronym = acronym.Substring(0, Math.Min(3, acronym.Length)); - teams.Add(new Country + teams.Add(new DrawingsTeam { FlagName = flagName, FullName = teamName, diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index 729629bdb8..ac95d22329 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -18,11 +18,6 @@ namespace osu.Game.Users [JsonProperty(@"name")] public string FullName; - /// - /// Short acronym which appears in the group boxes post-selection. - /// - public string Acronym; - /// /// Two-letter flag acronym (ISO 3166 standard) /// diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d637660ea9..bf04ea6901 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -326,6 +326,7 @@ +