Пример #1
0
        protected override void ReadDelta(BinaryReader reader, NetVersion version)
        {
            NetString name = new NetString();

            name.Read(reader, version);

            NetString iD = new NetString();

            iD.Read(reader, version);


            StardustCore.ModCore.ModMonitor.Log("Name: " + name);
            StardustCore.ModCore.ModMonitor.Log("Mod ID:" + iD);


            //Texture2D texture = new Texture2D(Game1.graphics.GraphicsDevice,width,height);
            if (String.IsNullOrEmpty(iD.Value) || String.IsNullOrEmpty(name.Value))
            {
                ModCore.ModMonitor.Log("FOR SOME REASON THE TEXTURE INFO IS NULL????");
                return;
            }


            Texture2DExtended texture = ModCore.TextureManagers[iD.Value].getTexture(name.Value);

            if (texture == null)
            {
                throw new Exception("FOR SOME REASON NULL IS BEING READ???");
            }
            this.Value = texture;
        }
        protected override void ReadDelta(BinaryReader reader, NetVersion version)
        {
            NetCoreObject obj = new NetCoreObject();

            obj.Read(reader, version);
            //Values already taken care of in NetCoreObject

            NetList <KeyValuePair <Vector2, MultiTileComponent>, NetKeyValuePair <Vector2, MultiTileComponent, NetVector2, NetMultiTileComponent> > netList = new NetList <KeyValuePair <Vector2, MultiTileComponent>, NetKeyValuePair <Vector2, MultiTileComponent, NetVector2, NetMultiTileComponent> >();

            netList.Read(reader, version);
            if (netList.ToList() == null)
            {
                throw new Exception("WTF WHY IS NETLIST NULL?!?!?!?!");
            }

            foreach (var v in netList.ToList())
            {
                StardustCore.ModCore.ModMonitor.Log(v.Value.name, StardewModdingAPI.LogLevel.Alert);
            }

            Value.objects = netList.ToList();
            //this.value.objects=netList.ToArray().ToList();



            NetColor col = new NetColor();

            col.Read(reader, version);
            Value.categoryColor = col.Value;

            NetString name = new NetString();

            name.Read(reader, version);
            Value.categoryName = name.Value;
        }
Пример #3
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;
            }
        }