public void LoadOptionData()
    {
        string optionfilePath = Application.persistentDataPath + "/optionData.json";

        try
        {
            //File.ReadAllText(Application.dataPath + "/optionData.json");
            if (File.Exists(optionfilePath))
            {
                string str_optiondata = File.ReadAllText(optionfilePath);
                g_optiondata = JsonUtility.FromJson <Option_data>(str_optiondata);
            }
            else
            {
                g_optiondata.SetOption(true, true);
                File.WriteAllText(optionfilePath, JsonUtility.ToJson(g_optiondata, true));
            }
        }
        catch (FileNotFoundException e)
        {
            Debug.Log("The file was not found:" + e.Message);
        }
        catch (DirectoryNotFoundException e)
        {
            Debug.Log("The directory was not found: " + e.Message);
        }
        catch (IOException e)
        {
            Debug.Log("The file could not be opened:" + e.Message);
        }
    }
Exemple #2
0
 public void LoadOptionDataToTemp()
 {
     cur_optiondata.SetOption(OptionData.g_optiondata.GetSoundIsTrue(), OptionData.g_optiondata.GetKorIsTrue());
     SoundCheckObjImage.sprite    = (cur_optiondata.GetSoundIsTrue()) ? CheckImage : UnCheckImage;
     LanguageCheckObjImage.sprite = (cur_optiondata.GetKorIsTrue()) ? KoreanImage : EnglishImage;
 }