public void Unserialize(Core.BinaryFileReader reader) { m_Location = reader.ReadByte(); reader.ReadByte(); // length m_Conditions.Clear(); int conditioncount = reader.ReadByte(); for (int i = 0; i < conditioncount; i++) { Condition condition = new Condition(); condition.Unserialize(reader); m_Conditions.Add(condition); } m_Effects.Clear(); int effectcount = reader.ReadByte(); for (int i = 0; i < effectcount; i++) { Effect effect = new Effect(); effect.Unserialize(reader); m_Effects.Add(effect); } }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version >= 0) { // version 0 int count = reader.ReadInt(); for (int i = 0; i < count; i++) { string name = reader.ReadString(); int tileset = reader.ReadInt(); byte[] data = new byte[64]; for (int j = 0; j < 64; j++) { data[j] = reader.ReadByte(); } m_Chunks.Add(new Chunk(data, tileset)); m_Chunks[m_Chunks.Count - 1].Name = name; } } return(true); }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version >= 0) { // version 0 int count = reader.ReadInt(); for (int i = 0; i < count; i++) { byte[] data = new byte[4]; data[0] = reader.ReadByte(); data[1] = reader.ReadByte(); data[2] = reader.ReadByte(); data[3] = reader.ReadByte(); m_Palettes.Add(data); } } return(true); }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version >= 0) { // version 0 int count = reader.ReadInt(); for (int i = 0; i < count; i++) { byte[] data = new byte[4096]; for (int j = 0; j < 4096; j++) { data[j] = reader.ReadByte(); } m_TileGfxPages.Add(data); } } return(true); }
public bool Unserialize(string path) { if (File.Exists(path)) { using (FileStream bin = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { Core.BinaryFileReader reader = new Core.BinaryFileReader(new BinaryReader(bin)); string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version > 0) { return(false); } else { if (!m_Palettes.Unserialize(reader)) { return(false); } if (!m_TileGfx.Unserialize(reader)) { return(false); } if (!m_TileSets.Unserialize(reader)) { return(false); } if (!m_Chunks.Unserialize(reader)) { return(false); } if (!m_Maps.Unserialize(reader)) { return(false); } if (!m_Sprites.Unserialize(reader)) { return(false); } fixData(); return(true); } } } else { return(false); } }
public SpriteMetaTileFrame(Core.BinaryFileReader reader, int version) { m_Tile = reader.ReadByte(); m_Attributes = reader.ReadByte(); if (version >= 2) { m_TilePage = reader.ReadByte(); } else { m_TilePage = 1; // debug. } }
public void Unserialize(Core.BinaryFileReader reader) { m_Location = reader.ReadByte(); m_SaveIndex = reader.ReadUShort(); m_TypeLo = reader.ReadByte(); m_TypeHi = reader.ReadByte(); if (IsContainer) { reader.ReadByte(); int count = reader.ReadByte(); for (int i = 0; i < count; i++) { Actor actor = new Actor(); actor.Unserialize(reader); m_Contents.Add(actor); } } }
// ================================================================================ // Import/Export data // ================================================================================ public void Unserialize(Core.BinaryFileReader reader, int version) { Name = reader.ReadString(); m_Data = reader.ReadByte(); m_Tile = reader.ReadByte(); if (HasStandardSprites) { m_StandardFrames = new SpriteMetaTileFrame[8][]; for (int i = 0; i < 8; i++) { m_StandardFrames[i] = new SpriteMetaTileFrame[TilesPerFrame]; for (int j = 0; j < m_StandardFrames[i].Length; j++) { m_StandardFrames[i][j] = new SpriteMetaTileFrame(reader, version); } } } if (HasExtendedSprites) { m_ExtendedFrames = new SpriteMetaTileFrame[4][]; for (int i = 0; i < 4; i++) { m_ExtendedFrames[i] = new SpriteMetaTileFrame[TilesPerFrame]; for (int j = 0; j < m_ExtendedFrames[i].Length; j++) { m_ExtendedFrames[i][j] = new SpriteMetaTileFrame(reader, version); } } } if (ExtraFrames != ExtraFramesEnum.Extra0) { m_ExtraFrames = new SpriteMetaTileFrame[ExtraFramesInt][]; for (int i = 0; i < ExtraFramesInt; i++) { m_ExtraFrames[i] = new SpriteMetaTileFrame[TilesPerFrame]; for (int j = 0; j < m_ExtraFrames[i].Length; j++) { m_ExtraFrames[i][j] = new SpriteMetaTileFrame(reader, version); } } } }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version >= 0) { // version 0 for (int i = 0; i < 4; i++) { m_Chunks[i] = reader.ReadInt(); } m_Tileset = reader.ReadByte(); int count; count = reader.ReadInt(); for (int i = 0; i < count; i++) { Actor actor = new Actor(); actor.Unserialize(reader); m_Actors.Add(actor); } byte length = reader.ReadByte(); count = reader.ReadInt(); for (int i = 0; i < count; i++) { Egg egg = new Egg(); egg.Unserialize(reader); m_Eggs.Add(egg); } } return(true); }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version >= 0) { // version 0 m_Tileset = reader.ReadInt(); if (version == 0) { reader.ReadInt(); reader.ReadInt(); Size = MapSize.W32H32; } else if (version >= 1) { Size = (MapSize)reader.ReadInt(); } if (m_SC == null) { m_SC = new List <SuperChunk>(); } m_SC.Clear(); for (int i = 0; i < WidthInSuperChunks * HeightInSuperChunks; i++) { SuperChunk superchunk = new SuperChunk(); superchunk.Unserialize(reader); m_SC.Add(superchunk); } } return(true); }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); // version 0 int count = reader.ReadInt(); for (int i = 0; i < count; i++) { Sprite sprite = new Sprite(); sprite.Unserialize(reader, version); m_Sprites.Add(sprite); } return(true); }
public bool Unserialize(Core.BinaryFileReader reader) { string id = reader.ReadString(); if (id != c_SerializeIdentifier) { return(false); } int version = reader.ReadInt(); if (version >= 0) { // version 0 int count = reader.ReadInt(); for (int i = 0; i < count; i++) { Map map = new Map(); map.Unserialize(reader); m_Maps.Add(map); } } return(true); }
public void Unserialize(Core.BinaryFileReader reader) { reader.ReadByte(); }