88 */
99using System . IO ;
1010using System . Text ;
11- using UnityEngine ;
11+ using Newtonsoft . Json ;
1212
1313namespace JCSUnity
1414{
@@ -25,11 +25,11 @@ public abstract class JCS_JSONData : JCS_AppData
2525 /* Functions */
2626
2727 /// <summary>
28- /// Save the game data into xml file format.
28+ /// Save the applicatiion data into JSON file format.
2929 /// </summary>
3030 /// <typeparam name="T"> type of the data save. </typeparam>
3131 /// <param name="filePath"> where to save. </param>
32- /// <param name="fileName"> name of the file u want to save. </param>
32+ /// <param name="fileName"> name of the file you want to save. </param>
3333 public override void Save < T > ( string filePath , string fileName )
3434 {
3535 string fullFilePath = filePath + fileName ;
@@ -38,11 +38,11 @@ public override void Save<T>(string filePath, string fileName)
3838 }
3939
4040 /// <summary>
41- /// Save the game data into xml file format.
41+ /// Save the applicatiion data into JSON file format.
4242 /// </summary>
4343 /// <typeparam name="T"> type of the data save. </typeparam>
4444 /// <param name="filePath"> where to save. </param>
45- /// <param name="fileName"> name of the file u want to save. </param>
45+ /// <param name="fileName"> name of the file you want to save. </param>
4646 public override void Save < T > ( string fullFilePath )
4747 {
4848 string filePath = Path . GetDirectoryName ( fullFilePath ) ;
@@ -53,20 +53,20 @@ public override void Save<T>(string fullFilePath)
5353
5454 using ( var stream = new FileStream ( fullFilePath , FileMode . Create ) )
5555 {
56- string json = JsonUtility . ToJson ( this ) ;
56+ string json = JsonConvert . SerializeObject ( this ) ;
5757 byte [ ] info = new UTF8Encoding ( true ) . GetBytes ( json ) ;
5858 stream . Write ( info , 0 , info . Length ) ;
5959 }
6060 }
6161
6262 /// <summary>
63- /// Load the game data from a directory file path.
63+ /// Load the applicatiion data from a directory file path.
6464 /// </summary>
65- /// <typeparam name="T"> type of the game data u want to load. </typeparam>
65+ /// <typeparam name="T"> type of the applicatiion data you want to load. </typeparam>
6666 /// <param name="filePath"> file directory, location, path. </param>
67- /// <param name="fileName"> name of the file u want to load. </param>
67+ /// <param name="fileName"> name of the file you want to load. </param>
6868 /// <returns>
69- /// Full game data. If the file does not exists returns
69+ /// Full applicatiion data. If the file does not exists returns
7070 /// null references.
7171 /// </returns>
7272 public static T LoadFromFile < T > ( string filePath , string fileName )
@@ -77,12 +77,12 @@ public static T LoadFromFile<T>(string filePath, string fileName)
7777 }
7878
7979 /// <summary>
80- /// Load the game data from a directory file path.
80+ /// Load the applicatiion data from a directory file path.
8181 /// </summary>
82- /// <typeparam name="T"> type of the game data u want to load. </typeparam>
82+ /// <typeparam name="T"> type of the applicatiion data you want to load. </typeparam>
8383 /// <param name="fullFilePath"> file path to the file. </param>
8484 /// <returns>
85- /// Full game data. If the file does not exists returns
85+ /// Full applicatiion data. If the file does not exists returns
8686 /// null references.
8787 /// </returns>
8888 public static T LoadFromFile < T > ( string fullFilePath )
@@ -97,7 +97,7 @@ public static T LoadFromFile<T>(string fullFilePath)
9797 {
9898 contents = sr . ReadToEnd ( ) ;
9999 }
100- return JsonUtility . FromJson < T > ( contents ) ;
100+ return JsonConvert . DeserializeObject < T > ( contents ) ;
101101 }
102102 }
103103 }
0 commit comments