void CorrectOptionHandler(int index) { CurrentStatus = PlAYSTATUS.CORRECT; DisableOptions(); CurrentIndexSelected = index; if (LabelAnswer != null) { OptionButtons[CurrentIndexSelected].SpriteOption.spriteName = "b5"; LabelAnswer.color = Color.green; LabelAnswer.text = Localization.Localize("correctanswer"); } PlayGame.IncrementCorrectAnswers(); PlayGame.IncrementCurrentConsecutiveAnswers(); CloudManager.Instance.UpdateTopicsAnswers(Managers.Trivia.CurrentTopicIndexSelected, 1); TurnOffTimerSound(); bool IsWinner = PlayGame.CheckWinner(); // Managers.Social.CheckWinner(); if (IsWinner) { // Managers.Social.FinishMatch(); PlayGame.FinishMatch(); LabelAnswer.color = Color.white; LabelAnswer.text = Localization.Localize("youwon"); if (ButtonWon != null) { NGUITools.SetActive(ButtonWon.gameObject, true); } } else { if (PlayGame.GetCurrentConsecutiveAnswers() == Globals.Constants.IntervalAnswers) { PlayGame.TriggerNextTurn(); if (ButtonFailed != null) { NGUITools.SetActive(ButtonFailed.gameObject, true); } LabelAnswer.color = Color.white; LabelAnswer.text = Localization.Localize("givechancetootherplayer"); } else { PlayGame.TriggerMyTurnAgain(); if (ButtonContinue != null) { NGUITools.SetActive(ButtonContinue.gameObject, true); } } } }
void OnEnable() { TimeToAnswer = 25F; CurrentStatus = PlAYSTATUS.NOTANSWER; CurrentIndexSelected = -1; endTime = Time.time + TimeToAnswer; timeLeft = (int)TimeToAnswer; CleanUI(); ShowInitialInfo(); if (tickSound != null) { audiosource = Managers.Audio.Play(tickSound, transform.position, TimeToAnswer, true); } }
void TimeOutHandler() { CurrentStatus = PlAYSTATUS.TIMEOUT; DisableOptions(); if (LabelAnswer != null) { LabelAnswer.color = Color.red; LabelAnswer.text = Localization.Localize("timeout"); } TurnOffTimerSound(); PlayGame.TriggerNextTurn(); if (ButtonFailed != null) { NGUITools.SetActive(ButtonFailed.gameObject, true); } }
void WrongOptionHandler(int index) { CurrentStatus = PlAYSTATUS.WRONG; DisableOptions(); CurrentIndexSelected = index; if (LabelAnswer != null) { // Invoke("ChangeColor", 0.1F); OptionButtons[CurrentIndexSelected].SpriteOption.spriteName = "b3"; LabelAnswer.color = Color.red; LabelAnswer.text = Localization.Localize("wronganswer"); } TurnOffTimerSound(); PlayGame.TriggerNextTurn(); if (ButtonFailed != null) { NGUITools.SetActive(ButtonFailed.gameObject, true); } }