示例#1
0
        public static EleGraphicalData ReadFromStream(EleInstance instance, BigEndianReader reader)
        {
            var id   = reader.ReadInt();
            var type = (EleGraphicalElementTypes)reader.ReadByte();

            switch (type)
            {
            case EleGraphicalElementTypes.ANIMATED:
                return(AnimatedGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.BLENDED:
                return(BlendedGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.BOUNDING_BOX:
                return(BoundingBoxGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.NORMAL:
                return(NormalGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.ENTITY:
                return(EntityGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.PARTICLES:
                return(ParticlesGraphicalElementData.ReadFromStream(instance, id, reader));

            default:
                throw new Exception("Unknown graphical data of type " + type);
            }
        }
        public static new AnimatedGraphicalElementData ReadFromStream(EleInstance instance, int id, BigEndianReader reader)
        {
            var data = new AnimatedGraphicalElementData(instance, id);

            data.Gfx                = reader.ReadInt();
            data.Height             = reader.ReadByte();
            data.HorizontalSymmetry = reader.ReadBoolean();
            data.Origin             = new System.Drawing.Point(reader.ReadShort(), reader.ReadShort());
            data.Size               = new System.Drawing.Point(reader.ReadShort(), reader.ReadShort());

            if (instance.Version == 4)
            {
                data.MinDelay = reader.ReadInt();
                data.MaxDelay = reader.ReadInt();
            }

            return(data);
        }