private void LoadData() { // Load items System.IO.Stream dataStream = Application.GetResourceStream(new Uri(@"/QuizLeague;component/Assets/Initial/Data/items.json", UriKind.Relative)).Stream; using (StreamReader reader = new StreamReader(dataStream)) { JObject o = (JObject)JToken.ReadFrom(new JsonTextReader(reader)); foreach (KeyValuePair<string, JToken> x in o) { Item item = new Item(Convert.ToInt32(x.Key.ToString()), x.Value["name"].ToString(), x.Value["description"].ToString()); item.Image = "Assets/Initial/Images/Items/" + x.Value["image"].ToString(); foreach (string itemId in x.Value["into"].ToObject<List<string>>()) item.UsedTo.Add(Convert.ToInt16(itemId)); foreach (string itemId in x.Value["from"].ToObject<List<string>>()) item.CreatedFrom.Add(Convert.ToInt16(itemId)); } } // Load characters & skills dataStream = Application.GetResourceStream(new Uri(@"/QuizLeague;component/Assets/Initial/Data/characters.json", UriKind.Relative)).Stream; using (StreamReader reader = new StreamReader(dataStream)) { JObject o = (JObject)JToken.ReadFrom(new JsonTextReader(reader)); foreach (KeyValuePair<string, JToken> x in o) { Character character = new Character(x.Key.ToString(), x.Value["name"].ToString(), x.Value["description"].ToString()); character.Image = "Assets/Initial/" + x.Value["image"].ToString(); foreach (Skill characterSkill in x.Value["skills"].ToObject<List<Skill>>()) { characterSkill.Image = "Assets/Initial/" + characterSkill.Image; characterSkill.Character = character; character.SkillList.Add(characterSkill); Skill.SkillList.Add(characterSkill); } } } // Load countries dataStream = Application.GetResourceStream(new Uri(@"/QuizLeague;component/Assets/Initial/Data/countries.json", UriKind.Relative)).Stream; using (StreamReader reader = new StreamReader(dataStream)) { JObject o = (JObject)JToken.ReadFrom(new JsonTextReader(reader)); foreach (KeyValuePair<string, JToken> x in o) { Country country = new Country(); country.Iso = x.Key.ToString(); country.Name = x.Value.ToString(); Country.CountryList.Add(country); } } }
public ScoreResult(int points, String playerName, Country playerCountry) { Points = points; PlayerName = playerName; PlayerCountry = playerCountry; }