Exemplo n.º 1
0
        private bool QuestionIsRepeat(ColorTest question)
        {
            if (lastQuestions.Contains(question))
            {
                return(true);
            }

            for (int i = 1; i < 4; i++)
            {
                int ind = lastQuestions.Count - i;

                if (ind > -1)
                {
                    if (lastQuestions[ind].Color == question.Color || lastQuestions[ind].Text == question.Text)
                    {
                        return(true);
                    }
                }
                else
                {
                    break;
                }
            }

            lastQuestions.Add(question);
            while (lastQuestions.Count > standartRepeatCount)
            {
                lastQuestions.RemoveAt(0);
            }

            return(false);
        }
Exemplo n.º 2
0
        public void CreateNewQuestion()
        {
            do
            {
                Color  color = ColorTest.colorCollection[rnd.Next(ColorTest.colorCollection.Count)].Color;
                string text  = ColorTest.colorCollection[rnd.Next(ColorTest.colorCollection.Count)].Text;

                currentQuestion = new ColorTest(color, text);
            } while (QuestionIsRepeat(currentQuestion));
        }
Exemplo n.º 3
0
    private GameObject modalWindow; // a modal window object

    void Start()
    {
        int checkGyro = 0; trDirect = false;

        // pass gyroscope cheking in editor mode
        #if UNITY_EDITOR
        checkGyro = 1;
        #else
        if (SystemInfo.supportsGyroscope)
        {
            checkGyro = 1;
        }
        #endif

        GameObject ObjEventSystem = GameObject.Find("GvrEventSystem");
        runText = GameObject.Find("run").GetComponent <Text>();
        if (ObjEventSystem)
        {
            SceneEventSystem = ObjEventSystem.GetComponent <EventSystem>();
            // if (SceneEventSystem) { SceneEventSystem.enabled = false; }
        }
        else
        {
            Debug.Log("Can not find Event System");
        }
        // Camera.main.GetComponent<GvrPointerPhysicsRaycaster>().enabled = false;
        GameObject camTimedPointer = GameObject.Find("GvrReticlePointer");
        timedPointer = camTimedPointer.GetComponent <Renderer>().material;
        string lng = Application.systemLanguage.ToString();
        if (Data.isLanguge(lng))
        {
            userLang = lng;
        }
        //userLang = "Spanish";
        utility    = new Utility(this, isDebug);
        utility3D  = new Utility3D(this, utility);
        colorTest  = new ColorTest(this, utility);
        camFade    = GameObject.Find("camProtector");
        connection = new Connection(Data.getConnectionData()["ServerIP"] + ":" + Data.getConnectionData()["ServerPort"], isNet, utility);
        string deviceDesc = "";

        try
        { deviceDesc = "#_" + SystemInfo.deviceModel + ",#_" + SystemInfo.deviceType + ",#_" + SystemInfo.deviceName + ",#_" + SystemInfo.operatingSystem; }catch (System.Exception e) { Debug.Log(e); }
        //Debug.Log("deviceDesc: " + deviceDesc + connection.deviceUUID);
        //utility.logDebug("Init");
        userData = new UserData()
        {
            name       = "", email = "", birth = "", gender = "",
            input      = Input.touchSupported.ToString(),
            zone       = System.TimeZoneInfo.Local.ToString(),
            deviceID   = connection.deviceUUID,
            lang       = userLang, ip = "",
            txtVersion = Data.getVersion(),
            gyro       = checkGyro,
            deviceInfo = deviceDesc
        };
        gmArrow = GameObject.Find("Arrow");
        if (gmArrow)
        {
            gmArrow.GetComponent <Image>().enabled = true;
            gmArrow.SetActive(false);
        }
        initTestData();
        if (sendDatafromFile)
        {
            testConnection();
        }
        //Debug.Log("start "+trDirect);
        if (checkGyro > 0)
        {
            StartCoroutine(utility.FadeScene(1f, true, new Color(0.2f, 0.2f, 0.2f, 1), checkGyro));
        }
        else
        {
            //StartCoroutine(utility.PauseInit(7,0));
            if (SceneEventSystem)
            {
                SceneEventSystem.enabled = true;
            }
            rootObj         = utility.CreateCanvas("rootMenu", new Vector3(0, -2, 4), new Vector2(400, 100));
            runText.enabled = true;
            runText.text    = Data.getMessage(userLang, "gyroWarn");
            utility.CreateButton(rootObj.transform, "Start", Data.getMessage(userLang, "btnNext"), "StartGyro", "", new Vector3(0, 0, 0), new Vector2(200, 60));
            //rootObj = utility.ShowMessage(Data.getMessage(userLang, "gyroWarn"), "Next", Data.getMessage(userLang, "btnStart"), new Vector2(1200, 400), TextAnchor.MiddleCenter, new Vector2(0, 40));
            //Camera.main.GetComponent<GvrPointerPhysicsRaycaster>().enabled = true;
            SceneEventSystem.enabled = true;
            curScene = -1;
        }
    }