Пример #1
0
        private void OpenScoringWindow(SessionConfigParams configParams)
        {
            Window w = new ScoringWindow();
            ScoringWindowViewModel vm = ContainerHelper.Container.Resolve <ScoringWindowViewModel>();
            GameState gs = GameStateFactory.GetNewGameState(configParams);

            vm.SetCurrentGameState(gs);
            w.DataContext = vm;
            w.Show();
            NavToStartSession();
        }
Пример #2
0
        public static GameState GetNewGameState(SessionConfigParams config)
        {
            GameState gs = new GameState();

            gs.NumRounds            = config.NumberOfRounds;
            gs.NumQuestionsPerRound = config.NumberOfQuestions;
            gs.FileName             = config.FileName;
            List <ActiveScorer> activeScorers = new List <ActiveScorer>();

            foreach (var s in config.Scorers)
            {
                activeScorers.Add(new ActiveScorer(s, config.NumberOfRounds, config.NumberOfQuestions, config.PointsPerQuestion));
            }
            gs.ActiveScorers = activeScorers;

            return(gs);
        }
Пример #3
0
        public GameState LoadGame(string name)
        {
            SessionConfigParams session = SessionSerialization.LoadSession(_repo, name);
            GameState           gs      = GameStateFactory.GetNewGameState(session);

            List <GameSaveParams> gameData = JsonConvert.DeserializeObject <List <GameSaveParams> >(File.ReadAllText(ConfigurationManager.AppSettings["game_save_config"] + name));

            Dictionary <string, List <List <Question> > > table = new Dictionary <string, List <List <Question> > >();

            foreach (var entry in gameData)
            {
                table.Add(entry.TeamName, entry.Answers);
            }

            foreach (var scorer in gs.ActiveScorers)
            {
                foreach (var team in scorer.ScoringTeams)
                {
                    team.SetAllAnswers(table[team.Team.Name]);
                }
            }

            return(gs);
        }
Пример #4
0
 private void NavToConfirmSession(SessionConfigParams configParams)
 {
     _sessionStartConfirmViewModel.SetSessionConfig(configParams);
     CurrentViewModel = _sessionStartConfirmViewModel;
 }
Пример #5
0
 private void NavToSaveConfig(SessionConfigParams configParams)
 {
     _saveSessionConfigViewModel.SessionConfigParams = configParams;
     CurrentViewModel = _saveSessionConfigViewModel;
 }