// Start is called before the first frame update void Start() { QuestionHandler handler = FindObjectOfType <QuestionHandler>(); handler.OnCorrect += PlayCorrectSound; handler.OnWrong += PlayWrongSound; }
IEnumerator ABC(int index) { yield return(0); questionHandlerObject = GameObject.Find("QuestionHandler"); questionHandlerScript = questionHandlerObject.GetComponent <QuestionHandler>(); deletePlayedFromList(index); switch (index) { case 2: case 4: case 5: case 7: case 6: case 8: case 9: case 10: questionHandlerScript.setMultipleChoice(index); break; case 1: case 3: //questionHandlerScript.setOpenQuestion(index); questionHandlerScript.setMultipleChoice(index); break; } }
public void Fact_description(string[] readLineResponses, string expectedAnswer) { // Arrange var request = new QuestionRequest { Answers = new[] { "[Y]es", "[n]o" } }; var consoleServiceMock = new Mock <IConsoleService>(); foreach (var readLineResponse in readLineResponses) { consoleServiceMock.Setup(mock => mock.ReadLine()).Returns(readLineResponse); } var sut = new QuestionHandler(consoleServiceMock.Object); // Act var response = sut.Handle(request, CancellationToken.None).GetAwaiter().GetResult(); // Assert Assert.Equal(expectedAnswer, response.Answer); }
public void QuestionWalksRightTest() { var question = new QuestionHandler("map6.txt"); question.DownMovement(null, null); Assert.IsFalse(question.MovedDown); question.UpMovement(null, null); Assert.IsTrue(question.MovedUp); question.UpMovement(null, null); Assert.IsFalse(question.MovedUp); question.LeftMovement(null, null); Assert.IsTrue(question.MovedLeft); question.LeftMovement(null, null); Assert.IsFalse(question.MovedLeft); question.UpMovement(null, null); Assert.IsFalse(question.MovedUp); question.RightMovement(null, null); Assert.IsTrue(question.MovedRight); question.RightMovement(null, null); Assert.IsTrue(question.MovedRight); question.RightMovement(null, null); Assert.IsFalse(question.MovedRight); }
private void Start() { questionButtons = new List <QuestionButton>(); accusationButtons = new List <QuestionButton>(); knowledgeButton.onClick.AddListener(() => { QuestionHandler.ProbeClue(new Clue("Knowledge", "Preliminary knowledge the character knows.")); }); //AddClue("Case", new Clue("Knowledge", "")); //questionButtons.Add(new QuestionButton(questionCloseButton, new Clue())); print(DialogueHandler.GetCulpritName()); }
public StatusModel(Database database, HtmlSanitizer sanitizer, QuestionHandler questionHandler, IConfiguration configuration, CaptchaValidator validator, MarkdownPipeline markdown) { this.database = database; this.sanitizer = sanitizer; this.questionHandler = questionHandler; this.validator = validator; this.markdown = markdown; SiteKey = configuration.GetValue <string>("Captcha:SiteKey"); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this); } }
void Start() { questionChecker = this.transform.parent.Find("QuestionChecker").gameObject; question = questionChecker.transform.Find("Question").GetComponent <Text>(); handler = this.transform.root.GetComponent <QuestionHandler> (); for (int i = 0; i < 4; i++) { answers [i] = questionChecker.transform.Find("Text " + (i + 1).ToString()).Find("Text").GetComponent <Text>(); } }
public Puzzle(MainPage callback) { InitializeComponent(); this.callback = callback; SetImageList(); fullPuzzleImages = Directory.GetFiles(@".\..\..\Resources\Intreg"); awards = Directory.GetFiles(@".\..\..\Resources\Premii"); imageList[0].Image = Image.FromFile(awards[0]); questionHandler = new QuestionHandler(20, 55, 44, txtAnswer, btnCheckSolution, lblQuestionTop, lblQuestionBottom); }
// Use this for initialization void Start() { gameController = this; questionHandler = new QuestionHandler(); buttons = new Button[] { buttonA, buttonB, buttonC, buttonD }; defaultSprites = new Sprite[4]; for (int i = 0; i < 4; i++) { defaultSprites [i] = buttons [i].image.sprite; } loadQuestion(); }
static void Main(string[] args) { var eventLoop = new EventLoop(); var smileyHandler = new QuestionHandler("map.txt"); eventLoop.LeftPressed += smileyHandler.LeftMovement; eventLoop.RightPressed += smileyHandler.RightMovement; eventLoop.UpPressed += smileyHandler.UpMovement; eventLoop.DownPressed += smileyHandler.DownMovement; eventLoop.Run(); }
private static void RegisterHandlers(IEventPublisher eventPublisher) { var questionHandler = new QuestionHandler(); var answerHandler = new AnswerHandler(); eventPublisher.RegisterHandler<QuestionAsked>(questionHandler.Handle); eventPublisher.RegisterHandler<QuestionAmended>(questionHandler.Handle); eventPublisher.RegisterHandler<AnswerSuggested>(answerHandler.Handle); eventPublisher.RegisterHandler<AnswerAmended>(answerHandler.Handle); eventPublisher.RegisterHandler<AnswerUpvoted>(answerHandler.Handle); eventPublisher.RegisterHandler<AnswerDownvoted>(answerHandler.Handle); }
public QCMUC(IndexForm _mainForm, int _questionLeft) { InitializeComponent(); mainForm = _mainForm; questionHandler = QuestionHandler.Instance; questionLeft = _questionLeft; evalResult = EvaluationResult.Instance; result = evalResult.currentScoreQCM; //Utilisé pour écrire les résultats saveFile = SaveFileUtility.Instance; StartEvaluating(); }
private void Start() { stats = GetComponent <Stats>(); stats.OnDamageReceived += DamageReceived; questionHandler = FindObjectOfType <QuestionHandler>(); nextAttack = Time.time + timeBetweenAttacks; nextAttack2 = Time.time + timeBetweenAttacks2; animator = GetComponent <AnimatorController>(); if (isPlayer) { questionHandler.OnCorrect += Attack; } else { timerViewer = FindObjectOfType <TimerViewer>(); StartCoroutine(BossCombat()); } }
private void CreateAllQuestions() { var i = 0; foreach (Transform child in QuestionParent.transform) { var handler = child.GetComponent <QuestionHandler>(); if (handler == null) { continue; } handler.Manager = this; _theHandler = handler; } _theHandler.gameObject.SetActive(true); }
//public void HideOpenPanels() //{ // StopAllCoroutines(); // dialoguePanel.SetActive(false); // accusationPanel.SetActive(false); //} public void PopulateQuestionPanelButtons() { Clue[] knownClues = Journal.Instance.GetAllKnownClues(); // Check to see if we already have a button associated with the clue. // If we do, don't create a new one. foreach (Clue clue in knownClues) { if (clue.ClueTag == string.Empty) { continue; } //print(clue.ClueTag); bool foundClue = false; foreach (QuestionButton qb in questionButtons) { if (qb.clue.ClueTag == clue.ClueTag) { foundClue = true; break; } } if (foundClue) { continue; } print("Creating a button for clue " + clue.ClueTag); Button button = Instantiate(buttonPrefab, questionButtonPanel.transform); button.GetComponentInChildren <TextMeshProUGUI>().text = clue.ClueTag + "?"; // Reset whatever was on the close button. button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => { QuestionHandler.ProbeClue(clue); }); button.onClick.AddListener(() => { SFXManager.Instance.source.PlayOneShot(SFXManager.Instance.click); }); questionButtons.Add(new QuestionButton(button, clue)); } }
public IActionResult SaveCandidateAnswer([FromBody] QuestionCustomModel value) { Dictionary <string, string> email = new Dictionary <string, string>(); QuestionHandler qh = new QuestionHandler(); Authentication auth = new Authentication(); email = auth.getAllClaims(HttpContext); string joinValue = qh.radioOrCheckBoxValue(value); var checkAnswer = db.Questions.Where(s => s.Id == Int32.Parse(value.QId)).Select(a => new { a.Answer, a.Weightage }).FirstOrDefault(); var existingAnswer = db.CandidateResult.Where(s => s.Email == email["Email"] && s.TestCode == value.Code).FirstOrDefault(); if (checkAnswer.Answer == joinValue) { qh.SaveCorrectOption(checkAnswer, existingAnswer, email["Email"], value, joinValue); } else { qh.SaveIncorrectOption(checkAnswer, existingAnswer, email["Email"], value, joinValue); } return(Ok(new { msg = "data saved" })); }
protected void btnSubmit_Click(object sender, EventArgs e) { Question ques = new Question(); ques.QuestionFor = "-Q. " + txtQuestion.Text; ques.ChoiceA = "A: " + txtA.Text; ques.ChoiceB = "B. " + txtB.Text; ques.ChoiceC = "C. " + txtC.Text; ques.ChoiceD = "D. " + txtD.Text; ques.TeacherAns = txtAns.Text; ques.StudentAns = ""; ques.set = "0"; ques.courseID = Convert.ToInt32(Request.QueryString["id"]); ques.QuestionType = DropDownList1.SelectedValue; QuestionHandler quesHandler = new QuestionHandler(); if (quesHandler.AddNewQuestion(ques) == true) { Response.Redirect("AddNewQuestion.aspx?id=" + Convert.ToInt32(Request.QueryString["id"]) + "&qid=" + 1); } }
private void Awake() { singleton = this; }
public async Task <IActionResult> GetAssignmentResult([FromBody] GetAssignmentResultPostViewModel model) { if (!ModelState.IsValid) { return(BadRequest(new { message = "request forbidden" })); } var userID = User.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier).FirstOrDefault().Value; var user = await _userManager.FindByIdAsync(userID); if (user == null) { return(NotFound(new { message = "user's token is invalid" })); } var specificAssignmentRecord = _arDbContext.AssignmentRecords.Where(ar => ar.UserID == user.Id && ar.ExerciseID == model.ExerciseID).ToList().FirstOrDefault(); if (specificAssignmentRecord == null) { return(NotFound(new { message = "there is no assignment record for this exercise" })); } if (specificAssignmentRecord.IsFinished == false) { return(NotFound(new { message = "you haven't finished this assignment yet" })); } var answerRecords = _arDbContext.AnswserRecords.Where(q => q.AssignmentRecordID == specificAssignmentRecord.ID).ToList(); var answerDetails = new List <AnswerDetail>(); foreach (var answerRecord in answerRecords) { var answerDetail = new AnswerDetail { SentenceJP = answerRecord.SentenceJP, SentenceEN = answerRecord.SentenceEN, AnswerSentence = QuestionHandler.ConvertDivisionToSentence(answerRecord.AnswerDivision), IsCorrect = answerRecord.IsCorrect }; answerDetails.Add(answerDetail); } var vm = new GetAssignmentResultGetViewModel { AccuracyRate = specificAssignmentRecord.AccuracyRate, AnswerDetails = answerDetails }; return(Ok(vm)); }
void OnMouseDown() { QuestionHandler.printQuestion(landingActivated(this.country)); setOwner(this.gameObject); }
void Start() { questionHandler = QuestionHandler.Getinstance(); source = GetComponent <AudioSource> (); }
public AnswerModel(QuestionHandler questionHandler) { this.questionHandler = questionHandler; }
public EditModel(QuestionHandler questionHandler) { this.questionHandler = questionHandler; }
public Hangman() { InitializeComponent(); questionHandler = new QuestionHandler(220, 255, 374, txtAnswer, btnCheckSolution, lblQuestionTop, lblQuestionBottom); InitImageList(); }
public DeleteModel(Database database, QuestionHandler questionHandler) { this.database = database; this.questionHandler = questionHandler; }