public void Mark() { marks = 0; Transform answerBoxes = GameObject.Find("Answer Boxes").transform; int childCount = answerBoxes.childCount; var seq = LeanTween.sequence(); for (int i = 0; i < childCount; i++) { AnswerBox ab = answerBoxes.GetChild(i).GetComponent <AnswerBox>(); GameObject markGraphic = null; if (string.Equals(ab.finalAnswer, ab.intendedAnswer)) { marks++; markGraphic = answerBoxes.GetChild(i).Find("Correct").gameObject; } else { markGraphic = answerBoxes.GetChild(i).Find("Wrong").gameObject; } markGraphic.SetActive(true); Vector3 originalScale = markGraphic.transform.localScale; //LeanTween.alpha(markGraphic, 0.0f, 0.01f); //seq.insert(LeanTween.alpha(markGraphic, 1.0f, 2.0f)); seq.append(LeanTween.scale(markGraphic, originalScale * 1.1f, 0.1f).setDelay(1.0f).setEaseInOutBounce().setLoopPingPong(2)); Toolbox.Instance.Sfx.PlaySound("scribble_0", 0.25f, 0.9f, 1.1f); } Toolbox.Instance.finalScore = Toolbox.Instance.finalScore + ((float)marks / (float)childCount); Debug.Log("Marks: " + marks + "/" + childCount); }
public bool isWord(int charIndex) { if (charIndex >= AnswerBox.Text.Length) { return(false); } return(!(AnswerBox.GetSpellingErrorLength(charIndex) > 0 && isWord(charIndex + 1))); }
public void ShowAnswers(string[] options) { //Build an array of Actions Action[] actions = new Action[options.Length]; for (int i = 0; i < options.Length; i++) { actions[i] = () => RunAnswer(); } AnswerBox.GetComponent <OptionBox>().Populate(options, actions); }
override public void InteractOn(Entity other) { if (other.name.StartsWith("Answer Box")) { this.transform.position = other.transform.position; AnswerBox ab = other.GetComponent <AnswerBox>(); ab.setFinalAnswer(this.name, this.gameObject); Toolbox.Instance.Sfx.PlaySound("scribble_0", 0.25f, 0.9f, 1.1f); } }
private void button1_Click(object sender, EventArgs e) { question.Add(new Questions() { Id = count, Question = textBox1.Text, Answer = AnswerBox.Text }); count++; AnswerBox.Clear(); textBox1.Clear(); }
private void generate() { timeLabel.Foreground = Brushes.Black; x = rnd.Next(100, 501); y = rnd.Next(100, 501); dollarsLabel.Content = dollars + "$"; problem.Content = x + " + " + y + " = ?"; t.Stop(); t.Start(); AnswerBox.Focus(); time = 0; timeLabel.Content = " 00 : " + time.ToString("00"); }
private void displayNextProblem() { //get the next problem _CurrentProblem = ProblemFactory.GetArithmeticProblem <int>(getNextOperation(), 2, 20, false); string[] lines = _CurrentProblem.Display().ToArray(); if (lines.Length > 0) { lines[0] = lines.First().Remove(0, 1); //remove the first symbol } ProblemBox.Lines = lines; AnswerBox.Text = string.Empty; AnswerBox.Focus(); _Timer.Restart(); }
public AssessmentFillUpsView() { InitializeComponent(); Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { Task.Delay(1000); }); AnswerBox.Completed += (object sender, EventArgs e) => { if (!string.IsNullOrEmpty(AnswerBox.Text) && !string.IsNullOrWhiteSpace(AnswerBox.Text)) { this.Answer = AnswerBox.Text; AnswerBox.Focus(); AnswerBox.Unfocus(); } }; }
void OnTriggerEnter2D(Collider2D other) { if (!isImmortal()) { if (other.gameObject.CompareTag("wall")) { life = life - 1; nextImmortalTime = Time.time + 3; Debug.Log("Hit wall---life: " + life); } } if (other.gameObject.CompareTag("item")) { other.GetComponent <Item>().getItem(this); Destroy(other.gameObject); } if (other.gameObject.CompareTag("letter")) { AnswerBox ab = other.GetComponent <AnswerBox>(); ab.sentValue(ab.ans); Destroy(other.gameObject); } }
public void RunAnswer() { activeNode.ExecuteNext(activeNode.GetOutputPort("answers " + AnswerBox.GetComponent <OptionBox>().chosen), dialogueContext); }
private void Window_ContentRendered(object sender, EventArgs e) { AnswerBox.SelectAll(); AnswerBox.Focus(); }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); AnswerBox.Focus(); }