Example #1
0
 private void _agsEditor_PreSaveGame(PreSaveGameEventArgs evArgs)
 {
     _componentController.NotifyAboutToSaveGame();
 }
Example #2
0
 private void _agsEditor_PreSaveGame(PreSaveGameEventArgs evArgs)
 {
     _componentController.NotifyAboutToSaveGame();
 }
Example #3
0
        public bool SaveGameFiles()
        {
            if (AttemptToSaveGame != null)
            {
                bool allowSave = true;
                AttemptToSaveGame(ref allowSave);
                if (!allowSave)
                {
                    return false;
                }
            }

            PreSaveGameEventArgs evArgs = new PreSaveGameEventArgs();
            if (PreSaveGame != null)
            {
                PreSaveGame(evArgs);
            }

            foreach (Script script in _game.Scripts)
            {
                if (script.Modified)
                {
                    if (AttemptToGetWriteAccess(script.FileName))
                    {
                        script.SaveToDisk();
                    }
                }
            }

            List<string> filesToCheck = new List<string>();
            filesToCheck.Add(USER_DATA_FILE_NAME);
            filesToCheck.Add(GAME_FILE_NAME);
            if (Factory.NativeProxy.AreSpritesModified)
            {
                filesToCheck.Add(SPRITE_FILE_NAME);
                filesToCheck.Add(SPRITE_INDEX_FILE_NAME);
            }

            if (!AttemptToGetWriteAccess(filesToCheck))
            {
                return false;
            }
            if (!IsEnoughSpaceFreeOnDisk(MINIMUM_BYTES_FREE_TO_SAVE))
            {
                Factory.GUIController.ShowMessage("The disk is full. Please clear some space then try again", MessageBoxIcon.Warning);
                return false;
            }

            // Make sure the game's name in the Recent list is updated, in
            // case the user has just changed it
            this.RecentGames.AddRecentGame(_game.DirectoryPath, _game.Settings.GameName);

            bool result = (bool)BusyDialog.Show("Please wait while your files are saved...", new BusyDialog.ProcessingHandler(SaveGameFilesProcess), null);

            if (!evArgs.SaveSucceeded)
            {
                result = false;
            }
            return result;
        }
Example #4
0
        public bool SaveGameFiles()
        {
            if (AttemptToSaveGame != null)
            {
                bool allowSave = true;
                AttemptToSaveGame(ref allowSave);
                if (!allowSave)
                {
                    return false;
                }
            }

            PreSaveGameEventArgs evArgs = new PreSaveGameEventArgs();
            if (PreSaveGame != null)
            {
                PreSaveGame(evArgs);
            }

            foreach (Script script in _game.RootScriptFolder.AllScriptsFlat)
            {
                if (script.Modified)
                {
                    if (AttemptToGetWriteAccess(script.FileName))
                    {
                        script.SaveToDisk();
                    }
                }
            }

            List<string> filesToCheck = new List<string>();
            filesToCheck.Add(USER_DATA_FILE_NAME);
            filesToCheck.Add(GAME_FILE_NAME);
            if (Factory.NativeProxy.AreSpritesModified)
            {
                filesToCheck.Add(SPRITE_FILE_NAME);
                filesToCheck.Add(SPRITE_INDEX_FILE_NAME);
            }

            if (!AttemptToGetWriteAccess(filesToCheck))
            {
                return false;
            }
            if (!IsEnoughSpaceFreeOnDisk(MINIMUM_BYTES_FREE_TO_SAVE))
            {
                Factory.GUIController.ShowMessage("Le disque est plein. Libérez de l'espace puis réessayez", MessageBoxIcon.Warning);
                return false;
            }

            // Make sure the game's name in the Recent list is updated, in
            // case the user has just changed it
            this.RecentGames.AddRecentGame(_game.DirectoryPath, _game.Settings.GameName);

            bool result = (bool)BusyDialog.Show("Patientez durant la sauvegarde de vos fichiers...", new BusyDialog.ProcessingHandler(SaveGameFilesProcess), null);

            if (!evArgs.SaveSucceeded)
            {
                result = false;
            }
            return result;
        }