Пример #1
0
        public new static DlmGraphicalElement ReadFromStream(DlmCell cell, IDataReader reader)
        {
            var element = new DlmGraphicalElement(cell);

            element.m_elementId = reader.ReadUInt();
            element.m_hue       = new ColorMultiplicator(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), false);
            element.m_shadow    = new ColorMultiplicator(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), false);

            if (cell.Layer.Map.Version <= 4)
            {
                element.m_offset.X      = reader.ReadByte();
                element.m_offset.Y      = reader.ReadByte();
                element.m_pixelOffset.X = (int)(element.m_offset.X * CELL_HALF_WIDTH);
                element.m_pixelOffset.Y = (int)(element.m_offset.Y * CELL_HALF_HEIGHT);
            }
            else
            {
                element.m_pixelOffset.X = reader.ReadShort();
                element.m_pixelOffset.Y = reader.ReadShort();
                element.m_offset.X      = (int)(element.m_pixelOffset.X / CELL_HALF_WIDTH);
                element.m_offset.Y      = (int)(element.m_pixelOffset.Y / CELL_HALF_HEIGHT);
            }

            element.m_altitude   = reader.ReadByte();
            element.m_identifier = reader.ReadUInt();

            // we don't care
            //element.CalculateFinalTeint();

            return(element);
        }
Пример #2
0
        public new static DlmSoundElement ReadFromStream(DlmCell cell, IDataReader reader)
        {
            var element = new DlmSoundElement(cell);

            element.m_soundId              = reader.ReadInt();
            element.m_baseVolume           = reader.ReadShort();
            element.m_fullVolumedistance   = reader.ReadInt();
            element.m_nullVolumedistance   = reader.ReadInt();
            element.m_minDelayBetweenloops = reader.ReadShort();
            element.m_maxDelayBetweenloops = reader.ReadShort();

            return(element);
        }
Пример #3
0
        public static DlmLayer ReadFromStream(DlmMap map, IDataReader reader)
        {
            var layer = new DlmLayer(map);

            layer.LayerId = map.Version >= 9 ? reader.ReadByte() : reader.ReadInt();
            layer.Cells   = new DlmCell[reader.ReadShort()];
            for (int i = 0; i < layer.Cells.Length; i++)
            {
                layer.Cells[i] = DlmCell.ReadFromStream(layer, reader);
            }

            return(layer);
        }
Пример #4
0
        public static DlmCell ReadFromStream(DlmLayer layer, IDataReader reader)
        {
            var cell = new DlmCell(layer);

            cell.Id       = reader.ReadShort();
            cell.Elements = new DlmBasicElement[reader.ReadShort()];

            for (int i = 0; i < cell.Elements.Length; i++)
            {
                DlmBasicElement element =
                    DlmBasicElement.ReadFromStream(cell, reader);
                cell.Elements[i] = element;
            }

            return(cell);
        }
Пример #5
0
        public static DlmBasicElement ReadFromStream(DlmCell cell, IDataReader reader)
        {
            var type = reader.ReadByte();

            switch ((ElementTypesEnum)type)
            {
            case ElementTypesEnum.Graphical:
                return(DlmGraphicalElement.ReadFromStream(cell, reader));

            case ElementTypesEnum.Sound:
                return(DlmSoundElement.ReadFromStream(cell, reader));

            default:
                throw new Exception("Unknown element ID : " + type + " CellID : " + cell.Id);
            }
        }
Пример #6
0
 public DlmSoundElement(DlmCell cell)
     : base(cell)
 {
 }
Пример #7
0
 public DlmGraphicalElement(DlmCell cell)
     : base(cell)
 {
 }
Пример #8
0
 protected DlmBasicElement(DlmCell cell)
 {
     Cell = cell;
 }