Esempio n. 1
0
        internal ObjectPool(ContentReader reader)
            : this()
        {
            _manager = reader.ContentManager;

            int version = reader.ReadInt16();
            int id = reader.ReadInt16();

            Properties = new PropertyCollection(reader);

            int objCount = reader.ReadInt16();
            for (int i = 0; i < objCount; i++) {
                int objId = reader.ReadInt16();
                string name = reader.ReadString();

                ObjectClass objClass = new ObjectClass(this, objId, name);
                _objects.Add(objId, objClass);
            }
        }
Esempio n. 2
0
        internal ObjectPool(ContentReader reader)
            : this()
        {
            _manager = reader.ContentManager;

            //int version = reader.ReadInt16();
            int id = reader.ReadInt32();
            string texAsset = reader.ReadString();

            Properties = new PropertyCollection(reader);

            int objCount = reader.ReadInt32();
            for (int i = 0; i < objCount; i++) {
                int objId = reader.ReadInt32();
                string name = reader.ReadString();

                ObjectClass objClass = new ObjectClass(this, objId, name) {
                    Origin = new Point(reader.ReadInt32(), reader.ReadInt32()),
                    MaskBounds = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()),
                    TexRotated = reader.ReadBoolean(),
                    TexX = reader.ReadInt32(),
                    TexY = reader.ReadInt32(),
                    TexWidth = reader.ReadInt32(),
                    TexHeight = reader.ReadInt32(),
                    TexOriginalWidth = reader.ReadInt32(),
                    TexOriginalHeight = reader.ReadInt32(),
                    TexOffsetX = reader.ReadInt32(),
                    TexOffsetY = reader.ReadInt32(),
                    Properties = new PropertyCollection(reader),
                };

                _objects.Add(objId, objClass);
            }

            _texture = _manager.Load<Texture2D>(texAsset);
        }