Ejemplo n.º 1
0
        public void DifficultySelectionTest()
        {
            var minigameCode = RandomHelper.GetRandomEnum <MiniGameCode>();

            for (int i = 0; i < 10; i++)
            {
                var score = RND.Range(0, 4);
                var data  = new LogMiniGameScoreData(0, JourneyPosition.InitialJourneyPosition, minigameCode, score, RND.Range(1, 15f));
                dbManager.Insert(data);
            }

            var difficulty = teacherAI.GetCurrentDifficulty(minigameCode);

            string output = "Minigame " + minigameCode + " selected difficulty " + difficulty;

            PrintOutput(output);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prepare the context and start a minigame.
        /// </summary>
        /// <param name="_gameCode">The minigame code.</param>
        /// <param name="_launchConfiguration">The launch configuration. If null, the Teacher will generate a new one.</param>
        /// <param name="forceNewPlaySession">Is this a new play session?</param>
        public void LaunchGame(MiniGameCode _gameCode, MinigameLaunchConfiguration _launchConfiguration = null,
                               bool forceNewPlaySession = false)
        {
            ConfigAI.StartTeacherReport();
            if (_launchConfiguration == null)
            {
                var difficulty      = teacher.GetCurrentDifficulty(_gameCode);
                var numberOfRounds  = teacher.GetCurrentNumberOfRounds(_gameCode);
                var tutorialEnabled = teacher.GetTutorialEnabled(_gameCode);
                _launchConfiguration = new MinigameLaunchConfiguration(difficulty, numberOfRounds, tutorialEnabled);
            }

            var miniGameData = AppManager.I.DB.GetMiniGameDataByCode(_gameCode);

            if (forceNewPlaySession)
            {
                AppManager.I.NavigationManager.InitNewPlaySession(miniGameData);
            }

            if (AppConfig.DebugLogEnabled)
            {
                Debug.Log("StartGame " + _gameCode.ToString());
            }

            // Assign the configuration for the given minigame
            var minigameSession = System.DateTime.Now.Ticks.ToString();

            currentGameConfig                 = ConfigureMiniGameScene(_gameCode, minigameSession);
            currentGameConfig.Difficulty      = _launchConfiguration.Difficulty;
            currentGameConfig.TutorialEnabled = _launchConfiguration.TutorialEnabled;

            // Set also the number of rounds
            // @note: only for assessment, for now
            if (currentGameConfig is Assessment.IAssessmentConfiguration)
            {
                var assessmentConfig = currentGameConfig as Assessment.IAssessmentConfiguration;
                assessmentConfig.NumberOfRounds = _launchConfiguration.NumberOfRounds;
            }

            // Retrieve the packs for the current minigame configuration
            currentQuestionBuilder      = currentGameConfig.SetupBuilder();
            currentQuestionPacks        = questionPacksGenerator.GenerateQuestionPacks(currentQuestionBuilder);
            currentGameConfig.Questions = new SequentialQuestionPackProvider(currentQuestionPacks);

            // Communicate to LogManager the start of a new single minigame play session.
            if (AppConfig.DebugLogDbInserts)
            {
                Debug.Log("InitGameplayLogSession " + _gameCode.ToString());
            }
            LogManager.I.LogInfo(InfoEvent.GameStart, "{\"minigame\":\"" + _gameCode.ToString() + "\"}");
            LogManager.I.StartMiniGame();

            // Print the teacher's report now
            ConfigAI.PrintTeacherReport();

            // Play the title dialog for the game
            //AudioManager.I.PlayDialogue(_gameCode.ToString()+"_Title");

            // Launch the game
            AppManager.I.NavigationManager.GoToMiniGameScene();
        }