public static DlmBasicElement ReadFromStream(DlmCell cell, BigEndianReader reader) { byte type = reader.ReadByte(); DlmBasicElement.ElementTypesEnum elementTypesEnum = (DlmBasicElement.ElementTypesEnum)type; DlmBasicElement result; if (elementTypesEnum != DlmBasicElement.ElementTypesEnum.Graphical) { if (elementTypesEnum != DlmBasicElement.ElementTypesEnum.Sound) { throw new Exception(string.Concat(new object[] { "Unknown element ID : ", type, " CellID : ", cell.Id })); } result = DlmSoundElement.ReadFromStream(cell, reader); } else { result = DlmGraphicalElement.ReadFromStream(cell, reader); } return(result); }
public new static DlmGraphicalElement ReadFromStream(DlmCell cell, BigEndianReader reader) { DlmGraphicalElement element = new DlmGraphicalElement(cell); element.m_elementId = reader.ReadUInt(); element.m_hue = new ColorMultiplicator((int)reader.ReadByte(), (int)reader.ReadByte(), (int)reader.ReadByte(), false); element.m_shadow = new ColorMultiplicator((int)reader.ReadByte(), (int)reader.ReadByte(), (int)reader.ReadByte(), false); if (cell.Layer.Map.Version <= 4) { element.m_offset.X = (int)reader.ReadByte(); element.m_offset.Y = (int)reader.ReadByte(); element.m_pixelOffset.X = (int)((float)element.m_offset.X * 43f); element.m_pixelOffset.Y = (int)((float)element.m_offset.Y * 21.5f); } else { element.m_pixelOffset.X = (int)reader.ReadShort(); element.m_pixelOffset.Y = (int)reader.ReadShort(); element.m_offset.X = (int)((float)element.m_pixelOffset.X / 43f); element.m_offset.Y = (int)((float)element.m_pixelOffset.Y / 21.5f); } element.m_altitude = (int)reader.ReadByte(); element.m_identifier = reader.ReadUInt(); element.CalculateFinalTeint(); return(element); }