internal void Write(BinaryWriter writer, AdvParamData.FileType fileType) { writer.Write(Version); writer.Write(Tbl.Count); foreach (var keyValue in Tbl) { writer.Write(keyValue.Key); BinaryUtil.WriteBytes(writer, BinaryUtil.BinaryWrite((x) => keyValue.Value.Write(x, fileType))); } }
//コンバートファイルリストのファイルを書き込む void Write() { byte[] bytes = BinaryUtil.BinaryWrite(ConvertFileList.Write); bool isEncoded = Settings.FindSettingFromPath(ConvertFileList.FilePath).EncodeType == AssetFileEncodeType.AlreadyEncoded; if (isEncoded) { bytes = FileIOManager.Encode(bytes); } File.WriteAllBytes(ConvertFileList.FilePath, bytes); }
void WriteCustomSaveData(IAdvCustomSaveDataIO io) { if (Buffers.ContainsKey(io.SaveKey)) { Debug.LogError(string.Format("Custom save data[{0}] is already exsits. Please use another key.", io.SaveKey)); return; } byte[] buffer = BinaryUtil.BinaryWrite(io.OnWrite); Buffers.Add(io.SaveKey, buffer); }
public void MakeBuffer(List <IBinaryIO> ioList) { this.Buffers.Clear(); ioList.ForEach(delegate(IBinaryIO x) { if (this.Buffers.ContainsKey(x.SaveKey)) { Debug.LogError(string.Format("Save data Key [{0}] is already exsits. Please use another key.", x.SaveKey)); } else { byte[] buffer = BinaryUtil.BinaryWrite(new Action <BinaryWriter>(x.OnWrite)); this.Buffers.Add(x.SaveKey, buffer); } }); }
//書き込み public virtual void OnWrite(System.IO.BinaryWriter writer) { writer.Write(Version); writer.Write(ActiveWindows.Count); foreach (var item in ActiveWindows) { writer.Write(item.Key); byte[] buffer = BinaryUtil.BinaryWrite(item.Value.WritePageData); writer.Write(buffer.Length); writer.Write(buffer); } string currentWindowName = CurrentWindow == null ? "" : CurrentWindow.Name; writer.Write(currentWindowName); }
//データを書き込み public void MakeBuffer(List <T> ioList) { Buffers.Clear(); ioList.ForEach( x => { if (Buffers.ContainsKey(x.SaveKey)) { Debug.LogError(string.Format("Save data Key [{0}] is already exsits. Please use another key.", x.SaveKey)); } else { Profiler.BeginSample("MakeBuffer : " + x.SaveKey); byte[] buffer = BinaryUtil.BinaryWrite(x.OnWrite); Buffers.Add(x.SaveKey, buffer); Profiler.EndSample(); } } ); }
/// <summary> /// ゲームのデータをセーブ /// </summary> /// <param name="engine">ADVエンジン</param> /// <param name="tex">セーブアイコン</param> public void SaveGameData(AdvEngine engine, Texture2D tex, List <IAdvCustomSaveDataIO> customSaveIoList, List <IAdvCustomSaveDataIO> verstionUpSaveIoList) { Clear(); currentSenarioLabel = engine.Page.ScenarioLabel; currentPage = engine.Page.PageNo; currentGallerySceneLabel = engine.ScenarioPlayer.CurrentGallerySceneLabel; paramBuf = engine.Param.ToSaveDataBuffer(); graphicManagerBuf = engine.GraphicManager.ToSaveDataBuffer(); soundManagerBuf = SoundManager.GetInstance().ToSaveDataBuffer(); selectionManagerBuf = engine.SelectionManager.ToSaveDataBuffer(); JumpMangerBuffer = BinaryUtil.BinaryWrite(engine.ScenarioPlayer.JumpManager.Write); CustomBuffer = new AdvCustomSaveData(); CustomBuffer.WriteCustomSaveData(customSaveIoList); VersionUpBuffer = new AdvCustomSaveData(); VersionUpBuffer.WriteCustomSaveData(verstionUpSaveIoList); title = engine.Page.SaveDataTitle; Texture = tex; date = System.DateTime.Now; }
internal byte[] ToSaveDataBuffer() { return(BinaryUtil.BinaryWrite((writer) => Write(writer, AdvParamData.FileType.Default))); }
//バイナリデータに public virtual byte[] ToBuffer() { return(BinaryUtil.BinaryWrite(Write)); }
//コンバートファイルリストのファイルを書き込む void Write() { byte[] bytes = BinaryUtil.BinaryWrite(ConvertFileList.Write); bytes = FileIOManager.Encode(bytes); File.WriteAllBytes(ConvertFileList.FilePath, bytes); }