public void LoadLevel(string fileName) { byte[] levelGzipData = GameCommon.ReadByteToFile(GameConst.GetLevelDataFilePath(fileName + ".lmd")); byte[] levelData = GameCommon.UnGZip(levelGzipData); DataStream datastream = new DataStream(levelData, true); ReloadScene(datastream); Closeed(); }
//====================================================== public void LoadData(BaseUserData userdata, UserDataType type) { string dataname = type + ""; string filepath = GameConst.GetPersistentDataPath(dataname); byte[] gzipdata = GameCommon.ReadByteToFile(filepath); if (gzipdata == null) { } else { byte[] data = GameCommon.UnGZip(gzipdata); DataStream datastream = new DataStream(data, true); userdata.Deserialize(datastream); } }
//====================================================== public void LoadData() { string filepath = GameConst.GetPersistentDataPath(GameConst.userDataFileName); byte[] gzipdata = GameCommon.ReadByteToFile(filepath); UserDataMode userdata; if (gzipdata == null) { userdata = new UserDataMode(); CopyData(userdata); SaveData(); } else { byte[] data = GameCommon.UnGZip(gzipdata); userdata = (UserDataMode)GameCommon.DeserializeObject(data); CopyData(userdata); } }