コード例 #1
0
        public void Save <T>(T dataToSave, string path, UnityAction <SaveResult, string> CompleteMethod, bool encrypted) where T : class, new()
        {
            byte[] bytes = BinarySerializationUtility.SerializeProperties(dataToSave);

            if (encrypted)
            {
                BinarySerializationUtility.EncryptData(ref bytes);
            }
            File.WriteAllBytes(path, bytes);
            if (CompleteMethod != null)
            {
                CompleteMethod(SaveResult.Success, "");
            }
        }
コード例 #2
0
        public void Save <T>(T dataToSave, string path, UnityAction <SaveResult, string> CompleteMethod, bool encrypted) where T : class, new()
        {
            byte[] bytes = BinarySerializationUtility.SerializeProperties(dataToSave);

            if (this.encrypted)
            {
                BinarySerializationUtility.EncryptData(ref bytes);
            }
            string serializedData = ConvertToString(bytes);

            PlayerPrefs.SetString(path, serializedData);
            if (CompleteMethod != null)
            {
                CompleteMethod(SaveResult.Success, "");
            }
        }