示例#1
0
        public void QuestionGenerator_Can_GetNextQuestion()
        {
            //Arrange
            //constructor args = ICareUow
            //method args = Test test, Question prevQuestion, ITestLogic logic
            int      questionId     = 1;
            int      nextQuestionId = questionId + 1;
            Test     mockTest       = new Test();
            Question mockQuestion   = new Question();

            Mock <ICareUow>   mockUow       = new Mock <ICareUow>();
            Mock <ITestLogic> mockTestLogic = new Mock <ITestLogic>();

            mockTestLogic.Setup(m => m.GetQuestionId(mockTest, mockQuestion, mockUow.Object)).Returns(nextQuestionId);
            mockUow.Setup(m => m.Questions.GetById(nextQuestionId)).Returns(new Question {
                Id = nextQuestionId
            });
            QuestionGenerator target = new QuestionGenerator(mockUow.Object);

            //Act
            Question question = target.GetNextQuestion(mockTest, mockQuestion, mockTestLogic.Object);

            //Assert
            Assert.IsNotNull(question);
            Assert.AreEqual(question.Id, nextQuestionId);
        }
 void Start()
 {
     animations        = GetComponent <AnimationHandler>();
     questionGenerator = GetComponent <QuestionGenerator>();
     profile           = GameObject.Find("ProfileData").GetComponent <Profile>();
     audioScript       = GameObject.Find("AudioManager").GetComponent <PlayAudio>();
 }
示例#3
0
文件: TestSuite.cs 项目: zainsra7/FKG
        public void Setup()
        {
            GameObject qaGameObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Logic/QuestionGenerator"));

            questionGenerator = qaGameObject.GetComponent <QuestionGenerator>();
            GameObject characterObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Character"));

            character = characterObject.GetComponent <CharacterLogic>();
            GameObject globalObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Logic/GlobalState"));

            global = globalObject.GetComponent <GameLogic>();
            GameObject canvasObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Logic/Canvas"));

            canvas                    = canvasObject.GetComponent <UILogic>();
            canvas.global             = globalObject;
            canvas.currentFriendIndex = -1;
            canvas.currentEnemyIndex  = -1;
            global.uiLogic            = canvasObject;
            global.isTestMode         = true;
            global.isGuestMode        = true;
            global.setupGame(false);
            character.global = globalObject;
            InputField questionInputField = GameObject.Instantiate(Resources.Load <InputField>("Prefabs/QuestionInputField"));

            global.inputField = questionInputField;
        }
        /// <summary>
        /// Returns a new question generator.
        /// </summary>
        private IQuestionGenerator GetQuestionGenerator(
            Question question,
            ICodeRunnerService codeRunnerService = null)
        {
            var javaModel = GetJavaModel();

            var codeGenFactory = GetMockCodeGenerationFactory
                                 (
                question,
                javaModel
                                 );

            var questionModelFactory = GetMockQuestionModelFactory
                                       (
                javaModel
                                       );

            var questionGenerator = new QuestionGenerator
                                    (
                codeGenFactory.Object,
                questionModelFactory.Object,
                codeRunnerService
                                    );

            return(questionGenerator);
        }
示例#5
0
 public GotQuizzViewModel()
 {
     _yes       = new RelayCommand(() => AnswerQuestion(true));
     _no        = new RelayCommand(() => AnswerQuestion(false));
     _generator = new QuestionGenerator();
     _api       = new GotApiService();
 }
        public void QuestionGeneratorTests_Division(int operatorIndex, int min, int max, int expectedQuestionCount)
        {
            //Arrange
            var configMock = Helper.SetupConfigMock(operatorIndex, min, max);

            //Act
            var questionGenerator = new QuestionGenerator(new RandomNumberGenerator(), configMock.Object);
            int poolSize          = (max - min + 1) * (max - min + 1);

            HashSet <string> questions = new HashSet <string>();

            int count        = 0;
            int divideByZero = 0;

            while (count < poolSize)
            {
                var question = questionGenerator.GenerateQuestion();
                ++count;

                var denominator = question.Pair.Number2;
                if (denominator == 0)
                {
                    ++divideByZero;
                }

                questions.Add(question.ToString());
            }

            //Assert
            Assert.Equal(expectedQuestionCount, questions.Count);
            Assert.Equal(0, divideByZero);
        }
