private void topBarOpenRecent_Click(object sender, EventArgs e) { if (unsaved) { DialogResult result = MessageBox.Show("All unsaved changes will be lost, do you want to save them before creating a new project?", "New Project", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } else if (result == DialogResult.Yes) { if (ProjectManager.SaveFileExists) { switch (ProjectManager.SaveProject(ProjectManager.FilePath)) { case 1: MessageBox.Show("Specified directory does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; case 2: MessageBox.Show("An error has occurred during saving.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } unsaved = false; RefreshTitle(); } else { result = saveFileDialog.ShowDialog(); if (result == DialogResult.OK) { switch (ProjectManager.SaveProject(saveFileDialog.FileName)) { case 1: MessageBox.Show("Specified directory does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; case 2: MessageBox.Show("An error has occurred during saving.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } unsaved = false; RefreshTitle(); } } } } if (!ProjectManager.LastSaveFileExists) { MessageBox.Show("Most recent file not detected.", "Open Last", MessageBoxButtons.OK, MessageBoxIcon.Error); RefreshMostRecentAvailable(); return; } if (ProjectManager.LoadProject(ProjectManager.LastFilePath) == 1) { MessageBox.Show("An error has occurred while opening the file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dropdownTriggers.Items.Clear(); dropdownDialogues.Items.Clear(); sequence = 0; initializing = true; dropdownCharacters.SelectedIndex = 0; initializing = false; foreach (Area area in ProjectManager.Areas) { dropdownTriggers.Items.Add(area.Name); } if (dropdownTriggers.Items.Count > 0) { refreshing = true; dropdownTriggers.SelectedIndex = 0; refreshing = false; } unsaved = false; RefreshWindow(); } }
private void topBarCheckMissing_Click(object sender, EventArgs e) { string result = string.Empty; bool missing = false; int count = 0; void CheckMissing(Area area, Area.Character character) { foreach (var dialogue in character.SoloDialogue) { if (dialogue.Duration == 0) { missing = true; if (count < 20) { result += string.Format("{0} ({1}_solo)\n", character.Name, area.Name); } count++; break; } } for (int i = 0; i < area.TeamDialogues; i++) { foreach (var dialogue in character.TeamDialogues[i].Dialogues) { if (dialogue.Duration == 0) { missing = true; if (count < 20) { result += string.Format("{0} ({1}_team{2})\n", character.Name, area.Name, i); } count++; break; } } } } foreach (Area area in ProjectManager.Areas) { foreach (var character in area.CharacterDialogue) { var actor = ProjectManager.GetActorFromIndexedName(character.Name); if (actor.SkinIndex != 1 && actor.UseDefaultSkin) { continue; } CheckMissing(area, character); } } if (missing) { string limit = string.Empty; if (count > 20) { limit = "..."; } string plural = "s"; if (count == 1) { plural = string.Empty; } string message = string.Format("Found {0} sequence{1} with 0 duration dialogue:\n\n{2}{3}", count, plural, result, limit); MessageBox.Show(message, "Check 0 Duration", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("All dialogues have a duration.", "Check 0 Duration", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonOk_Click(object sender, EventArgs e) { ProjectManager.RegisterMaps(textBoxMaps.Text); Close(); }