Пример #1
0
    // Update is called once per frame
    void Update()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        //React to user touches
        foreach (Vector2 pos in GetTouchOrMouseInteractions())
        {
            // Get the origin of the tap
            Vector2 origin = Camera.main.ScreenToWorldPoint(pos);
            float   Xeye   = 0.5f + origin.x / (22.5f - 2f * origin.y);

            // log every tap?? what is the point of logging the position

            /*
             *          StreamWriter w;
             *          w = new StreamWriter(Application.persistentDataPath + "/" + logInfo.PlayerName + '/'
             + logInfo.Filename, true);
             +          w.WriteLine(DateTime.Now.ToString() + "\t" + origin.x.ToString() + "\t" + origin.y.ToString() + "\n");
             +          w.Close();
             */
            //using auto closes streamwrite
            //prevents problems if w.close() is not executed
            using (StreamWriter w = logInfo.LogFileInfo.AppendText())
            {
                w.WriteLine(DateTime.Now.ToString() + "\t" + origin.x.ToString() + "\t" + origin.y.ToString());
            }

            //Get opie to look where the touch occured
            Opie.instance().head().set_linked_pose_and_eye_position(Xeye, 0.0f,
                                                                    Opie.Head.transition_action());
        }
#endif

        // if we are waiting for some resources to be loaded
        if (resourceLoading)
        {
            if (extRes.AreStoryResourcesReady())
            {
                resourceLoading  = false;
                LoadingText.text = "";
                Debug.Log("Load next page time" + (Time.realtimeSinceStartup - startTime).ToString());
            }
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (activityChosen == (int)MainLogging.ActivityType.Memory)
        {
            logInfo.LogStartActivity(mainLog.ActivityNames[(int)MainLogging.ActivityType.Memory]);
            mainLog.UpdateLanguageAndActivity();
            UnityEngine.SceneManagement.SceneManager.LoadScene("ProgressMenu");

            /*
             * if (extRes.AreResourcesReady())
             * {
             *
             *  logInfo.LogStartActivity(mainLog.ActivityNames[(int)MainLogging.ActivityType.Memory]);
             *  mainLog.UpdateLanguageAndActivity();
             *  Debug.Log("Load memory time" + (Time.realtimeSinceStartup - startTime).ToString());
             *  UnityEngine.SceneManagement.SceneManager.LoadScene("ProgressMenu");
             * }*/
        }
        else if (activityChosen == (int)MainLogging.ActivityType.Repetition)
        {
            if (extRes.AreResourcesReady())
            {
                logInfo.LogStartActivity(mainLog.ActivityNames[(int)MainLogging.ActivityType.Repetition]);
                mainLog.UpdateLanguageAndActivity();
                UnityEngine.SceneManagement.SceneManager.LoadScene("WordRep");
            }
        }
        else if (activityChosen == (int)MainLogging.ActivityType.Story)
        {
            if (extRes.AreStoryResourcesReady())
            {
                Debug.Log("Load Story time" + (Time.realtimeSinceStartup - startTime).ToString());
                logInfo.LogStartActivity(mainLog.ActivityNames[(int)MainLogging.ActivityType.Story]);
                mainLog.UpdateLanguageAndActivity();
                UnityEngine.SceneManagement.SceneManager.LoadScene("Story_scene");
            }
        }
    }