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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public new static DlmSoundElement ReadFromStream(DlmCell cell, BigEndianReader reader)
 {
     return(new DlmSoundElement(cell)
     {
         m_soundId = reader.ReadInt(),
         m_baseVolume = (int)reader.ReadShort(),
         m_fullVolumedistance = reader.ReadInt(),
         m_nullVolumedistance = reader.ReadInt(),
         m_minDelayBetweenloops = (int)reader.ReadShort(),
         m_maxDelayBetweenloops = (int)reader.ReadShort()
     });
 }
Exemplo n.º 4
0
        public static DlmCell ReadFromStream(DlmLayer layer, BigEndianReader reader)
        {
            DlmCell cell = new DlmCell(layer);

            cell.Id       = reader.ReadShort();
            cell.Elements = new DlmBasicElement[(int)reader.ReadShort()];
            for (int i = 0; i < cell.Elements.Length; i++)
            {
                DlmBasicElement element = DlmBasicElement.ReadFromStream(cell, reader);
                cell.Elements[i] = element;
            }
            return(cell);
        }
Exemplo n.º 5
0
        public static DlmLayer ReadFromStream(DlmMap map, BigEndianReader reader)
        {
            DlmLayer layer = new DlmLayer(map);

            if (map.Version >= 9)
            {
                layer.LayerId = reader.ReadByte();
            }
            else
            {
                layer.LayerId = reader.ReadInt();
            }

            layer.Cells = new DlmCell[(int)reader.ReadShort()];
            for (int i = 0; i < layer.Cells.Length; i++)
            {
                layer.Cells[i] = DlmCell.ReadFromStream(layer, reader);
            }
            return(layer);
        }
Exemplo n.º 6
0
 protected DlmBasicElement(DlmCell cell)
 {
     this.Cell = cell;
 }
 public DlmGraphicalElement(DlmCell cell)
     : base(cell)
 {
 }
Exemplo n.º 8
0
 public DlmSoundElement(DlmCell cell)
     : base(cell)
 {
 }