| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.UI;
- using UnityEngine;
- public class RoundButtonsScript : MonoBehaviour
- {
- public Button newQuestionButton;
- public Button nextPlayerButton;
- 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() {
- if (svs == null) {
- svs = GameObject.Find("Scroll View").GetComponent<ScrollViewScript>();
- }
- Database db = GameObject.Find("GameManager").GetComponent<Database>();
- NewQuestion q = db.GetNewQuestion();
- q.SetAnswerText("???? - ????");
- svs.SetNewQuestion(q);
- HidePanel();
- ts.StartTimer();
- }
- void NextPlayer() {
- svs.SetAllQuestionsLocked(true);
- svs.NextPlayer();
- HidePanel();
- }
- public void HidePanel() {
- CanvasGroup cg = this.GetComponent<CanvasGroup>();
- cg.alpha = 0F;
- cg.blocksRaycasts = false;
- }
- public void ShowPanel() {
- CanvasGroup cg = this.GetComponent<CanvasGroup>();
- cg.alpha = 1F;
- cg.blocksRaycasts = true;
-
- }
- }
|