/// <summary> /// 把Dictionary序列化为byte数据 /// Saves the table data. /// </summary> /// <param name="dic">Dic.</param> /// <param name="tablename">Tablename.</param> public static void SaveTableData(List <object> list, string tablename) { byte[] data = GameCommon.SerializeObject(list); byte[] gzipData = GameCommon.CompressGZip(data); //WriteByteToFile(gzipData,tablename); GameCommon.WriteByteToFile(gzipData, GameConst.SaveConfigFilePath(tablename)); }
public void SaveData() { UserDataMode userdatamode = new UserDataMode(); userdatamode.SetData(userData); byte[] data = GameCommon.SerializeObject(userdatamode); byte[] gzipData = GameCommon.CompressGZip(data); GameCommon.WriteByteToFile(gzipData, GameConst.GetPersistentDataPath(GameConst.userDataFileName)); }
void DownloadCallback(WWW p_www) { if (p_www.error != null) { UpdateConfig(); return; } GameCommon.WriteByteToFile(p_www.bytes, configPath + _updateList[0].name); _updateList.RemoveAt(0); UpdateConfig(); }
static void WriteDataToFile(LevelOption od, DataStream data) { string filePath = GameConst.GetLevelDataFilePath(od.levelName + ".bytes"); byte[] objData = data.ToByteArray(); byte[] objGzipData = GameCommon.CompressGZip(objData); GameCommon.WriteByteToFile(objGzipData, filePath); Debug.Log("save path : " + filePath); EditorUtility.DisplayDialog("导出关卡" + od.levelName + "成功!", filePath, "确定"); }
public void SaveData(params BaseUserData[] datas) { for (int i = 0; i < datas.Length; i++) { DataStream stream = new DataStream(true); datas[i].Serialize(stream); byte[] gzipData = GameCommon.CompressGZip(stream.ToByteArray()); GameCommon.WriteByteToFile(gzipData, GameConst.GetPersistentDataPath(datas[i].GetDataType() + "")); } }