示例#7
0
        public void TestService_Can_GetNextQuestion()
        {
            //Arrange
            //Constructor args ICareUow uow, TestLogicFactory factory, IQuestionGenerator questionGenerator
            //Method args Test test, Question prevQuestion
            RepositoryFactories factory    = new RepositoryFactories();
            RepositoryProvider  provider   = new RepositoryProvider(factory);
            CareUow             uow        = new CareUow(provider);
            TestLogicFactory    tFactory   = new TestLogicFactory();
            QuestionGenerator   qGenerator = new QuestionGenerator(uow);
            //TestService target = new TestService(uow, tFactory, qGenerator);
            TestService target = new TestService(uow, tFactory);
            Question    q      = new Question();

            q.Id = 1;
            Test t = new Test();

            t.Type = "sysr";
            t.Id   = 1;

            //Act
            Question next = target.GetNextQuestion(t, q);


            //Assert
            Assert.IsNotNull(next);
            Assert.AreEqual(next.Id, 2);
        }
示例#8
0
    private static List<QuestionGenerator> ParseQuestions(string filename, QuestionGenerator.GeneratorType type, int answersLine, int prefixesLine, int suffixesLine, int adjacentLine)
    {
        List<QuestionGenerator> generators = new List<QuestionGenerator>();

        string filePath = Path.Combine(Path.Combine(Application.dataPath, "StreamingAssets"), filename + ".txt");
        StreamReader fileStream = new StreamReader(new FileStream(filePath, FileMode.Open));
        string file = fileStream.ReadToEnd();
        string separator = file.Contains("\r") ? "\r\n" : "\n";
        string[] fileLines = file.Split(new string[] { separator }, System.StringSplitOptions.None);

        // Line 0 contains all the questions.
        string[] cells = fileLines[0].Split(new char[] { '\t' }, System.StringSplitOptions.None);
        int questionCount = (cells.Length - 1) / 2;
        for(int n = 0; n < questionCount; n++){
            generators.Add(new QuestionGenerator());
            generators[n].m_questionText = cells[2 * n + 1];
        }

        // Line containing infoPrefixes.
        if(prefixesLine >= 0){
            cells = fileLines[prefixesLine].Split(new char[] { '\t' }, System.StringSplitOptions.None);
            for(int n = 0; n < questionCount; n++){
                generators[n].m_infoPrefix = cells[2 * n + 2];
            }
        }

        // Line containing infoSuffixes.
        if(suffixesLine >= 0){
            cells = fileLines[suffixesLine].Split(new char[] { '\t' }, System.StringSplitOptions.None);
            for(int n = 0; n < questionCount; n++){
                generators[n].m_infoSuffix = cells[2 * n + 2];
            }
        }

        // Line containing adjacentWithin.
        if(adjacentLine >= 0){
            cells = fileLines[adjacentLine].Split(new char[] { '\t' }, System.StringSplitOptions.None);
            for(int n = 0; n < questionCount; n++){
                if(cells[2 * n + 1].Length <= 0) continue;
                generators[n].m_adjacentWithin = int.Parse(cells[2 * n + 1]);
            }
        }

        // Lines containing the data.
        for(int line = answersLine; line < fileLines.Length; line++){
            cells = fileLines[line].Split(new char[] { '\t' }, System.StringSplitOptions.None);
            if(cells[0].Equals("truncate at")) break;
            for(int n = 0; n < questionCount; n++){
                generators[n].AddAnswer(cells[2 * n + 1], cells[2 * n + 2], type == QuestionGenerator.GeneratorType.SortedMultiset);
            }
        }

        for(int n = generators.Count - 1; n >= 0; n--){
            generators[n].m_type = type;
            if(generators[n].AnswersCount <= 0) generators.RemoveAt(n);
        }

        return generators;
    }
