public String[] GetCategoriesNames() { StorageService ss = new StorageService(); QuestionsSet qs = ss.DeserializeFromXMLFile <QuestionsSet>(@"..\..\pytania.xml"); return(qs.Questions.Keys.ToArray()); }
//QUESTION public GameState RandomQuestion(GameState gamestate, String CategoryName, QuestionsSet qs) { gamestate.Question = qs.Questions[CategoryName].Where(q => q.Used == false) .TakeRandom(Random); gamestate.QuestionCount += 1; return(gamestate); }
public GameState OneOnOneCategories(GameState gamestate, QuestionsSet questionset) { gamestate.OneOnOneCategories = new Dictionary <string, bool>(); var rand = new Random(); do { var category = QuestionsSet.Current.Questions.Keys.ToArray().TakeRandom(rand); if (gamestate.OneOnOneCategories.ContainsKey(category) == false) { gamestate.OneOnOneCategories.Add(category, true); } } while (gamestate.OneOnOneCategories.Keys.Count < 9); return(gamestate); }