/// <summary>
        /// Save the current game with the provided name.
        /// </summary>
        public void SaveGame()
        {
            // Do nothing if the input field is empty.
            string baseFileName = this.inputField.text.RemoveEnd(".tscgame");

            if (IsInvalidBaseFileName(baseFileName))
            {
                return;
            }

            // Otherwise, create a Path object from the provided text content and check it for validity. If the file
            // path provided is illegal, then simply return.
            // TODO_LATER Add a message about illegal file name.
            PathInst targetPath = SaveGameManager.InitializeSaveFilePathFromFileName($"{baseFileName}.tscgame");
            string   path       = targetPath.ToString();

            if (!LocalFileUtils.ValidateDllPath(ref path))
            {
                return;
            }

            // Save the game at the desired path.
            SaveGameManager.SaveGame(SaveFile.CreateSaveFile(this.gameSceneManager.gameState), targetPath);

            // Clear out the text input, and reload the saved games.
            this.inputField.text = "";
            this.LoadSavedGames();
        }
示例#2
0
 private void createSaveFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SaveFile.CreateSaveFile();
 }