using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AnswerLineInfoScript : MonoBehaviour { [SerializeField] Button nextPlayerButton; [SerializeField] Button prevPlayerButton; [SerializeField] Text lockedQuestionsText; [SerializeField] Text unlockedQuestionsText; [SerializeField] GameObject scrollView; [SerializeField] GameObject gameManager; private void Start() { nextPlayerButton.onClick.AddListener(ShowPrevPlayerAnswerLine); prevPlayerButton.onClick.AddListener(ShoeNextPlayerAnswerLine); } private void Update() { UpdateLockedQuestionsText(); UpdateUnlockedQuestionsText(); } public void UpdateButtonsText() { List> players = gameManager.GetComponent().GetPlayers(); if (players.Count <= 1) { nextPlayerButton.gameObject.SetActive(false); prevPlayerButton.gameObject.SetActive(false); } else { nextPlayerButton.gameObject.SetActive(true); prevPlayerButton.gameObject.SetActive(true); } } private void UpdateUnlockedQuestionsText() { int unlockedQuestionCount = scrollView.GetComponent().GetUnlockedQuestionCount(); if (unlockedQuestionCount <= 0) { unlockedQuestionsText.gameObject.SetActive(false); } else { unlockedQuestionsText.gameObject.SetActive(true); unlockedQuestionsText.text = String.Format( LocalizationManager.Instance.GetText( unlockedQuestionsText.GetComponent().key), unlockedQuestionCount); } } private void UpdateLockedQuestionsText() { ScrollViewScript scrollViewScript = scrollView.GetComponent(); int lockedQuestionsCount = scrollViewScript.GetQuestionIdsInAnswerLine().Count - scrollViewScript.GetUnlockedQuestionCount(); lockedQuestionsText.text = String.Format( LocalizationManager.Instance.GetText( lockedQuestionsText.GetComponent().key), lockedQuestionsCount); } private void ShoeNextPlayerAnswerLine() { throw new NotImplementedException(); } private void ShowPrevPlayerAnswerLine() { throw new NotImplementedException(); } }