private void ChangePanelToGameState(Station station) { scanerPanel.GetComponent <ScannerPanelController>().SetEnableScanner(false); scanerPanel.SetActive(false); countdown.gameObject.SetActive(true); countdown.CountdownStart(station.stationName); isTimeOut = countdown.isTimeOut.Where(isTimeOut => isTimeOut).Do(_ => StartStationLoop(station)).Subscribe(); }
public void SetUp(Question question, string stationName, string stationTitle, int numberOfQuestion, int amountOfQuestions, bool isSpecial) { bombEffect.SetActive(false); this.isSpecial = isSpecial; readyForStartQuestion = false; this.stationName = stationName; this.stationTitle.text = stationTitle; stationImage.enabled = !this.isSpecial; spacialStationImage.enabled = this.isSpecial; stationImage.sprite = GetStationSpriteByStationName(this.stationName); currentQuestionText.text = numberOfQuestion + "/" + amountOfQuestions; questionDetail = question; this.questionText.text = numberOfQuestion + ". " + Localize(GameManager.Instance.language, questionDetail).question; arr = (isSpecial) ? RemoveLastIndexOfAnswers(answers) : RandomizeOrder(answers); int i = 0; fontSize = int.MaxValue; foreach (Answer item in arr) { // print("Setup new Answer"); int answerFontSize = (GameManager.Instance.language == GameEnum.Language.thai)? questionDetail.thaiFontSize: questionDetail.engFontSize; if (answerFontSize > 0) { baseFit = item.displayAnswer.resizeTextForBestFit = false; item.displayAnswer.fontSize = answerFontSize; } else { baseFit = item.displayAnswer.resizeTextForBestFit = true; item.displayAnswer.resizeTextMaxSize = 100; item.displayAnswer.resizeTextMinSize = 50; } item.SetTextAnswer(GetAnswerByIndex(i, isSpecial)); item.GetButton().onClick.AddListener(() => SendAnswer(item)); i++; } // foreach (Answer item in arr) // { // item.displayAnswer.resizeTextForBestFit = false; // item.displayAnswer.fontSize = fontSize; // } gameObject.SetActive(true); charaterAnim.enabled = true; charaterAnim.SetTrigger("meijiKung"); answerSheet.SetActive(true); // guageAni.enabled = true; string typeOfQuestionStr = (!this.isSpecial) ? "15sec" : "8sec"; // guageAni.SetTrigger(typeOfQuestionStr); SoundManager.Instance.PlaySound(typeOfQuestionStr, out timerAudioSource); countdown.CountdownStart(time: question.time); subscribeTimeOut = countdown.isTimeOut .Where(isTimeOut => isTimeOut) .Do(_ => { Debug.LogError("TimeOut"); bombEffect.SetActive(true); AnswerStateChange(GameEnum.StateAnswer.timeout); // ani.enabled = false; }) .Subscribe(); }