| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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<ScrollViewScript>();
- ts = GameObject.Find("TimerCircle").GetComponent<TimerScript>();
- }
- 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<ScrollViewScript>();
- }
- NewQuestionData q = Database.Instance.GetNewQuestion(svs.GetQuestionIdsInAnswerLine(), svs.currentPlayer, svs.GetGameMode());
- //q.SetAnswerText("???? - ????");
- //svs.SetNewQuestion(q);
- Text nqct = nextCategoryText.GetComponent<Text>();
- CategoryPanel cp = GameObject.Find("Categories").GetComponent<CategoryPanel>();
- CategoryPanel.Category cat = cp.GetCategoryById(q.CategoryId);
- nqct.text = cat.name;
- gameObject.SetActive(true);
- }
- internal void DeactivateNextPlayer() {
- nextPlayerButton.interactable = false;
- newQuestionButton.GetComponentInChildren<Text>().text = LocalizationManager.Instance.GetText("START_ROUND_TEXT");
- }
- internal void ActivateNextPlayer() {
- nextPlayerButton.interactable = true;
- newQuestionButton.GetComponentInChildren<Text>().text = LocalizationManager.Instance.GetText("NEW_QUESTION");
- }
-
- public void SetGameOver() {
- nextPlayerButton.interactable = false;
- newQuestionButton.interactable = false;
- }
- }
|