public void SubmitAnswer(Question.Result answer) { correct = answer == currentQuestion.result; answerTimes++; if (correct) { if (energy < 5) { energy++; } } else { if (energy > 0) { energy--; } } if (answerTimes == 1 && correct && energy >= 5) { combo++; } if (!correct) { combo = 0; } if (IsCurrentCompleted) { var answerItem = new AnswerItem(); answerItem.question = currentQuestion; answerItem.completed = correct && answerTimes == 1; completedList.Add(answerItem); } }
public void DisableOption(Question.Result result) { var oOpt = oOptions.transform.Find(result.Name()); oOpt.GetComponent <Button>().interactable = false; oOpt.Find("Text").GetComponent <Text>().color = Color.gray; }
void Start() { GlobalEvent.shared.AddListener((data) => { if (data.type == EventType.DialogueConfirmed) { dialgueConfirmed = true; } else { if (answer == Question.Result.Unknow) { switch (data.type) { case EventType.SelectOptionA: answer = Question.Result.A; break; case EventType.SelectOptionB: answer = Question.Result.B; break; case EventType.SelectOptionC: answer = Question.Result.C; break; case EventType.SelectOptionD: answer = Question.Result.D; break; } if (answer != Question.Result.Unknow) { GlobalEvent.shared.Invoke(EventType.PlayLiteHitAudio); } } } }); }
IEnumerator WaitForAnswer() { yield return(new WaitForSeconds(0.3f)); answer = Question.Result.Unknow; questionView.SetInteractable(true); while (answer == Question.Result.Unknow) { yield return(1); } questionView.SetInteractable(false); }
public void HighlightOptions(Question.Result result) { foreach (Transform tOpt in oOptions.transform) { tOpt.GetComponent <Button>().enabled = false; // 5269FFFF if (result.Name().Equals(tOpt.name)) { var oFrame = tOpt.Find("Frame").gameObject; oFrame.SetActive(true); oFrame.ScaleFrom(new Vector3(1.3f, 1.3f, 1.3f), 0.3f, 0, EaseType.easeInQuart); tOpt.Find("Text").GetComponent <Text>().color = Const.COLOR_CORRECT; // StartCoroutine(FlashText(tOpt.Find("Text").GetComponent<Text>(), Const.COLOR_CORRECT)); } } }
public static string Name(this Question.Result result) { switch (result) { case Question.Result.A: return("A"); case Question.Result.B: return("B"); case Question.Result.C: return("C"); case Question.Result.D: return("D"); default: return("Unknow"); } }