Exemplo n.º 1
0
        void SaveThread(string filename)
        {
            DirectoryInfo worldDirectory = Directory.CreateDirectory(DwarfGame.GetGameDirectory() + Path.DirectorySeparatorChar + "Worlds" + Path.DirectorySeparatorChar + Overworld.Name);

            OverworldFile file = new OverworldFile(Overworld.Map, Overworld.Name);
            file.WriteFile(worldDirectory.FullName + Path.DirectorySeparatorChar + "world." + OverworldFile.CompressedExtension, true);
            file.SaveScreenshot(worldDirectory.FullName + Path.DirectorySeparatorChar + "screenshot.png");

            gameFile = new GameFile(Overworld.Name, GameID);
            gameFile.WriteFile(DwarfGame.GetGameDirectory() + Path.DirectorySeparatorChar + "Saves" + Path.DirectorySeparatorChar + filename, true);

            lock (ScreenshotLock)
            {
                Screenshots.Add(new Screenshot()
                {
                    FileName = DwarfGame.GetGameDirectory() + Path.DirectorySeparatorChar + "Saves" +
                               Path.DirectorySeparatorChar + filename + Path.DirectorySeparatorChar + "screenshot.png",
                    Resolution = new Point(GraphicsDevice.Viewport.Width/4, GraphicsDevice.Viewport.Height/4)
                });
            }
        }