private void Update() { if (Input.GetKey(KeyCode.Escape)) { SceneManager.LoadScene(0); } update += Time.deltaTime; int intUpdate = (int)Mathf.Floor(update); if (update > 1 && intUpdate == nextValue && rowsCounter < TotalRows) { nextValue = intUpdate + interVal; rowsCounter++; Transform transform = Instantiate(template, container); RectTransform rectTransform = transform.GetComponent <RectTransform>(); rectTransform.anchoredPosition = new Vector2(0, -templateHeight * rowsCounter); Transform numberRect = rectTransform.Find("TemplateNumber"); numberRect.GetComponent <Text>().text = rowsCounter.ToString(); Transform answerRect = rectTransform.Find("TemplateAnswer"); answerRect.GetComponent <Text>().text = cheekiBreeki.CheekiBreekiResult(rowsCounter); rectTransform.gameObject.SetActive(true); //todo Delete //RectTransform divTableRect = divTable.GetComponent<RectTransform>(); //divTableRect.sizeDelta+=new Vector2(0, 50); } }
public void OnEnterButtonClick(Button btn) { string CorrectAnswer = cheekiBreeki.CheekiBreekiResult(newNumber).ToLower(); answer = btn.GetComponentInChildren <Text>().text.ToLower(); if (answer != CorrectAnswer) { sw.Stop(); DataHttpSender.CreateUserScore(new LeaderBoard((sw.Elapsed).TotalSeconds, ScoreCounter)); SceneManager.LoadScene(0); } else { ScoreCounter++; GenerateAndShowNewNumber(); } }