// save tree to new file public void SaveToNewFile() { if (ValidateTree() == false) { return; } TreeEdit treeedit = UIHelper.FindChild <TreeEdit>(App._wnd, "MyTreeEdit"); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.OverwritePrompt = true; saveFileDialog.Filter = "Behavior Tree files (*.bht)|*.bht"; //saveFileDialog.InitialDirectory = System.Reflection.Assembly.GetExecutingAssembly().Location + App._resourcesDir; saveFileDialog.InitialDirectory = App._projectDir + App._resourcesDir; if (saveFileDialog.ShowDialog() == true) { // get tree name from file string treename = saveFileDialog.SafeFileName; App._global._treeName = treename.Substring(0, treename.IndexOf('.')); treeedit.SaveTreeToFile(saveFileDialog.FileName); } }
// save tree to file public void SaveToFile() { if (ValidateTree() == false) { return; } if (App._global._treeName != null) { TreeEdit treeedit = UIHelper.FindChild <TreeEdit>(App._wnd, "MyTreeEdit"); string filename = App._projectDir + App._resourcesDir + App._global._treeName + ".bht"; treeedit.SaveTreeToFile(filename); } }