mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Replace countries.json
with country enum and acronym extension
This commit is contained in:
@ -3,13 +3,13 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -45,11 +45,17 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
private void addAllCountries()
|
||||
{
|
||||
List<TournamentTeam> countries;
|
||||
var countries = new List<TournamentTeam>();
|
||||
|
||||
using (Stream stream = game.Resources.GetStream("Resources/countries.json"))
|
||||
using (var sr = new StreamReader(stream))
|
||||
countries = JsonConvert.DeserializeObject<List<TournamentTeam>>(sr.ReadToEnd());
|
||||
foreach (var country in Enum.GetValues(typeof(Country)).Cast<Country>().Skip(1))
|
||||
{
|
||||
countries.Add(new TournamentTeam
|
||||
{
|
||||
FlagName = { Value = country.ToString() },
|
||||
FullName = { Value = country.GetDescription() },
|
||||
Acronym = { Value = country.GetAcronym() },
|
||||
});
|
||||
}
|
||||
|
||||
Debug.Assert(countries != null);
|
||||
|
||||
|
Reference in New Issue
Block a user