예제 #1
0
 public void JumpToQuestion(int value)
 {
     Debug.Log(value);
     qM.SetCurrentQuestion(value);
     RefreshQuestion();
 }
예제 #2
0
    public void UpdateData()
    {
        Data dataToAdd = new Data();

        Debug.Log(version + "  /  " + data.version);
        if (version != data.version)
        {
            Debug.Log("Update Required");

            dataToAdd.tests           = qm.tests;
            dataToAdd.currentTest     = qm.GetCurrentTestInt();
            dataToAdd.currentQuestion = qm.GetCurrentQuestionInt();

            foreach (Test testToAdd in dataToAdd.tests)
            {
                bool testExists = false;

                foreach (Test test in data.tests)
                {
                    if (test.name == testToAdd.name)
                    {
                        testExists = true;

                        Debug.Log(testToAdd.name + " does already exist in data\nCheck test's questions");

                        foreach (Question questionToAdd in testToAdd.questions)
                        {
                            bool questionExists = false;


                            foreach (Question question in test.questions)
                            {
                                if (questionToAdd.question == question.question)
                                {
                                    Debug.Log(questionToAdd.question + "does already exist in data");
                                    questionExists = true;
                                    break;
                                }
                            }

                            if (!questionExists)
                            {
                                test.questions.Add(questionToAdd);
                                Debug.Log(questionToAdd + "did NOT exist in data and has been added");
                            }
                        }


                        break;
                    }
                }

                if (!testExists)
                {
                    data.tests.Add(testToAdd);
                    Debug.Log(testToAdd.name + "did NOT exist in data and has been added");
                }
            }
            dataToAdd = null;
            Debug.Log("Update successfull");
            qm.tests = this.data.tests;
            qm.SetCurrentQuestion(this.data.currentQuestion);
            qm.SetCurrentTest(this.data.currentTest);
            version = this.data.version;
            Save();
        }

        else
        {
            Debug.Log("No update required");
            qm.tests = this.data.tests;
            qm.SetCurrentQuestion(this.data.currentQuestion);
            qm.SetCurrentTest(this.data.currentTest);
            version = this.data.version;
        }
    }
예제 #3
0
 public void OnClickCall()
 {
     qm.SetCurrentQuestion(question);
     ui.RefreshQuestion();
     transform.parent.parent.gameObject.SetActive(false);
 }