예제 #1
0
        internal OgmoObjectTemplate(ContentReader reader)
        {
            this.Height       = reader.ReadInt32();
            this.IsResizableX = reader.ReadBoolean();
            this.IsResizableX = reader.ReadBoolean();
            this.IsTiled      = reader.ReadBoolean();
            this.Name         = reader.ReadString();
            this.Origin       = reader.ReadVector2();
            Rectangle source = Rectangle.Empty;

            source.X         = reader.ReadInt32();
            source.Y         = reader.ReadInt32();
            source.Width     = reader.ReadInt32();
            source.Height    = reader.ReadInt32();
            this.Source      = source;
            this.Texture     = reader.ReadExternalReference <Texture2D>();
            this.TextureFile = reader.ReadString();
            this.Width       = reader.ReadInt32();
            // Values
            int valueCount = reader.ReadInt32();

            if (valueCount > 0)
            {
                for (int i = 0; i < valueCount; i++)
                {
                    OgmoValueTemplate value = OgmoValueTemplateReader.Read(reader);
                    if (value != null)
                    {
                        values.Add(value.Name, value);
                    }
                }
            }
        }
예제 #2
0
        internal OgmoProject(ContentReader reader)
        {
            // Name
            this.Name = reader.ReadString();
            // Settings
            this.Settings = new OgmoProjectSettings(reader);
            // Values
            int valueCount = reader.ReadInt32();

            if (valueCount > 0)
            {
                for (int i = 0; i < valueCount; i++)
                {
                    OgmoValueTemplate ogmoValue = OgmoValueTemplateReader.Read(reader);
                    if (ogmoValue != null)
                    {
                        values.Add(ogmoValue.Name, ogmoValue);
                    }
                }
            }
            // Tilesets
            int tilesetCount = reader.ReadInt32();

            if (tilesetCount > 0)
            {
                for (int i = 0; i < tilesetCount; i++)
                {
                    OgmoTileset tileset = new OgmoTileset(reader);
                    if (tileset != null)
                    {
                        tilesets.Add(tileset.Name, tileset);
                    }
                }
            }
            // Objects
            int objectCount = reader.ReadInt32();

            if (objectCount > 0)
            {
                for (int i = 0; i < objectCount; i++)
                {
                    OgmoObjectTemplate obj = new OgmoObjectTemplate(reader);
                    if (obj != null)
                    {
                        objects.Add(obj.Name, obj);
                    }
                }
            }
            // Layer Settings
            int layerSettingsCount = reader.ReadInt32();

            if (layerSettingsCount > 0)
            {
                for (int i = 0; i < layerSettingsCount; i++)
                {
                    OgmoLayerSettings layerSettings = OgmoLayerSettingsReader.Read(reader);
                    if (layerSettings != null)
                    {
                        this.layerSettings.Add(layerSettings.Name, layerSettings);
                    }
                }
            }
        }