示例#9
0
 private IEnumerator PlaceQuestions(bool playAudio = false)
 {
     QuestionPlacer.Place(QuestionGenerator.GetAllQuestions(), playAudio);
     while (QuestionPlacer.IsAnimating())
     {
         yield return(null);
     }
 }
 // Use this for initialization
 void Start()
 {
     rhand       = GameObject.Find("hand_right");
     correctness = GameObject.Find("Correctness");
     red         = Resources.Load("red", typeof(Material)) as Material;
     green       = Resources.Load("green", typeof(Material)) as Material;
     answer      = QuestionGenerator.getCorrectAnswer();
     touchframe  = 0;
     counter     = 0;
 }
示例#11
0
        private IEnumerator PlaceAnswers()
        {
            AnswerPlacer.Place(QuestionGenerator.GetAllAnswers());
            while (AnswerPlacer.IsAnimating())
            {
                yield return(null);
            }

            LogicInjector.AnswersAdded();
        }
示例#12
0
        private void InitRound()
        {
            QuestionGenerator.InitRound();

            for (int question = 0; question < Configuration.SimultaneosQuestions; question++)
            {
                WireLogicInjector(LogicInjector, QuestionGenerator);
            }

            LogicInjector.CompleteWiring();

            QuestionGenerator.CompleteRound();
        }
示例#13
0
文件: TestSuite.cs 项目: zainsra7/FKG
        public IEnumerator TestSuiteWithEnumeratorPasses()
        {
            // Use the Assert class to test conditions.
            GameObject questionGeneratorObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Logic/QuestionGenerator"));

            questionGenerator = questionGeneratorObject.GetComponent <QuestionGenerator>();
            string[] qa = questionGenerator.generateSequenceQuestion(1, 2);
            Debug.Log(qa[0]);
            // Use yield to skip a frame.
            yield return(null);

            Assert.Equals(0, 1);
        }
    private void Start()
    {
        // Gets the instance of QuestionGenorator class
        qGen = canvas.GetComponent <QuestionGenerator>();


        if (keywords != null)
        {
            recognizer = new KeywordRecognizer(keywords, confidence);
            recognizer.OnPhraseRecognized += Recognizer_OnPhraseRecognized;
            recognizer.Start();
        }
    }
示例#15
0
        private void newExQuestion()
        {
            Question     q    = QuestionGenerator.Generate(null, ExqList);
            QuestionCard card = new QuestionCard();

            card.Question   = q;
            card.QuestionNo = exQuestionNo;
            exQuestionNo++;
            card.Dock        = DockStyle.Right;
            card.BackColor   = Color.Transparent;
            card.OnAnswered += ExCard_OnAnswered;
            card.OnClosed   += ExCard_OnClosed;
            panelExQuestionAlign.Controls.Add(card);
        }
示例#16
0
        private void newQuestion()
        {
            Question     q    = QuestionGenerator.Generate(null, qList);
            QuestionCard card = new QuestionCard();

            card.Question   = q;
            card.QuestionNo = questionNo;
            questionNo++;
            card.Dock        = DockStyle.Bottom;
            card.BackColor   = Color.Transparent;
            card.OnAnswered += Card_OnAnswered;
            card.OnClosed   += Card_OnClosed;
            panelQuestionAlign.Controls.Add(card);
        }
示例#17
0
        public void GenerateQuestions(string topic)
        {
            topic = topic.Replace(" ", "_");
            var outputJsonPath = DirectoryManager.GetOutputJsonPath(topic);

            var tpr        = new TextProcessing();
            var resultList = tpr.GetSentencesInformationFromJson(outputJsonPath);

            var questionList = new List <TopicQuestion>();

            foreach (var sentence in resultList)
            {
                var dependencies = GetSentenceDependency(sentence);

                var words = GetSentenceWords(sentence);

                var sentenceInfo = new SentenceInformationDto(sentence.SentenceText, dependencies, words);
                if (MustContinue(sentence, sentenceInfo))
                {
                    continue;
                }
                GeneratedQuestion generatedQuestion;
                try
                {
                    generatedQuestion = QuestionGenerator.Generate(sentenceInfo);
                }
                catch
                {
                    continue;
                }
                if (string.IsNullOrEmpty(generatedQuestion?.Question))
                {
                    continue;
                }
                var cleanQuestion = QuestionCleaner.RemovePunctuationFromEnd(generatedQuestion.Question);

                cleanQuestion = $"{cleanQuestion}?";
                var question = new TopicQuestion
                {
                    Topic           = topic,
                    InitialSentence = sentence.SentenceText,
                    Question        = cleanQuestion,
                    Answer          = generatedQuestion.Answer
                };
                questionList.Add(question);
            }
            DirectoryManager.WriteQuestionsToFile(questionList, topic);
        }
