Ejemplo n.º 1
0
        public Game ImportGameFromAGS272(string gameToLoad, bool useWizard)
        {
            string backupLocation = ConstructBackupDirectoryName(gameToLoad);
            Game game = null;
            bool continueWithImport = true;
            bool performBackup = false;

            if (useWizard)
            {
                ImportGameWizardPage importPage = new ImportGameWizardPage(backupLocation);
                List<WizardPage> pages = new List<WizardPage>();
                pages.Add(importPage);
                WizardDialog dialog = new WizardDialog("Import Old Game", "This wizard will guide you through importing a game from a previous version of AGS.", pages);
                DialogResult result = dialog.ShowDialog();
                continueWithImport = (result == DialogResult.OK);
                performBackup = importPage.BackupEnabled;
                dialog.Dispose();
            }

            if (continueWithImport)
            {
                if (performBackup)
                {
                    try
                    {
                        BusyDialog.Show("Please wait while your game files are backed up...", new BusyDialog.ProcessingHandler(MakeBackupCopyOfGameFolderThread), backupLocation);
                    }
                    catch (Exception ex)
                    {
                        if (Factory.GUIController.ShowQuestion("An error occured whilst backing up your game files.\n\nError: " + ex.Message + "\n\nDo you want to proceed and upgrade the game anyway?", MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return null;
                        }
                    }
                }
                ImportGameResult importResult = (ImportGameResult)BusyDialog.Show("Please wait while your game is imported...", new BusyDialog.ProcessingHandler(ImportOldGameThread), gameToLoad);
                game = importResult.LoadedGame;
                Factory.Events.OnImportedOldGame();

                Factory.GUIController.ShowOutputPanel(importResult.Errors);
                if (importResult.Errors.Count > 0)
                {
                    Factory.GUIController.ShowMessage("Some errors were encountered whilst importing the game. Check the output window for details.", MessageBoxIcon.Warning);
                }

            }
            return game;
        }
Ejemplo n.º 2
0
        public Game ImportGameFromAGS272(string gameToLoad, bool useWizard)
        {
            string backupLocation     = ConstructBackupDirectoryName(gameToLoad);
            Game   game               = null;
            bool   continueWithImport = true;
            bool   performBackup      = false;

            if (useWizard)
            {
                ImportGameWizardPage importPage = new ImportGameWizardPage(backupLocation);
                List <WizardPage>    pages      = new List <WizardPage>();
                pages.Add(importPage);
                WizardDialog dialog = new WizardDialog("Import Old Game", "This wizard will guide you through importing a game from a previous version of AGS.", pages);
                DialogResult result = dialog.ShowDialog();
                continueWithImport = (result == DialogResult.OK);
                performBackup      = importPage.BackupEnabled;
                dialog.Dispose();
            }

            if (continueWithImport)
            {
                if (performBackup)
                {
                    try
                    {
                        BusyDialog.Show("Please wait while your game files are backed up...", new BusyDialog.ProcessingHandler(MakeBackupCopyOfGameFolderThread), backupLocation);
                    }
                    catch (Exception ex)
                    {
                        if (Factory.GUIController.ShowQuestion("An error occured whilst backing up your game files.\n\nError: " + ex.Message + "\n\nDo you want to proceed and upgrade the game anyway?", MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return(null);
                        }
                    }
                }
                ImportGameResult importResult = (ImportGameResult)BusyDialog.Show("Please wait while your game is imported...", new BusyDialog.ProcessingHandler(ImportOldGameThread), gameToLoad);
                game = importResult.LoadedGame;
                Factory.Events.OnImportedOldGame();

                Factory.GUIController.ShowOutputPanel(importResult.Errors);
                if (importResult.Errors.Count > 0)
                {
                    Factory.GUIController.ShowMessage("Some errors were encountered whilst importing the game. Check the output window for details.", MessageBoxIcon.Warning);
                }
            }
            return(game);
        }
Ejemplo n.º 3
0
        public void ShowCreateVoiceActingScriptWizard()
        {
            List<WizardPage> pages = new List<WizardPage>();
            CreateVoiceActingScriptPage mainPage = new CreateVoiceActingScriptPage();
            mainPage.SelectedFilePath = Path.Combine(_agsEditor.CurrentGame.DirectoryPath, "VoiceSpeech.txt");
            pages.Add(mainPage);

            WizardDialog dialog = new WizardDialog("Voice Acting Script", "This wizard will guide you through creating a voice acting script. This script is a text file that you can supply to your voice actors containing a list of lines that they need to record.", pages);
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    _agsEditor.SaveGameFiles();
                    CompileMessages results = (CompileMessages)BusyDialog.Show("Please wait while your script is created...", new BusyDialog.ProcessingHandler(CreateVoiceActingScriptProcess), mainPage.SelectedFilePath);
                    Factory.GUIController.ShowOutputPanel(results);
                    if (results.HasErrors)
                    {
                        Factory.GUIController.ShowMessage("There were errors creating the voice acting script. See the output window for details.", MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Factory.GUIController.ShowMessage("Voice acting script created successfully.", MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    Factory.GUIController.ShowMessage("There was an error creating the voice acting script. The error was: " + ex.Message + Environment.NewLine + Environment.NewLine + "Error details: " + ex.ToString(), MessageBoxIcon.Warning);
                }
            }

            dialog.Dispose();
        }
Ejemplo n.º 4
0
        public void ShowCreateTemplateWizard()
        {
            if (_agsEditor.SourceControlProvider.ProjectUnderControl)
            {
                if (this.ShowQuestion("This game is under source control. It is not advisable to create a template that is bound to source control. Are you sure you want to continue?", MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }
            }

            List<WizardPage> pages = new List<WizardPage>();
            MakeTemplateWizardPage templateCreationPage = new MakeTemplateWizardPage(_agsEditor.TemplatesDirectory, ".agt");
            pages.Add(templateCreationPage);

            WizardDialog dialog = new WizardDialog("Create Template", "This wizard will guide you through the process of creating a template. A template allows other people to easily create a game that uses your game as a starting point.", pages);
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string templateName = templateCreationPage.GetFullPath();
                try
                {
                    _agsEditor.SaveGameFiles();
                    InteractiveTasks.CreateTemplateFromCurrentGame(templateName);
                    Factory.GUIController.ShowMessage("Template created successfully. To try it out, close AGS, start it up again, and select the 'Start New Game' option.", MessageBoxIcon.Information);
                }
                catch (AGSEditorException ex)
                {
                    Factory.GUIController.ShowMessage("There was an error creating your template:" + Environment.NewLine + ex.Message, MessageBoxIcon.Warning);
                }
                catch (Exception ex)
                {
                    Factory.GUIController.ShowMessage("There was an error creating your template. The error was: " + ex.Message + Environment.NewLine + Environment.NewLine + "Error details: " + ex.ToString(), MessageBoxIcon.Warning);
                }
            }

            dialog.Dispose();
        }
Ejemplo n.º 5
0
        public void ShowCreateRoomTemplateWizard(UnloadedRoom room)
        {
            List<WizardPage> pages = new List<WizardPage>();
            MakeTemplateWizardPage templateCreationPage = new MakeTemplateWizardPage(_agsEditor.TemplatesDirectory, ".art");
            pages.Add(templateCreationPage);

            WizardDialog dialog = new WizardDialog("Room Template", "This wizard will guide you through the process of creating a room template. A room template allows you to easily create new rooms based off an existing one.", pages);
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string templateFileName = templateCreationPage.GetFullPath();
                try
                {
                    if (File.Exists(templateFileName))
                    {
                        File.Delete(templateFileName);
                    }
                    BinaryWriter writer = new BinaryWriter(new FileStream(ROOM_TEMPLATE_ID_FILE, FileMode.Create, FileAccess.Write));
                    writer.Write(ROOM_TEMPLATE_ID_FILE_SIGNATURE);
                    writer.Write(room.Number);
                    writer.Close();

                    Factory.NativeProxy.CreateTemplateFile(templateFileName, ConstructRoomTemplateFileList(room));

                    File.Delete(ROOM_TEMPLATE_ID_FILE);

                    Factory.GUIController.ShowMessage("Template created successfully. To try it out, create a new room.", MessageBoxIcon.Information);
                }
                catch (AGSEditorException ex)
                {
                    Factory.GUIController.ShowMessage("There was an error creating your template: " + ex.Message, MessageBoxIcon.Warning);
                }
                catch (Exception ex)
                {
                    Factory.GUIController.ShowMessage("There was an error creating your template. The error was: " + ex.Message + Environment.NewLine + Environment.NewLine + "Error details: " + ex.ToString(), MessageBoxIcon.Warning);
                }
            }

            dialog.Dispose();
        }
Ejemplo n.º 6
0
        public void ShowAutoNumberSpeechWizard()
        {
            List<WizardPage> pages = new List<WizardPage>();
            AutoNumberSpeechWizardPage mainPage = new AutoNumberSpeechWizardPage();
            pages.Add(mainPage);
            AutoNumberSpeechWizardPage2 advancedOptions = new AutoNumberSpeechWizardPage2(_agsEditor.CurrentGame.RootCharacterFolder.AllItemsFlat);
            pages.Add(advancedOptions);

            WizardDialog dialog = new WizardDialog("Number Speech Lines", "This wizard will guide you through automatically numbering your game speech lines.\n\nThis process automatically assigns speech numbers to all displayable text in the game. It will modify your dialogs and scripts in order to assign a unique number to each line of text for each character.\n\nWARNING: It is STRONGLY RECOMMENDED that you back up your game before continuing, just in case anything goes wrong.\n\nWARNING: Running this process will overwrite any existing speech lines and re-number them all from scratch.", pages);
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                AutoNumberSpeechOptions options = AutoNumberSpeechOptions.None;
                if (mainPage.EnableNarrator) options |= AutoNumberSpeechOptions.DoNarrator;
                if (mainPage.CombineIdenticalLines) options |= AutoNumberSpeechOptions.CombineIdenticalLines;
                if (advancedOptions.RemoveNumbering) options |= AutoNumberSpeechOptions.RemoveNumbering;
                AutoNumberSpeechData data = new AutoNumberSpeechData();
                data.Options = options;
                data.CharacterID = advancedOptions.SelectedCharacterID;

                try
                {
                    _agsEditor.SaveGameFiles();
                    CompileMessages results = (CompileMessages)BusyDialog.Show("Please wait while your speech lines are numbered...", new BusyDialog.ProcessingHandler(AutoNumberSpeechLinesProcess), data);
                    Factory.GUIController.ShowOutputPanel(results);
                    Factory.Events.OnRefreshAllComponentsFromGame();
                    _agsEditor.SaveGameFiles();
                    Factory.GUIController.ShowMessage("Speech lines numbered successfully.", MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    Factory.GUIController.ShowMessage("There was an error numbering your speech lines. The error was: " + ex.Message + Environment.NewLine + Environment.NewLine + "Error details: " + ex.ToString(), MessageBoxIcon.Warning);
                }
            }

            dialog.Dispose();
        }
Ejemplo n.º 7
0
        private bool ShowNewGameWizard()
        {
            bool createdSuccessfully = false;
            List<GameTemplate> templates = new List<GameTemplate>();
            foreach (string fileName in Utilities.GetDirectoryFileList(_agsEditor.TemplatesDirectory, "*.agt"))
            {
                GameTemplate template = Factory.NativeProxy.LoadTemplateFile(fileName);
                if (template != null)
                {
                    templates.Add(template);
                }
            }

            List<WizardPage> pages = new List<WizardPage>();
            StartNewGameWizardPage templateSelectPage = new StartNewGameWizardPage(templates);
            StartNewGameWizardPage2 gameNameSelectPage = new StartNewGameWizardPage2(_agsEditor.Preferences.NewGamePath);
            pages.Add(templateSelectPage);
            pages.Add(gameNameSelectPage);

            WizardDialog dialog = new WizardDialog("Start New Game", "This wizard will guide you through the process of creating a new game.", pages);
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                createdSuccessfully = CreateNewGame(gameNameSelectPage.GetFullPath(), gameNameSelectPage.NewGameName, templateSelectPage.SelectedTemplate);
            }

            dialog.Dispose();
            return createdSuccessfully;
        }