AnswerLineInfoScript.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class AnswerLineInfoScript : MonoBehaviour
  7. {
  8. [SerializeField] Button nextPlayerButton;
  9. [SerializeField] Button prevPlayerButton;
  10. [SerializeField] Text lockedQuestionsText;
  11. [SerializeField] Text unlockedQuestionsText;
  12. [SerializeField] GameObject scrollView;
  13. private void Start() {
  14. nextPlayerButton.onClick.AddListener(ShowPrevPlayerAnswerLine);
  15. prevPlayerButton.onClick.AddListener(ShoeNextPlayerAnswerLine);
  16. }
  17. private void Update() {
  18. UpdateLockedQuestionsText();
  19. UpdateUnlockedQuestionsText();
  20. }
  21. private void UpdateUnlockedQuestionsText() {
  22. int unlockedQuestionCount = scrollView.GetComponent<ScrollViewScript>().GetUnlockedQuestionCount();
  23. unlockedQuestionsText.text = String.Format(
  24. LocalizationManager.Instance.GetText(
  25. unlockedQuestionsText.GetComponent<TextLocalization>().key),
  26. unlockedQuestionCount);
  27. }
  28. private void UpdateLockedQuestionsText() {
  29. ScrollViewScript scrollViewScript = scrollView.GetComponent<ScrollViewScript>();
  30. int lockedQuestionsCount = scrollViewScript.GetQuestionIdsInAnswerLine().Count - scrollViewScript.GetUnlockedQuestionCount();
  31. lockedQuestionsText.text = String.Format(
  32. LocalizationManager.Instance.GetText(
  33. lockedQuestionsText.GetComponent<TextLocalization>().key),
  34. lockedQuestionsCount);
  35. }
  36. private void ShoeNextPlayerAnswerLine()
  37. {
  38. throw new NotImplementedException();
  39. }
  40. private void ShowPrevPlayerAnswerLine()
  41. {
  42. throw new NotImplementedException();
  43. }
  44. }