示例#18
0
 public void Control(Text text)
 {
     MakeButtonsNotInteractable();
     MakeButtonRed(text);
     MakeButtonGreen(QuestionGenerator.rightAnswer);
     if (QuestionGenerator.Control(text))
     {
         PlayerPrefs.SetFloat("puan", PlayerPrefs.GetFloat("puan") + 50);
         toplampuan.text = PlayerPrefs.GetFloat("puan").ToString();
         artýpuan.text   = "+50";
     }
     else
     {
         toplampuan.text = PlayerPrefs.GetFloat("puan").ToString();
         artýpuan.text   = "+0";
     }
 }
示例#19
0
        public void TestService_Can_Construct()
        {
            //Arrange
            //Constructor args ICareUow uow, TestLogicFactory factory, IQuestionGenerator questionGenerator

            RepositoryFactories factory    = new RepositoryFactories();
            RepositoryProvider  provider   = new RepositoryProvider(factory);
            CareUow             uow        = new CareUow(provider);
            TestLogicFactory    tFactory   = new TestLogicFactory();
            QuestionGenerator   qGenerator = new QuestionGenerator(uow);


            //Act
            //TestService target = new TestService(uow, tFactory, qGenerator);
            TestService target = new TestService(uow, tFactory);

            //Assert
            Assert.IsNotNull(target);
        }
    public static List <QuestionModel> GetQuestionList(int numberOfQuestions, QuestionTypeModel questionTypeModel)
    {
        List <QuestionModel>     questions  = new List <QuestionModel>();
        Dictionary <string, int> dictionary = new Dictionary <string, int> ();

        dictionary.Add("SelectLetter", 1);
        dictionary.Add("Typing", 1);
        dictionary.Add("ChangeOrderController", 1);
        dictionary.Add("WordChoice", 1);
        dictionary.Add("SlotMachine", 1);
        dictionary.Add("LetterLink", 1);
        dictionary.Add("StackSwipeController", 1);
        string selectionFromRandom = QuestionGenerator.GetPseudoRandomValue(dictionary);

        for (int i = 0; i < numberOfQuestions; i++)
        {
            if (QuestionSystemController.Instance.isDebug)
            {
                string            questionType  = questionTypeModel.selectionType.GetType().Name;
                QuestionTypeModel questionModel = GetQuestionType(questionType);
                questions.Add(GetQuestion(questionModel));
            }
            else
            {
                QuestionModel questionType = GetQuestion(GetQuestionType(selectionFromRandom));
                if (i < 2)
                {
                    questionType.questionType.contentLevel = QuestionSystemEnums.ContentLevel.Easy;
                }
                else if (i < 5)
                {
                    questionType.questionType.contentLevel = QuestionSystemEnums.ContentLevel.Normal;
                }
                else
                {
                    questionType.questionType.contentLevel = QuestionSystemEnums.ContentLevel.Hard;
                }

                questions.Add(questionType);
            }
        }
        return(questions);
    }
