コード例 #1
0
    private void _buttonPress(int button_id)
    {
        Debug.Log("PRESSED BUTTON: " + button_id);



        // don't allow filling out surveys, when form is not present
        // only really possible from debugging
        if (!sh.survey.activeSelf)
        {
            return;
        }

        if (cool_down)
        {
            return;
        }


        bool more = false;

        try
        {
            more = sh.AnswerQuestion(button_id);
        }
        catch (Exception e)
        {
            more = false;
        }

        if (!more)
        {
            sh.Reset();
            sh.CloseSurvey();
            SurveyDone.Invoke();
        }
        else
        {
            try
            {
                sh.UpdateCanvas();
            }
            catch (RoundDone e)
            {
                sh.Reset();
                sh.CloseSurvey();
                SurveyDone.Invoke();
            }
        }

        StartCoroutine(LiftCoolDown());
    }
コード例 #2
0
    private void _buttonPress(int button_id)
    {
        if (cool_down)
        {
            return;
        }
        cool_down = true;
        StartCoroutine(LiftCoolDown());

        bool more = false;

        try
        {
            more = sh.AnswerQuestion(button_id);
        }
        catch (Exception e)
        {
            // tried to answer question after all have been answered
            more = false;
        }

        if (!more)
        {
            if (sh.firstRoundDone)
            {
                sh.HideButtons();
                sh.sendToServer();
                StartCoroutine(CheckForServerResponse());
            }
            else
            {
                // let's allow for a second fill out of questionnaire pre/post
                sh.Reset();
                Debug.Log("Filled out pre survey, DONE");
            }
        }
        else
        {
            try
            {
                sh.UpdateCanvas();
            }
            catch (FirstRoundDone e)
            {
                sh.Reset();
                sh.SetTitle("Please proceed");
                firstRoundDone.Invoke();
            }
        }
    }