public static EntityGraphicalElementData ReadFromStream(EleInstance instance, int id, BigEndianReader reader)
        {
            var data = new EntityGraphicalElementData(instance, id);

            data.EntityLook         = reader.ReadUTF7BitLength();
            data.HorizontalSymmetry = reader.ReadBoolean();

            if (instance.Version >= 7)
            {
                data.PlayAnimation = reader.ReadBoolean();
            }

            if (instance.Version >= 6)
            {
                data.PlayAnimStatic = reader.ReadBoolean();
            }

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

            return(data);
        }
Ejemplo n.º 2
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);
            }
        }