Exemple #1
0
 public GMXFile()
 {
     Sprites      = new SpriteCollection();
     Sound        = new SoundCollection();
     Backgrounds  = new BackgroundCollection();
     Paths        = new PathCollection();
     Scripts      = new ScriptCollection();
     Fonts        = new FontCollection();
     TimeLines    = new TimeLineCollection();
     Objects      = new ObjectCollection();
     Rooms        = new RoomCollection();
     Includes     = new IncludedFileCollection();
     Configs      = new ConfigCollection();
     ResourceTree = new ResourceTree();
 }
 public GameMakerFile()
 {
     Sprites      = new SpriteCollection();
     Sounds       = new SoundCollection();
     Backgrounds  = new BackgroundCollection();
     Paths        = new PathCollection();
     Scripts      = new ScriptCollection();
     Fonts        = new FontCollection();
     TimeLines    = new TimeLineCollection();
     Objects      = new ObjectCollection();
     Rooms        = new RoomCollection();
     Triggers     = new TriggerCollection();
     Includes     = new IncludedFileCollection();
     Constants    = new ConstantCollection();
     Information  = new GameInformation();
     Settings     = new GameSettings();
     ResourceTree = new ResourceTree();
 }
 public GameMakerFile()
 {
     Sprites = new SpriteCollection();
       Sounds = new SoundCollection();
       Backgrounds = new BackgroundCollection();
       Paths = new PathCollection();
       Scripts = new ScriptCollection();
       Fonts = new FontCollection();
       TimeLines = new TimeLineCollection();
       Objects = new ObjectCollection();
       Rooms = new RoomCollection();
       Triggers = new TriggerCollection();
       Includes = new IncludedFileCollection();
       Constants = new ConstantCollection();
       Information = new GameInformation();
       Settings = new GameSettings();
       ResourceTree = new ResourceTree();
 }
Exemple #4
0
        protected override void ProcessResource(BackgroundCollection aBackgrounds)
        {
            var files = GetXmlFiles(Directories.Backgrounds);

            if (files.Any())
            {
                OnCategoryProcessing(ResourceTypes.Backgrounds);
                var previous = SetCurrentDirectory(Directories.Backgrounds);

                foreach (var file in files)
                {
                    var document = LoadXml(file);

                    if (document != null)
                    {
                        var background = new Background();

                        background.ID                       = GetElementValue <int>(document, "ID");
                        background.Name                     = GetElement(document, "Name").Value;
                        background.IsTileSet                = GetElementValue <bool>(document, "IsTileSet");
                        background.TileWidth                = GetElementValue <int>(document, "TileWidth");
                        background.TileHeight               = GetElementValue <int>(document, "TileHeight");
                        background.TileHorizontalOffset     = GetElementValue <int>(document, "TileHorizontalOffset");
                        background.TileVerticalOffset       = GetElementValue <int>(document, "TileVerticalOffset");
                        background.TileHorizontalSeperation = GetElementValue <int>(document, "TileHorizontalSeperation");
                        background.TileVerticalSeperation   = GetElementValue <int>(document, "TileVerticalSeperation");

                        LoadImage(GetElement(document, "BitmapPath").Value,
                                  out background.Bitmap, out background.Width, out background.Height); // ?

                        aBackgrounds.Add(background);
                    }

                    OnAbortProcessingCallback();
                }

                OnCategoryProcessed(ResourceTypes.Backgrounds);
                SetCurrentDirectory(previous);
            }
        }
 protected abstract void ProcessResource( BackgroundCollection aBackgrounds );
 protected abstract void ProcessResource(BackgroundCollection aBackgrounds);
        protected override void ProcessResource( BackgroundCollection aBackgrounds )
        {
            if ( !aBackgrounds.Any() )
            return;

              OnCategoryProcessing( ResourceTypes.Backgrounds );
              Directory.CreateDirectory( IO.Path.Combine( Directories.Backgrounds, Directories.Images ) );
              var previous = SetCurrentDirectory( Directories.Backgrounds );

              foreach ( var background in aBackgrounds ) {
            var fileName = SafeResourceFilename( background );
            string pathImage = null;

            if ( background.Bitmap != null ) {
              pathImage = IO.Path.Combine( Directories.Images, AddImageExtension( fileName ) );
              SaveImage( pathImage, background.Bitmap, background.Width, background.Height );
            }

            var document =
              new XElement( "Background",
            CreateIndexedResourceNodes( background ),
            new XElement( "BitmapPath", pathImage ),
            new XElement( "IsTileSet", background.IsTileSet ),
            new XElement( "TileWidth", background.TileWidth ),
            new XElement( "TileHeight", background.TileHeight ),
            new XElement( "TileHorizontalOffset", background.TileHorizontalOffset ),
            new XElement( "TileVerticalOffset", background.TileVerticalOffset ),
            new XElement( "TileHorizontalSeperation", background.TileHorizontalSeperation ),
            new XElement( "TileVerticalSeperation", background.TileVerticalSeperation )
              );

            OnResourceProcessed( background.Name );
            SaveDocument( document, fileName + ".xml" );
              }

              OnCategoryProcessed( ResourceTypes.Backgrounds );
              SetCurrentDirectory( previous );
        }