示例#1
0
        public static bool LoadProject(string name)
        {
            if (!ProjectManager.Load(name))
            {
                return(false);
            }
            ProjectName    = ProjectManager.CurrentProject.Name;
            RootDirectory  = name.Substring(0, name.LastIndexOf(Path.DirectorySeparatorChar));;
            LevelDirectory = string.Format("{0}{1}{2}", RootDirectory, Path.DirectorySeparatorChar, "Levels");
            WorldDirectory = string.Format("{0}{1}{2}", RootDirectory, Path.DirectorySeparatorChar, "Worlds");

            // load from file
            if (!SpriteManager.LoadSpritesFromFile(string.Format("{0}{1}sprites.xml", RootDirectory, Path.DirectorySeparatorChar)))
            {
                SpriteManager.LoadDefaultSprites();
            }

            if (!BlockManager.LoadDefinitions(string.Format("{0}{1}{2}.tsa", RootDirectory, Path.DirectorySeparatorChar, ProjectName)))
            {
                BlockManager.LoadDefault();
            }

            BlockManager.LoadBlockStrings(string.Format("{0}{1}strings.xml", RootDirectory, Path.DirectorySeparatorChar));

            if (!GraphicsManager.LoadGraphics(string.Format("{0}{1}{2}.chr", RootDirectory, Path.DirectorySeparatorChar, ProjectName)))
            {
                GraphicsManager.LoadDefault();
            }

            if (!SpecialManager.LoadSpecialGraphics(string.Format("{0}{1}special.chr", RootDirectory, Path.DirectorySeparatorChar)))
            {
                SpecialManager.LoadDefaultSpecialGraphics();
            }

            if (!SpecialManager.LoadSpecialDefinitions(string.Format("{0}{1}special.xml", RootDirectory, Path.DirectorySeparatorChar)))
            {
                SpecialManager.LoadDefaultSpecials();
            }

            if (!MusicManager.LoadMusic(string.Format("{0}{1}music.xml", RootDirectory, Path.DirectorySeparatorChar)))
            {
                MusicManager.LoadDefault();
            }

            return(true);
        }
示例#2
0
 static ProjectController()
 {
     SpriteManager = new SpriteManager();
     BlockManager = new BlockManager();
     GraphicsManager = new GraphicsManager();
     ProjectManager = new ProjectManager();
     LevelManager = new LevelManager();
     WorldManager = new WorldManager();
     ColorManager = new ColorManager();
     PaletteManager = new PaletteManager();
     SpecialManager = new SpecialManager();
     LayoutManager = new LayoutManager();
     MusicManager = new MusicManager();
     ReubenDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Reuben";
     if (!Directory.Exists(ReubenDirectory))
     {
         Directory.CreateDirectory(ReubenDirectory);
     }
 }
示例#3
0
 static ProjectController()
 {
     SpriteManager   = new SpriteManager();
     BlockManager    = new BlockManager();
     GraphicsManager = new GraphicsManager();
     ProjectManager  = new ProjectManager();
     LevelManager    = new LevelManager();
     WorldManager    = new WorldManager();
     ColorManager    = new ColorManager();
     PaletteManager  = new PaletteManager();
     SpecialManager  = new SpecialManager();
     LayoutManager   = new LayoutManager();
     MusicManager    = new MusicManager();
     ReubenDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Reuben";
     if (!Directory.Exists(ReubenDirectory))
     {
         Directory.CreateDirectory(ReubenDirectory);
     }
 }
示例#4
0
        public static bool CreateNewProject(string filename, string name)
        {
            RootDirectory = filename.Substring(0, filename.LastIndexOf(Path.DirectorySeparatorChar));
            if (!Directory.Exists(RootDirectory))
            {
                Directory.CreateDirectory(RootDirectory);
            }
            LevelDirectory = string.Format("{0}{1}Levels", RootDirectory, Path.DirectorySeparatorChar);
            WorldDirectory = string.Format("{0}{1}Worlds", RootDirectory, Path.DirectorySeparatorChar);
            Directory.CreateDirectory(LevelDirectory);
            Directory.CreateDirectory(WorldDirectory);
            ProjectName = name;

            // Load defaults
            SpriteManager.LoadDefaultSprites();
            SpriteManager.Save(string.Format("{0}{1}sprites.xml", RootDirectory, Path.DirectorySeparatorChar));

            BlockManager.LoadDefault();
            BlockManager.SaveDefinitions(string.Format("{0}{1}{2}.tsa", RootDirectory, Path.DirectorySeparatorChar, ProjectName));
            BlockManager.SaveBlockStrings(string.Format("{0}{1}strings.xml", RootDirectory, Path.DirectorySeparatorChar, ProjectName));


            GraphicsManager.LoadDefault();
            GraphicsManager.SaveGraphics(string.Format("{0}{1}{2}.chr", RootDirectory, Path.DirectorySeparatorChar, ProjectName));

            LevelManager.Default();
            WorldManager.Default();
            ColorManager.LoadDefaultColor();
            MusicManager.LoadDefault();

            PaletteManager.Default();

            SpecialManager.LoadDefaultSpecialGraphics();
            SpecialManager.LoadDefaultSpecials();
            SpecialManager.SaveGraphics(string.Format("{0}{1}special.chr", RootDirectory, Path.DirectorySeparatorChar));
            SpecialManager.SaveSpecials(string.Format("{0}{1}special.xml", RootDirectory, Path.DirectorySeparatorChar));

            LayoutManager.LoadDefault();
            ProjectManager.New(name);
            ProjectManager.Save(string.Format("{0}{1}{2}.rbn", RootDirectory, Path.DirectorySeparatorChar, ProjectName));
            return(true);
        }
示例#5
0
 public static void CheckGraphicsChanges()
 {
     GraphicsManager.CheckGraphicsFileChange(string.Format("{0}{1}{2}.chr", RootDirectory, Path.DirectorySeparatorChar, ProjectName));
 }