示例#1
0
 private IEnumerator DoTest(Func <IEnumerator> CoroutineFunc)
 {
     ConfigAI.StartTeacherReport();
     ApplyParameters();
     InitialisePlaySession();
     for (int i = 1; i <= numberOfSimulations; i++)
     {
         Debug.Log("************ Simulation " + i + " ************");
         ConfigAI.AppendToTeacherReport("************ Simulation " + i + " ************");
         yield return(StartCoroutine(CoroutineFunc()));
     }
     ConfigAI.PrintTeacherReport();
 }
示例#2
0
        /// <summary>
        /// Prepare the context and start a minigame.
        /// </summary>
        /// <param name="gameCode">The minigame code.</param>
        /// <param name="launchConfig">The launch configuration. If null, the Teacher will generate a new one.</param>
        public void LaunchGame(MiniGameCode gameCode, MinigameLaunchConfiguration launchConfig)
        {
            LastLaunchConfig = launchConfig;

            ConfigAI.StartTeacherReport();

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

            if (launchConfig.DirectGame)
            {
                AppManager.I.NavigationManager.InitNewPlaySession(true, miniGameData);
            }

            if (ApplicationConfig.I.DebugLogEnabled)
            {
                Debug.Log("StartGame " + gameCode.ToString());
                Debug.Log(launchConfig);
            }

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

            currentGameConfig = ConfigureMiniGameScene(gameCode, minigameSession, launchConfig);

            // 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();
        }
示例#3
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();
        }