示例#21
0
        private static void RuleQuestionTest(string dbPath)
        {
            var loader    = loadDB(dbPath);
            var graph     = new ComposedGraph(loader.DataLayer);
            var generator = new StructuredInterpretationGenerator(graph);

            var denotation1 = graph.GetNode("Barack Obama");
            var q1          = "Who is United States of America president?";

            var denotation2 = graph.GetNode("Vladimir Putin");
            var q2          = "Who is Russia president?";

            var q3          = "Who is Czech republic president?";
            var denotation3 = graph.GetNode("Miloš Zeman");

            generator.AdviceAnswer(q1, denotation1);
            generator.AdviceAnswer(q2, denotation2);
            generator.Optimize(5000);

            var interpretations = new List <Ranked <StructuredInterpretation> >();

            foreach (var evidence in generator.GetEvidences(q3))
            {
                foreach (var interpretation in evidence.AvailableRankedInterpretations)
                {
                    interpretations.Add(interpretation);
                }
            }

            interpretations.Sort((a, b) => a.Rank.CompareTo(b.Rank));
            foreach (var interpretation in interpretations)
            {
                var answer = generator.Evaluate(q3, interpretation.Value);
                ConsoleServices.Print(interpretation);
                ConsoleServices.Print(answer);
                ConsoleServices.PrintEmptyLine();
            }

            var qGenerator = new QuestionGenerator(generator);

            //var questions = Generator.FindDistinguishingNodeQuestions();
            throw new NotImplementedException();
        }
        public void QuestionGeneratorTests_PlusMinusMultiplication(int operatorIndex, int min, int max)
        {
            //Arrange

            Mock <IGameSetting> configMock = Helper.SetupConfigMock(operatorIndex, min, max);

            //Act
            var questionGenerator      = new QuestionGenerator(new RandomNumberGenerator(), configMock.Object);
            int expectedQuestionCount  = (max - min + 1) * (max - min + 1);
            HashSet <string> questions = new HashSet <string>();
            int count = 0;

            while (count++ < expectedQuestionCount)
            {
                questions.Add(questionGenerator.GenerateQuestion().ToString());
            }

            //Assert
            Assert.Equal(expectedQuestionCount, questions.Count);
        }
示例#23
0
    public static QuestionGenerator CreateGeneratorFromXml(XmlReader reader)
    {
        bool used = reader.GetAttribute("Used").Equals("y");
        if(!used) return null;
        QuestionGenerator generator = new QuestionGenerator();
        generator.m_tags = reader.GetAttribute("Tags").Split(';');
        generator.m_type = (GeneratorType)System.Enum.Parse(typeof(GeneratorType), reader.GetAttribute("Type"));
        generator.m_weight = System.Convert.ToSingle(reader.GetAttribute("Weight"));
        generator.m_questionText = reader.GetAttribute("QuestionText");
        generator.m_adjacentWithin = System.Convert.ToInt32(reader.GetAttribute("AdjacentWithin"));
        generator.m_infoPrefix = reader.GetAttribute("InfoPrefix");
        generator.m_infoSuffix = reader.GetAttribute("InfoSuffix");
        bool preventDuplicates = generator.m_type == GeneratorType.SortedMultiset;

        reader.ReadToDescendant("Answer");
        do{
            generator.AddAnswer(reader.GetAttribute("Text"), reader.GetAttribute("Value"), preventDuplicates);
        }while(reader.ReadToNextSibling("Answer"));
        return generator;
    }
示例#24
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <Question>   questions           = new List <Question>();
            String            selectedRadioButton = String.Empty;
            QuestionGenerator qgen = new QuestionGenerator();

            if (radioButton1.Checked)
            {
                selectedRadioButton = "+";
            }
            if (radioButton2.Checked)
            {
                selectedRadioButton = "-";
            }
            if (radioButton3.Checked)
            {
                selectedRadioButton = "/";
            }
            if (radioButton4.Checked)
            {
                selectedRadioButton = "*";
            }
            for (int i = 0; i < Convert.ToInt32(textBox1.Text); i++)
            {
                questions.Add(qgen.createQuestion(selectedRadioButton, Convert.ToInt32(textBox2.Text)));
            }

            if (form is AddTestFrame)
            {
                form = (AddTestFrame)form;
                ((AddTestFrame)form).updateQuestions(questions);
                Dispose();
            }
            if (form is EditTestFrame)
            {
                form = (EditTestFrame)form;
                ((EditTestFrame)form).updateQuestions(questions);
                Dispose();
            }
        }
