Esempio n. 1
0
    public static bool Save(string prefKey, OptionIOData serializableObject)
    {
        MemoryStream memoryStream = new MemoryStream();
        #if UNITY_IPHONE || UNITY_IOS
        System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes");
        #endif
        BinaryFormatter bf = new BinaryFormatter();
        bf.Serialize(memoryStream, serializableObject);

        string tmp = System.Convert.ToBase64String(memoryStream.ToArray());
        try
        {
            PlayerPrefs.SetString(prefKey, tmp);
        }
        catch (PlayerPrefsException)
        {
            return false;
        }
        return true;
    }
Esempio n. 2
0
    public void save()
    {
        OptionIOData opData = new OptionIOData();
        audioMixer.GetFloat("MasterVolume", out opData.fMasterVol); opData.fMasterVol = Mathf.InverseLerp(-80, 0, opData.fMasterVol);
        audioMixer.GetFloat("MusicVolume", out opData.fBGMVol); opData.fBGMVol = Mathf.InverseLerp(-80, 0, opData.fBGMVol);
        audioMixer.GetFloat("SEVolume", out opData.fSEVol); opData.fSEVol = Mathf.InverseLerp(-80, 0, opData.fSEVol);
        opData.bGyroEnable = _appController.gyroEnable;

        save(opData);
    }
Esempio n. 3
0
 public void save(OptionIOData data)
 {
     // 保存用クラスにデータを格納.
     OptionIO.Save("OptionData", data);
     PlayerPrefs.Save();
 }