コード例 #1
0
    public override void ShowQuestion(int currentQuestionIndex, Sprite questionImage, Sprite questionOriginalImage, string answer, bool reveal = false)
    {
        base.ShowQuestion(currentQuestionIndex, questionImage, questionOriginalImage, answer, reveal);

        _answer.text = answer;
        _answers[currentQuestionIndex].text = answer;

        _answeredCorrectButton.onClick.RemoveAllListeners();
        _answeredCorrectButton.onClick.AddListener(
            () =>
        {
            _controller.CorrectAnswer();
            _answerButtons[currentQuestionIndex].interactable = false;
        });

        _playerView.ShowQuestion(currentQuestionIndex, questionImage, questionOriginalImage, answer, reveal);
    }
コード例 #2
0
    public void SetController(GalleryRound controller)
    {
        _controller = controller;

        _controller.OnWaitingForNextPlayer    += SetStateWaitingForNextPlayer;
        _controller.OnWaitingForNextQuestion  += SetStateToWaitingForNextQuestion;
        _controller.OnWaitingForAnswersViewed += SetStateToViewAnswers;

        _playerPassedButton.onClick.AddListener(_controller.Pass);
        _nextPictureButton.onClick.AddListener(_controller.ShowNextPicture);
        for (int i = 0; i < _answerButtons.Length; i++)
        {
            int index = i;
            _answerButtons[index].onClick.AddListener(() => { _answerButtons[index].interactable = false; _controller.CorrectAnswer(index); });
        }
        _nextGalleryButton.onClick.AddListener(_controller.NextQuestion);
        _nextGalleryButton.onClick.AddListener(SetStateToWaitingForAnswer);
        _startTimerButton.onClick.AddListener(_controller.StartTimer);
        _startTimerButton.onClick.AddListener(SetStateWaitingForAnswerOfSecondThirdPlayer);
        _nextPlayerButton.onClick.AddListener(_controller.NextTeam);
    }