Пример #1
0
        private void OnAnswer(string questionKey, string answerKey, SurveyAnswer.ButtonAction action, int index, int playerIndex)
        {
            List <UISurveyQuestion> survey = null;

            if (playerIndex == 0)
            {
                _answersP1[index] = new QuestionAnswerKeys(questionKey, answerKey);
                survey            = _surveyQuestionsP1;
            }
            else if (playerIndex == 1)
            {
                _answersP2[index] = new QuestionAnswerKeys(questionKey, answerKey);
                survey            = _surveyQuestionsP2;
            }

            if (action == SurveyAnswer.ButtonAction.Show)
            {
                foreach (var question in survey)
                {
                    question.interactable = true;
                }
                if (playerIndex == 0)
                {
                    _skipP1 = false;
                }
                if (playerIndex == 1)
                {
                    _skipP2 = false;
                }
            }
            if (action == SurveyAnswer.ButtonAction.End)
            {
                for (int i = 1; i < survey.Count; i++)
                {
                    survey[i].interactable = false;
                }
                if (playerIndex == 0)
                {
                    _skipP1 = true;
                    for (int i = 1; i < _answersP1.Length; i++)
                    {
                        _answersP1[i] = null;
                    }
                }
                if (playerIndex == 1)
                {
                    _skipP2 = true;
                    for (int i = 1; i < _answersP2.Length; i++)
                    {
                        _answersP2[i] = null;
                    }
                }
            }
        }
Пример #2
0
 private void OnAnswer(string answerKey, SurveyAnswer.ButtonAction action, UISurveyButton answerButton)
 {
     answerButton.Highlight(true);
     foreach (var button in _buttonList)
     {
         if (button != answerButton)
         {
             button.Highlight(false);
         }
     }
     onAnswer(_questionKey, answerKey, action, _index, _playerIndex);
 }