Exemplo n.º 1
0
        protected override void ReadDelta(BinaryReader reader, NetVersion version)
        {
            sourceRect = new NetRectangle();
            if (sourceRect == null)
            {
                throw new Exception("WTF??? Why is netfield null");
            }
            if (reader == null)
            {
                throw new Exception("reader null");
            }
            if (value == null)
            {
                this.Set(new Animation());
            }
            sourceRect.Read(reader, version);
            Value.sourceRectangle = sourceRect.Value;

            frameDuration = new NetInt();
            frameDuration.Read(reader, version);
            Value.frameDuration = frameDuration.Value;

            frameDurationUntilNextAnimation = new NetInt();
            frameDurationUntilNextAnimation.Read(reader, version);
            Value.frameCountUntilNextAnimation = frameDurationUntilNextAnimation.Value;
        }
Exemplo n.º 2
0
        protected override void ReadDelta(BinaryReader reader, NetVersion version)
        {
            texture = new NetTexture2DExtended();
            texture.Read(reader, version);

            Value.setExtendedTexture(texture.Value);

            which = new NetInt();
            which.Read(reader, version);
            Value.ParentSheetIndex = which.Value;

            tilePos = new NetVector2();
            tilePos.Read(reader, version);
            Value.TileLocation = tilePos.Value;

            InventoryMaxSize = new NetInt();
            InventoryMaxSize.Read(reader, version);
            Value.inventoryMaxSize = InventoryMaxSize.Value;

            sourceRect = new NetRectangle();
            sourceRect.Read(reader, version);
            Value.sourceRect = sourceRect.Value;

            boundingBox = new NetRectangle();
            boundingBox.Read(reader, version);
            Value.boundingBox.Value = boundingBox.Value;

            drawPosition = new NetVector2();
            drawPosition.Read(reader, version);
            Value.drawPosition = drawPosition.Value;

            locationName = new NetString();
            locationName.Read(reader, version);
            Value.locationsName = locationName.Value;
            Value.thisLocation  = Game1.getLocationFromName(locationName.Value);

            /*
             * animationManager = new NetAnimationManager();
             * animationManager.Read(reader, version);
             * Value.animationManager = animationManager.Value;
             */
        }
        protected override void ReadDelta(BinaryReader reader, NetVersion version)
        {
            //Checks to see if the current animation is nothing, aka null.
            NetBool isNull = new NetBool();

            isNull.Read(reader, version);
            bool valueIsNull = isNull.Value;

            if (isNull)
            {
                NetTexture2DExtended nullTexture = new NetTexture2DExtended();
                nullTexture.Read(reader, version);

                NetAnimation nullAnimation = new NetAnimation();
                nullAnimation.Read(reader, version);

                Value.setExtendedTexture(nullTexture.Value);
                Value.defaultDrawFrame = nullAnimation.Value;
                return;
            }


            NetString currentAnimationName = new NetString();

            currentAnimationName.Read(reader, version);

            NetInt currentIndex = new NetInt();

            currentIndex.Read(reader, version);

            NetTexture2DExtended text = new NetTexture2DExtended();

            text.Read(reader, version);

            NetAnimation defaultAnimation = new NetAnimation();

            defaultAnimation.Read(reader, version);

            NetBool enabled = new NetBool();

            enabled.Read(reader, version);

            NetString data = new NetString();

            data.Read(reader, version);

            Value.setExtendedTexture(text.Value);
            Value.defaultDrawFrame = defaultAnimation.Value;
            Value.enabled          = enabled.Value;
            //Try and prevent unnecessary parsing.
            if (Value.animations == null && !String.IsNullOrEmpty(Value.animationDataString))
            {
                Value.animations = Animations.AnimationManager.parseAnimationsFromXNB(data.Value);
            }
            if (!String.IsNullOrEmpty(data.Value))
            {
                Value.setAnimation(currentAnimationName.Value, currentIndex.Value);
            }
            else
            {
                Value.currentAnimation = defaultDrawFrame.Value;
            }
        }