void Start() { mQuiz = FindObjectOfType <Quiz>(); mQuestionScreenBehavior = FindObjectOfType <GameScreenHandle>(); StartCoroutine(ResizeObject.ChangeRotation(transform.Find("question_mark").gameObject, 3, 'y')); }
/// <summary> /// Call the RequestQuestion() coroutine of ServerConnecton class to send the questionnaire code. /// </summary> public void SendCodeQuestionnaire() { if (m_QuestionnaireCodeText.text == "") { EnableMessagePanel("Informe algum código!", true); m_AudioManager.PlayWrongAnswerAudio(); } else { m_LoadingImage.SetActive(true); StartCoroutine(ResizeObject.ChangeRotation(m_LoadingImage, 200)); StartCoroutine(ServerConnection.RequestQuestion(m_QuestionnaireCodeText.text, CallBackRequestQuestion, m_LoadingImage)); } }
/// <summary> /// Send the player score to the server. /// </summary> /// <param name="playerName">Name of the player that will be sent.</param> public void SendScoreButtom(InputField playerName) { if (playerName.text != "") { Quiz quiz = FindObjectOfType <Quiz>(); Player player = new Player(); player.points = quiz.Score; player.name = playerName.text; player.questCode = QuestionSingleTon.Instance.JsonQuestions.m_ServerResult.result.code; string json = JsonUtility.ToJson(player); Debug.Log(json); m_LoadingImage.SetActive(true); StartCoroutine(ResizeObject.ChangeRotation(m_LoadingImage)); StartCoroutine(ServerConnection.SaveScore(json, CallBackSaveScore)); } else { EnableMessagePanel("Nome inválido. Tente novamente!", false); } }