コード例 #1
0
 private void saveButton_OnClicked()
 {
     if (GenerationComplete)
     {
         System.IO.DirectoryInfo worldDirectory = System.IO.Directory.CreateDirectory(DwarfGame.GetGameDirectory() + ProgramData.DirChar + "Worlds" + ProgramData.DirChar + Settings.Name);
         OverworldFile           file           = new OverworldFile(Overworld.Map, Settings.Name);
         file.WriteFile(worldDirectory.FullName + ProgramData.DirChar + "world." + OverworldFile.CompressedExtension, true);
         file.SaveScreenshot(worldDirectory.FullName + ProgramData.DirChar + "screenshot.png");
         Dialog.Popup(GUI, "Save", "File saved.", Dialog.ButtonType.OK);
     }
 }
コード例 #2
0
ファイル: PlayState.cs プロジェクト: chrisapril/dwarfcorp
        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)
                });
            }
        }
コード例 #3
0
 private void saveButton_OnClicked()
 {
     if(GenerationComplete)
     {
         System.IO.DirectoryInfo worldDirectory = System.IO.Directory.CreateDirectory(DwarfGame.GetGameDirectory() + ProgramData.DirChar + "Worlds" + ProgramData.DirChar + Settings.Name);
         OverworldFile file = new OverworldFile(Overworld.Map, Settings.Name);
         file.WriteFile(worldDirectory.FullName + ProgramData.DirChar + "world." + OverworldFile.CompressedExtension, true);
         file.SaveScreenshot(worldDirectory.FullName + ProgramData.DirChar + "screenshot.png");
         Dialog.Popup(GUI, "Save", "File saved.", Dialog.ButtonType.OK);
     }
 }