using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine; using System; public class RoundButtonsScript : MonoBehaviour { public Button newQuestionButton; public Button nextPlayerButton; public GameObject QuestionAnswerLine; public GameObject nextCategoryText; public GameObject QuestionCardPrefab; public GameObject NewQuestionCardPanel; private ScrollViewScript svs; private TimerScript ts; // Start is called before the first frame update void Start() { newQuestionButton.onClick.AddListener(NewQuestion); nextPlayerButton.onClick.AddListener(NextPlayer); svs = GameObject.Find("Scroll View").GetComponent(); ts = GameObject.Find("TimerCircle").GetComponent(); } void NewQuestion() { HidePanel(); ts.ResetTimer(); ts.StartTimer(); } void NextPlayer() { svs.SetAllQuestionsLocked(true); svs.NextPlayer(); HidePanel(); } public void HidePanel() { gameObject.SetActive(false); } public void ShowPanel() { if (svs == null) { svs = GameObject.Find("Scroll View").GetComponent(); } NewQuestionData q = Database.Instance.GetNewQuestion(svs.GetQuestionIdsInAnswerLine(), svs.currentPlayer, svs.GetGameMode()); //q.SetAnswerText("???? - ????"); //svs.SetNewQuestion(q); Text nqct = nextCategoryText.GetComponent(); CategoryPanel cp = GameObject.Find("Categories").GetComponent(); CategoryPanel.Category cat = cp.GetCategoryById(q.CategoryId); nqct.text = cat.name; gameObject.SetActive(true); } internal void DeactivateNextPlayer() { nextPlayerButton.interactable = false; newQuestionButton.GetComponentInChildren().text = LocalizationManager.Instance.GetText("START_ROUND_TEXT"); } internal void ActivateNextPlayer() { nextPlayerButton.interactable = true; newQuestionButton.GetComponentInChildren().text = LocalizationManager.Instance.GetText("NEW_QUESTION"); } public void SetGameOver() { nextPlayerButton.interactable = false; newQuestionButton.interactable = false; } }