1
TNet 3 Support / Re: Packet.RequestLoadFile for loading save data
« on: November 24, 2014, 12:07:57 PM »
referenced to this: http://www.tasharen.com/tnet/docs/class_t_n_manager.html#a242088944ea89b4c1355ce8a36230c4a
Two classes, one for save and one to load. Saving is fine, I got the file and the string to save on the server.
Loading has an issue, the loading seems to always been taken from local not from the server. I set the filename to one that had been deleted on the server. When I load it reads data from a local file as the one from the server had been deleted. I don't know where this local file reside.
According to the class reference it should read from the server. May I know what I might be missing from the script? And where might this file be located locally?
My code:
Two classes, one for save and one to load. Saving is fine, I got the file and the string to save on the server.
Loading has an issue, the loading seems to always been taken from local not from the server. I set the filename to one that had been deleted on the server. When I load it reads data from a local file as the one from the server had been deleted. I don't know where this local file reside.
According to the class reference it should read from the server. May I know what I might be missing from the script? And where might this file be located locally?
My code:
- public class SaveGame : MonoBehaviour {
- public void SaveAGame()
- {
- BinaryWriter writer = TNManager.BeginSend(Packet.RequestSaveFile);
- writer.Write("testfile3");
- writer.Write(50);
- writer.Write("77777777");
- TNManager.EndSend();
- }
- }
- public class LoadGame : MonoBehaviour {
- static void OnLoadFile (string filename, byte[] data)
- {
- // 'data' is your file's contents
- string result = System.Text.Encoding.UTF8.GetString(data);
- Debug.Log("file content: " + result.ToString());
- }
- public void LoadFile (string filename)
- {
- TNManager.LoadFile(filename, OnLoadFile);
- }
- }
