コード例 #1
0
        public static void NewLocalizationSave(string fileName)
        {
            BinaryFormatter formatter = new BinaryFormatter();

            string     path   = Application.persistentDataPath + "/localization.cache";
            FileStream stream = new FileStream(path, FileMode.Create);

            LocalizationState localState = new LocalizationState(fileName);

            formatter.Serialize(stream, localState);
            stream.Close();
            Debug.Log(Application.persistentDataPath);
        }
コード例 #2
0
        public static LocalizationState LoadData()
        {
            string path = Application.persistentDataPath + "/localization.cache";

            if (File.Exists(path))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                FileStream      stream    = new FileStream(path, FileMode.Open);

                LocalizationState data = formatter.Deserialize(stream) as LocalizationState;
                stream.Close();
                Debug.Log(data.LocalizationFileName);
                return(data);
            }
            else
            {
                Debug.Log("Error not found!");
                return(null);
            }
        }