示例#25
0
    private void GenerateQuestions()
    {
        // Initialize a new Dictionary Object that will hold all types of questions
        questions = new Dictionary <QuestionType, Question[]>();

        // Generate questions of types one by one and add all of them to the dictionary

        List <Question> maxHQuestions = QuestionGenerator.GenerateSpeed_AngleToMaxH();

        questions.Add(QuestionType.Speed_AngleToMaxH, maxHQuestions.ToArray());

        questions.Add(QuestionType.Speed_AngleToMaxX, QuestionGenerator.GenerateSpeed_AngleToMaxX().ToArray());

        List <Question> flightTimeQuestions = QuestionGenerator.GenerateSpeed_AngleToFlightTime();

        questions.Add(QuestionType.Speed_AngleToFlightTime, flightTimeQuestions.ToArray());

        questions.Add(QuestionType.MaxH_AngleToMaxX, QuestionGenerator.GenerateMaxH_AngleToMaxX(maxHQuestions).ToArray());

        questions.Add(QuestionType.MaxH_AngleToSpeed, QuestionGenerator.GenerateMaxH_AngleToSpeed(maxHQuestions).ToArray());

        questions.Add(QuestionType.MaxHToFlightTime, QuestionGenerator.GenerateMaxHToFlightTime().ToArray());

        questions.Add(QuestionType.SpeedX_FlightTimeToSpeed, QuestionGenerator.GenerateSpeedX_FlightTimeToSpeed().ToArray());

        questions.Add(QuestionType.Angle_Time_DistanceToSpeed, QuestionGenerator.GenerateAngle_Time_DistanceToSpeed().ToArray());

        questions.Add(QuestionType.Speed_AngleToTc, QuestionGenerator.GenerateSpeed_AngleToTc().ToArray());

        questions.Add(QuestionType.Speed_Time_AngleToHeight, QuestionGenerator.GenerateSpeed_Time_AngleToHeight(flightTimeQuestions).ToArray());

        questions.Add(QuestionType.Speed_Time_AngleToDistance, QuestionGenerator.GenerateSpeed_Time_AngleToDistance(flightTimeQuestions).ToArray());

        questions.Add(QuestionType.SpeedYToMaxH, QuestionGenerator.GenerateSpeedYToMaxH().ToArray());

        questions.Add(QuestionType.SpeedX_FlightTimeToDistance, QuestionGenerator.GenerateSpeedX_FlightTimeToDistance().ToArray());

        questions.Add(QuestionType.SpeedYToFlightTime, QuestionGenerator.GenerateSpeedYToFlightTime().ToArray());
    }
示例#26
0
    void Start()
    {
        // Get the settings
        isMuted = DataPersistence.GetMute();

        Difficulty difficulty = DataPersistence.Settings.GetDifficulty();

        questionGenerator = new QuestionGenerator(DataPersistence.Settings.GetAgeGroup(), difficulty);

        currentHighscore = DataPersistence.GetHighScore();

        // Set the multiplier based on the difficulty
        switch (difficulty)
        {
        case Difficulty.EASY:
            score = new Score(player.transform, scoreText, multiplierText, 1);
            break;

        case Difficulty.MEDIUM:
            score = new Score(player.transform, scoreText, multiplierText, 2);
            break;

        default:
            score = new Score(player.transform, scoreText, multiplierText, 3);
            break;
        }

        // Initialize the UI components
        lifeCount     = 5;
        lifeText.text = lifeCount + "x";

        isCorrectPanelActive = isIncorrectPanelActive = false;
        isCorrectAudioActive = isIncorrectAudioActive = false;

        bgm.SetActive(!isMuted);
        correctAudio.SetActive(false);
        incorrectAudio.SetActive(false);
    }
    public static void OpenWindowPopup()
    {
        QuestionGenerator window = new QuestionGenerator();

        window.correctAnswers   = new string[10];
        window.incorrectAnswers = new string[10];

        window.asignatura       = "Asignatura";
        window.tema             = "Tema";
        window.questionKey      = "Key de la Pregunta";
        window.questionTitleSpa = "Texto de la pregunta (SPA)";

        for (int i = 0; i < 10; ++i)
        {
            window.correctAnswers[i]   = "Respuesta correcta " + i;
            window.incorrectAnswers[i] = "Respuesta incorrecta " + i;
        }


        //WiruLib.WiruLocalization.GenerateJSON("Localization/Localization");

        window.ShowUtility();
    }
