//セーブデータ用のバイナリ読み込み public void Read(BinaryReader reader) { int version = reader.ReadInt32(); if (version < 0 || version > Version) { Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version)); return; } reader.ReadLocalTransform(this.transform); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string key = reader.ReadString(); AdvGraphicInfo graphic = null; reader.ReadBuffer(x => graphic = AdvGraphicInfo.ReadGraphicInfo(Engine, x)); byte[] buffer = reader.ReadBuffer(); AdvGraphicObject obj = CreateObject(key, graphic); obj.Read(buffer, graphic); } string defaulObjectName = reader.ReadString(); DefaultObject = Find(defaulObjectName); }
//セーブデータ用のバイナリ読み込み void ReadSaveData(BinaryReader reader) { int version = reader.ReadInt32(); if (version <= VERSION_1) { ReadOldVersion(reader, version); } else if (version == VERSION) { this.isEventMode = reader.ReadBoolean(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string name = reader.ReadString(); string layerName = reader.ReadString(); string graphicDataType = reader.ReadString(); string graphicKey = reader.ReadString(); bool isDefault = reader.ReadBoolean(); GraphicInfoList graphicInfo = AdvGraphicInfoParser.FindGraphicInfo(engine, graphicDataType, graphicKey); AdvGraphicLayer layer = FindLayer(layerName); AdvGraphicObject graphic = layer.AddObject(name, graphicInfo, isDefault); graphic.Read(graphicInfo, reader); } } else { Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version)); } }