コード例 #1
0
    /// <summary>
    /// Puts the info.json values of the quiz named 'quizName'
    /// into the fields of the Overview Window
    /// </summary>
    public void SetValuesIntoFields()
    {
        string path = gm.quizzesDir + "/" + quizName + "/info.json";

        st.LoadInfo(path);

        nameOfQuizField.text   = st.info.nazov; Debug.Log("just set the name into the field: \"" + st.info.nazov + "\"");
        quizDescField.text     = st.info.opis;
        timeText.text          = overallQuizTime.ToString();
        questionCountText.text = questionCount.ToString();
    }
コード例 #2
0
    private void Update()
    {
        string quizToLoad = inputField.text;
        string path       = gm.quizzesDir + "/" + quizToLoad;

        if (Directory.Exists(path))
        {
            string infoFilePath = path + "/info.json";

            st.LoadInfo(infoFilePath);
            nameDisplay.text = st.info.nazov;
            infoDisplay.text = st.info.opis;
        }
    }
コード例 #3
0
    private void CreateQuiz(string name)
    {
        //SetQuizName is called only in this one place!!!
        //To change the name of an already created directory, we use ChangeQuizName!!!
        questionCreator.SetQuizName(name);

        string thisQuizDir = gm.quizzesDir + "/" + name;

        Directory.CreateDirectory(thisQuizDir);

        Directory.CreateDirectory(thisQuizDir + "/Obrázky");
        Directory.CreateDirectory(thisQuizDir + "/Otázky");

        File.WriteAllText(thisQuizDir + "/info.json", gm.SampleInfo.text);

        //TODO: Make a Json Utility class for reading and overwriting json files
        storageSys.info.nazov = name; //we use name instead of nameText.text because we trimmed whitespace from the end of the var. name
        storageSys.info.opis  = descriptionText.text;
        storageSys.SaveInfo(thisQuizDir + "/info.json");

        storageSys.LoadInfo(thisQuizDir + "/info.json");
    }