Пример #1
0
    void gotoNextAgreement()
    {
        if (cur_text < total_num_agreements)
        {
            if ((cur_text == 5) || (cur_text == 6))
            {
                ad.DisplayAndroidWindow(questions [cur_text], AndroidDialogue.DialogueType.YESONLY);
            }
            else
            {
                ad.DisplayAndroidWindow(questions [cur_text]);
            }
        }

        if (cur_text >= total_num_agreements)
        {
            Utilities.writefile("consentRecord", "1");
            SceneManager.LoadScene("Title_screen");
        }
        else
        {
            for (int i = 0; i < total_num_agreements; ++i)
            {
                //if (i == cur_text)
                //	AgreementTexts.transform.GetChild (i).gameObject.SetActive (true);
                //else
                //	AgreementTexts.transform.GetChild (i).gameObject.SetActive (false);
            }
            cur_text += 1;
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        //MUST have internet connection
        if (Const.TEST_CONNECTION)
        {
            if (!doneTesting)
            {
                string str = Utilities.check_InternetConnection();
                if (str.Length == 0)                  //we're good to go
                {
                    doneTesting    = true;
                    titleText.text = Database.tcText_main;
                }
                else
                {
                    titleText.text = str;
                }
            }
        }


                #if UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE
        if (!android_window_displayed)
        {
            android_window_displayed = true;
            finished_reading         = false;
            ad.clearflag();
            ad.DisplayAndroidWindow(Database.tcmsg, AndroidDialogue.DialogueType.YESONLY);
        }

        if (!URL_opened && ad.yesclicked() && !finished_reading)
        {
            //open URL
            URL_opened = true;
            Application.OpenURL("http://echolock.andrew.cmu.edu/consent/"); //"http://echolock.andrew.cmu.edu/consent/?"
        }
        else if (URL_opened && !finished_reading)                           //report code from popup using reportConsent()
        {
            finished_reading = true;
            ad.clearflag();
            ad.DisplayAndroidWindow("Enter code provided from \n the consent form:", AndroidDialogue.DialogueType.INPUT);
        }
        else if (URL_opened && finished_reading && ad.yesclicked())
        {
            Utilities.writefile("consentRecord", "1");
            reportConsent(ad.getInputStr());
            ad.clearflag();
            ad.DisplayAndroidWindow("Thank you!", AndroidDialogue.DialogueType.YESONLY);
            SceneManager.LoadScene("Title_Screen");
        }
                #endif

        play_audio();

        //Check if we are running either in the Unity editor or in a standalone build.
                #if UNITY_STANDALONE || UNITY_WEBPLAYER
        if (eh.isActivate())
        {
            InputEvent ie = eh.getEventData();
            switch (ie.keycode)
            {
            //Get input from the input manager, round it to an integer and store in horizontal to set x axis move direction
            case KeyCode.RightArrow:
                //SoundManager.instance.PlaySingle(swipeRight);
                break;

            case KeyCode.LeftArrow:
                SceneManager.LoadScene("Title_Screen");
                SoundManager.instance.PlaySingle(Database.instance.swipeAhead);
                break;

            case KeyCode.UpArrow:
                break;

            case KeyCode.DownArrow:                    //BACK
                //SoundManager.instance.PlaySingle(Database.instance.swipeAhead);
                //credit
                break;

            default:
                break;
            }
        }

        //Check if we are running on iOS, Android, Windows Phone 8 or Unity iPhone
                #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Screen.orientation  = ScreenOrientation.Landscape;
                #endif //End of mobile platform dependendent compilation section started above with #elif
    }