private void btnSave_Click(object sender, EventArgs e) { Dirty = false; MapData data = new MapData(); // Tilemap string result = ""; for (int i = 0; i < Tiles.GetLength(0); i++) { for (int j = 0; j < Tiles.GetLength(1); j++) { result += Tiles[i, j].TileID + "|"; } result = result.Substring(0, result.Length - 1); result += ";"; } result = result.Substring(0, result.Length - 1); data.Tiles = result; // Everything else data.Units = Units; data.MapEvents = melMapEvents.Datas; data.Tileset = cmbTileSets.Text; data.LevelNumber = (int)nudLevelNumber.Value; data.Objective = ObjectiveToString(); data.Name = txtLevelName.Text; CurrentDirectory.SaveFile(txtLevelName.Text, data.ToJson()); flbFiles.UpdateList(); VoiceAssist.Say("Save"); }
private void cmbVoice_SelectedIndexChanged(object sender, EventArgs e) { string selectedVoice = cmbVoice.SelectedItem.ToString() == "None" ? "" : cmbVoice.SelectedItem.ToString(); VoiceAssist.SelectVoice(selectedVoice); VoiceAssist.Say("Ready"); }
private void frmMenu_Load(object sender, EventArgs e) { // Init stuff dlgFolder.IsFolderPicker = true; dlgDataImport.Filter = "Frog Forge editor data files|*.ffed"; dlgDataExport.Filter = "Frog Forge editor data files|*.ffed"; dlgProjectImport.Filter = "Frog Forge project data files|*.ffpd"; dlgProjectExport.Filter = "Frog Forge project data files|*.ffpd"; GamePath = DataDirectory.LoadFile("GamePath", ""); string workingPath = DataDirectory.LoadFile("Path", ""); if (workingPath == "") { if (WorkingDirectory.DirectoryExists(@"\Game\Data")) { GamePath = WorkingDirectory.Path + @"\Game\"; DataDirectory.SaveFile("GamePath", GamePath); WorkingDirectory.Path += @"\Game\Data"; DataDirectory.SaveFile("Path", WorkingDirectory.Path); } else { if (ExtensionMethods.ConfirmDialog("Game directory not found. Locate manually?", "Missing game files")) { btnChangePath_Click(sender, e); } else { Close(); return; } } } else { WorkingDirectory.Path = workingPath; } if (GamePath == "") { btnPlay.Visible = false; Height -= 30; } // Load prefences string json = DataDirectory.LoadFile("Preferences", "", ".json"); Preferences.Current = ((json == "" ? null : json)?.JsonToObject <Preferences>()) ?? new Preferences(); // Apply them this.ApplyPreferences(); CenterToScreen(); lblVersion.Font = lblCredits.Font = new Font(lblCredits.Font.FontFamily, (int)Math.Round(lblCredits.Font.Size * Preferences.Current.ZoomAmount)); lblTitle.Font = new Font(lblTitle.Font.FontFamily, (int)Math.Round(lblTitle.Font.Size * Preferences.Current.ZoomAmount)); // Joke (voice assist) if (Preferences.Current.VoiceAssistAvailable) { VoiceAssist.SelectVoice(Preferences.Current.VoiceAssist ?? ""); VoiceAssist.Say("Ready"); } }
private void btnCGEditor_Click(object sender, EventArgs e) { frmCGEditor cgEditor = new frmCGEditor(); cgEditor.DataDirectory = DataDirectory; cgEditor.WorkingDirectory = WorkingDirectory; VoiceAssist.Say("New"); cgEditor.ShowDialog(this); }
private void btnTilemapEditor_Click(object sender, EventArgs e) { frmTilesetEditor tilemapEditor = new frmTilesetEditor(); tilemapEditor.DataDirectory = DataDirectory; tilemapEditor.WorkingDirectory = WorkingDirectory; VoiceAssist.Say("New"); tilemapEditor.ShowDialog(this); }
private void btnLevelMetadataEditor_Click(object sender, EventArgs e) { frmLevelMetadataEditor levelMetadataEditor = new frmLevelMetadataEditor(); levelMetadataEditor.DataDirectory = DataDirectory; levelMetadataEditor.WorkingDirectory = WorkingDirectory; VoiceAssist.Say("New"); levelMetadataEditor.ShowDialog(this); }
public void New() { if (BaseEditor.HasUnsavedChanges()) { return; } DataToUI(NewT()); BaseEditor.CurrentFile = ""; VoiceAssist.Say("New"); }
public T Remove() { if (ConfirmDialog("Are you sure you want to delete " + Data[SelectedIndex].Name + "?", "Delete")) { T temp = Data[SelectedIndex]; Data.RemoveAt(SelectedIndex); UpdateList(); VoiceAssist.Say("Delete"); return(temp); } return(null); }
private void ListBox_DoubleClick(object sender, EventArgs e) { if (BaseEditor.HasUnsavedChanges()) { return; } if (SelectedIndex >= 0) { DataToUI(Data[SelectedIndex]); VoiceAssist.Say("Open"); } }
private void btnNew_Click(object sender, EventArgs e) { if (HasUnsavedChanges()) { return; } txtName.Text = ""; txtText.Text = DataDirectory.LoadFile("BaseConversation"); CurrentFile = ""; CurrentFilePath = ""; VoiceAssist.Say("New"); }
private void btnDelete_Click(object sender, EventArgs e) { string toDelete = flbFiles.SelectedFilename ?? txtLevelName.Text; if (CurrentDirectory.CheckFileExist(toDelete + CurrentDirectory.DefultFileFormat)) { if (DeleteFile(toDelete, CurrentDirectory)) { flbFiles.UpdateList(); VoiceAssist.Say("Delete"); } } }
public void Save(string editingName) { T editing = Data.Find(a => a.Name == editingName); if (editing != null) { DataFromUI(editing); } else { editing = DataFromUI(NewT()); Data.Add(editing); } UpdateList(); BaseEditor.Dirty = false; VoiceAssist.Say("Save"); }
private void frmPreferences_Load(object sender, EventArgs e) { if (Preferences.Current.VoiceAssistAvailable) { grpVoice.Visible = true; cmbVoice.Items.Add("None"); cmbVoice.Items.AddRange(VoiceAssist.GetAvailableVoices()); cmbVoice.SelectedItem = string.IsNullOrEmpty(Preferences.Current.VoiceAssist) ? "None" : Preferences.Current.VoiceAssist; VoiceAssist.Say("Ready"); } else { Height -= 46; } ckbDarkMode.Checked = Preferences.Current.DarkMode; nudZoomAmount.Value = (decimal)Preferences.Current.ZoomAmount; this.ApplyPreferences(); CenterToParent(); }
private void btnSave_Click(object sender, EventArgs e) { void UpdateList() { flbFileBrowser.UpdateList(); flbFileBrowser.SelectedFilename = CurrentFileName; CurrentFilePath = CurrentDirectory.Path; } if (CurrentFilePath != "" && CurrentFilePath != CurrentDirectory.Path && txtName.Text == CurrentFileName) { if (ConfirmDialog("It appears that you're trying to save an existing file in another directory. Is this intended?", "")) { CurrentFilePath = CurrentDirectory.Path; } else { CurrentDirectory.Path = CurrentFilePath; } CurrentDirectory.SaveFile(txtName.Text, txtText.Text); Dirty = false; UpdateList(); } else if (CurrentFilePath != CurrentDirectory.Path || txtName.Text != CurrentFileName) { CurrentFileName = txtName.Text; CurrentFilePath = CurrentDirectory.Path; CurrentDirectory.SaveFile(txtName.Text, txtText.Text); Dirty = false; UpdateList(); } else { CurrentDirectory.SaveFile(txtName.Text, txtText.Text); Dirty = false; } if (CurrentFilePath != CurrentDirectory.Path) { CurrentFilePath = CurrentDirectory.Path; } VoiceAssist.Say("Save"); }
public void Navigate(string place) { if (place[0] == @"\"[0]) { if (place == @"\..") { Directory.Path = Directory.Path.Substring(0, Directory.Path.LastIndexOf(Directory.Seperator)); } else { Directory.CreateDirectory(place.Substring(1), true); } UpdateList(); } else { OnFileSelected(lstFiles.SelectedItem.ToString()); VoiceAssist.Say("Open"); } }
private void btnNew_Click(object sender, EventArgs e) { if (HasUnsavedChanges()) { return; } Units.Clear(); UpdateUnitListBox(); txtLevelName.Text = ""; nudLevelNumber.Value = 0; rdbRout.Checked = true; for (int i = 0; i < Size.X; i++) { for (int j = 0; j < Size.Y; j++) { Tiles[i, j].TileID = 0; } } cmbTileSets.SelectedIndex = 0; SetTileSet(Tilesets[0]); Render(); CurrentFile = ""; VoiceAssist.Say("New"); }
private void frmPreferences_FormClosed(object sender, FormClosedEventArgs e) { VoiceAssist.SelectVoice(Preferences.Current.VoiceAssist); }