// Use this for initialization void Start() { parser = new QuizParser(); parser.fieldSeparator = fieldSeparator; parser.lineSeparator = lineSeparator; parser.quizCsv = quizCsv; parser.questionCsv = questionCsv; this.quizes = parser.readQuizFromTextFiles(); var levelTable = this.GetComponent <LevelTable>(); if (levelTable != null) { foreach (var quiz in quizes) { levelTable.Level.Add(quiz.name); } } }
////////////////////////////////////////// //Event handlers /// <summary> /// Generate button handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnGenerate(object sender, EventArgs e) { QuizParser parser = new QuizParser(); Quiz quiz = null; string strQuiz = this.GetQuizString(); if (strQuiz.Length == 0) //Don't bother attempting to create an empty quiz { this.ClearInput(); return; } else if (parser.GenerateQuiz(strQuiz, out quiz)) //Try to generate the quiz { this.lblError.ForeColor = Color.Green; this.lblError.Text = "Test generation successful <br/>"; //this.lblError.Text += "Scroll to the bottom to Download your questions for Blackboard."; quiz.QuizName = this.txtQuizName.Text; this.Session["quiz"] = quiz; this.panelDownload.Visible = true; this.lblDownload.Text = "Test Generated with " + quiz.Questions.Count + " Questions"; } else { //Display the error table this.lblError.ForeColor = Color.Red; this.lblError.Text = "Test generation failed<br/>Hold your mouse cursor over any red box for more information"; this.panelDownload.Visible = false; } //Draw the separate quiz text fields this.txtQuiz.Visible = false; if (quiz != null) { this.AddQuestionTextBoxes(quiz); } }
// Use this for initialization void Start() { // player info playa = GameObject.Find("Player").GetComponent <Player>(); // start display text currScreenText = ""; screenTextParser = GameObject.Find("ScreenTextParserObject").GetComponent <ScreenTextParser>(); screenTextParser.fileName = playa.getScreenTextToDisplay(); screenTextParser.reloadScreenText(); screenTextFileLineCount = screenTextParser.GetLineCount(); screenTextLineNum = 0; textStillDisplaying = false; takingQuiz = false; color = Color.white; fadeFloat = 1.5f; textDisplaySection1 = true; textDisplaySection2 = false; // name input gettingName = false; gameCanvas = GameObject.Find("Canvas"); gameCanvas.SetActive(gettingName); // quiz section quizQuestions = ""; quizParser = GameObject.Find("QuizParserObject").GetComponent <QuizParser>(); quizParser.fileName = playa.getQuizQuestions(); quizParser.loadQuestions(); characterCount = new List <string> (); quizFileLineCount = quizParser.GetLineCount(); quizLineNum = 0; setBackground(); }