示例#28
0
 private void Awake()
 {
     generator = GetComponent <QuestionGenerator>();
 }
 void Start()
 {
     qGenerator = new QuestionGenerator();
     NextQuestion();
 }
示例#30
0
 private void Awake()
 {
     chatGenerator     = new ChatGenerator(0);
     questionGenerator = new QuestionGenerator(0);
     chatGenerator.GenerateChat("02", "00");
 }
示例#31
0
    // Update is called once per frame
    //Main과 같은 역할
    void Update()
    {
        //If Current Scene is StartMenuScene
        if (SceneManager.GetActiveScene().name == "StartMenuScene")
        {
            if (isAdMobActivated == false)
            {
                isAdMobActivated = true;
                adMobManager.ShowInterstitialAd();
            }

            uimanager_script = GameObject.Find("UIManager").GetComponent <UIManager>();

            if (uimanager_script.IsStartButtonPressed() == true)
            {
                SetPlayerNumberDigits();
            }
        }
        //If Current Scene is MultiplyQuestionScene
        else if (SceneManager.GetActiveScene().name == "MultiplyQuestionScene")
        {
            if (isUIManagerNew == false)
            {
                isUIManagerNew           = true;
                uimanager_script         = GameObject.Find("UIManager").GetComponent <UIManager>();
                questiongenerator_script = GameObject.Find("QuestionGenerator").GetComponent <QuestionGenerator>();
                questionscorer_script    = GameObject.Find("QuestionScorer").GetComponent <QuestionScorer>();
            }

            //If game is start
            if (isGameStart == true)
            {
                uimanager_script.ShowStageQuestionNumber(stage_question_number);

                //If question remains
                if (stage_question_number != 0)
                {
                    StartStageTimer();

                    //문제 풀다가 제한시간이 다되면
                    if (isTimeOver == true)
                    {
                        isTimeOver = false;
                        //Stage에 따른 곱셈 자릿수설정(***여기 버튼에따라 자릿수달라지게하는거하기)

                        //문제 생성
                        question_answer = StartQuestion(player_number_digit_input);
                        //문제 카운트 다운 시작
                        StartCountdown();
                    }

                    //제한시간이 안되었는데 Player가 문제답을 제출했다면
                    if (isTimeOver == false)
                    {
                        Debug.Log("문제답제출" + uimanager_script.IsPlayerSubmitAnswer());

                        if (uimanager_script.IsPlayerSubmitAnswer() == true)
                        {
                            player_answer = uimanager_script.GetPlayerAnswer();

                            isAnswerRight = questionscorer_script.ScoreQuestion(question_answer, player_answer);

                            //If answer is right
                            if (isAnswerRight == true)
                            {
                                //isAnswerRight = false;

                                if (uimanager_script.GetIsCorrectImageActivated() == false)
                                {
                                    //Show correct image to player
                                    StartCoroutine(uimanager_script.ShowCorrectImageForSeconds(0.8f));
                                }

                                if (uimanager_script.GetIsCorrectImageFinished() == true)
                                {
                                    uimanager_script.SetIsCorrectImageFinished(false);
                                    //Show correct Image to player
                                    StopCountDown();
                                }
                            }
                            //If answer is wrong
                            else
                            {
                                if (uimanager_script.GetIsWrongImageActivated() == false)
                                {
                                    //Show wrong image to player
                                    StartCoroutine(uimanager_script.ShowWrongImageForSeconds(0.8f));
                                    uimanager_script.SetIsPlayerSubmitAnswerFalse();
                                }
                            }

                            //If answer is wrong
                        }
                    }
                }
                //If game is end
                else
                {
                    isUIManagerNew    = false;
                    isGameStart       = false;
                    isGameWaitTimerOn = false;
                    SceneManager.LoadScene("EndMenuScene");
                }
            }

            //Before Game Start
            else
            {
                //Wait 4 seconds before game starts ( 3  seconds + game start )
                if (isGameWaitTimerOn == false)
                {
                    isGameWaitTimerOn       = true;
                    isSetPlayerNumberDigits = false;
                    stage_timer             = 0;
                    //stage_question_number = k_stage_question_number;
                    Debug.Log("+" + player_number_digit_input.Count);
                    Debug.Log("++" + player_number_digit_input[2]);
                    stage_question_number   = player_number_digit_input[2];
                    correct_question_number = 0;
                    isGameWaitTimerOn       = true;
                    StartCoroutine(WaitBeforeGameStart(4));
                }
            }
        }
        //If Current Scene is EndMenuScene
        else if (SceneManager.GetActiveScene().name == "EndMenuScene")
        {
            uimanager_script.ShowCorrectQuestionNumber(correct_question_number, player_number_digit_input[2]);
            uimanager_script.ShowStageTimer(stage_timer);
        }
    }
        public IEnumerator PlayCoroutine(Action gameEndedCallback)
        {
            yield return(PlayStartSound());

            bool AnturaShowed = false;

            for (int round = 0; round < Configuration.Rounds; round++)
            {
                #region Init
                QuestionGenerator.InitRound();

                for (int question = 0; question < Configuration.SimultaneosQuestions; question++)
                {
                    LogicInjector.Wire(
                        QuestionGenerator.GetNextQuestion(),
                        QuestionGenerator.GetNextAnswers());
                }

                LogicInjector.CompleteWiring();
                LogicInjector.EnableDragOnly(); //as by new requirments

                //mute feedback audio while speaker is speaking
                bool answerConfigurationCache = AssessmentConfiguration.Instance.PronunceAnswerWhenClicked;
                AssessmentConfiguration.Instance.PronunceAnswerWhenClicked = false;

                QuestionGenerator.CompleteRound();
                #endregion

                if (AnturaShowed)
                {
                    // Show question only after antura animation is done.
                    QuestionPlacer.Place(QuestionGenerator.GetAllQuestions());
                    while (QuestionPlacer.IsAnimating())
                    {
                        yield return(null);
                    }
                }

                AnswerPlacer.Place(QuestionGenerator.GetAllAnswers());
                while (AnswerPlacer.IsAnimating())
                {
                    yield return(null);
                }

                LogicInjector.AnswersAdded();

                if (AnturaShowed == false)
                {
                    #region ANTURA ANIMATION

                    PlayAnturaIsComingSound();
                    var anturaController = AnturaFactory.Instance.SleepingAntura();

                    anturaController.StartAnimation(() => PlayPushAnturaSound(), () => PlayAnturaGoneSound());

                    while (anturaController.IsAnimating())
                    {
                        yield return(null);
                    }

                    yield return(TimeEngine.Wait(0.3f));

                    yield return(PlayGameDescription());

                    #endregion

                    QuestionPlacer.Place(QuestionGenerator.GetAllQuestions());
                    while (QuestionPlacer.IsAnimating())
                    {
                        yield return(null);
                    }

                    AnturaShowed = true;
                }

                #region GamePlay
                //////////////////////////////
                //// GAME LOGIC (WIP)
                ////----
                // Restore audio when playing
                AssessmentConfiguration.Instance.PronunceAnswerWhenClicked = answerConfigurationCache;
                LogicInjector.EnableGamePlay();

                while (LogicInjector.AllAnswersCorrect() == false)
                {
                    yield return(null);
                }
                ////___
                //// GAME LOGIC END
                //////////////////////////////

                LogicInjector.RemoveDraggables();

                QuestionPlacer.RemoveQuestions();
                AnswerPlacer.RemoveAnswers();

                while (QuestionPlacer.IsAnimating() || AnswerPlacer.IsAnimating())
                {
                    yield return(null);
                }

                LogicInjector.ResetRound();
                #endregion
            }

            gameEndedCallback();
        }