예제 #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            var preview = new SavePreviewGenerator(this.gameController);

            if (this.selectedGame.Data == null)
            {
                this.saveController.NewSave(this.selectedGame.GameName, preview.Make());
            }
            else
            {
                this.saveController.OverwriteSave(this.selectedGame.Data, this.selectedGame.GameName, preview.Make());
            }

            this.Result       = MainMenuResult.SaveGame;
            this.DialogResult = DialogResult.OK;
        }
예제 #2
0
        public static void Autosave(GameController gameController)
        {
            var saveController = new SavesController(gameController, SettingsWinforms.Get.FileStorageRootPath);
            var preview        = new SavePreviewGenerator(gameController);
            var title          = LocalizationManifest.Get.CurrentLanguage[FormSaveLoad.LanguageContext]["Autosave"].Text();

            var lastAutosave = saveController.Games.FirstOrDefault(x => SavePreviewGenerator.IsAutosave(x.PreviewData));

            if (lastAutosave == null)
            {
                saveController.NewSave(title, preview.MakeAutosave());
            }
            else
            {
                saveController.OverwriteSave(lastAutosave, title, preview.MakeAutosave());
            }
        }