public void LoadBTree() { string text = EditorUtility.OpenFilePanel("Load Behavior Tree", BTEditorUtility.editorPath + "Config", "xml"); if (!string.IsNullOrEmpty(text)) { Debugger.Log("loadBTree"); BTEditorConfig _config = BTEditorSerialization.ReadXMLAtPath(text); mGraphDesigner = (new BTGraphDesigner()); mGraphDesigner.Load(_config); } }
public void ExportBinaryBTree() { if (mGraphDesigner == null || mGraphDesigner.mRootNode == null) { EditorUtility.DisplayDialog("Export Error", "未创建根节点", "ok"); return; } Debugger.Log("exportBtree"); TreeConfig _treeConfig = BTEditorNodeFactory.CreateTreeConfigFromBTreeGraphDesigner(mGraphDesigner); string name = mGraphDesigner.mRootNode.NodeName; BTEditorSerialization.ExportBinary(_treeConfig, name); EditorUtility.DisplayDialog("Export", "导出行为树配置成功:" + name, "ok"); }
public void SaveBTree() { if (mGraphDesigner == null || mGraphDesigner.mRootNode == null) { EditorUtility.DisplayDialog("Save Error", "未创建根节点", "ok"); return; } string text = EditorUtility.SaveFilePanel("Save Behavior Tree", BTEditorUtility.editorPath + "Config", mGraphDesigner.mRootNode.NodeName, "xml"); if (text.Length != 0 && Application.dataPath.Length < text.Length) { Debugger.Log("saveBTree"); BTEditorConfig _config = BTEditorNodeFactory.CreateBtreeEditorConfigFromGraphDesigner(mGraphDesigner); BTEditorSerialization.WirteXMLAtPath(_config, text); EditorUtility.DisplayDialog("Save", "保存行为树编辑器成功:" + text, "ok"); } }
public void ExportXMLBTree() { if (mGraphDesigner == null || mGraphDesigner.mRootNode == null) { EditorUtility.DisplayDialog("Export Error", "未创建根节点", "ok"); return; } string text = EditorUtility.SaveFilePanel("Save Behavior Tree", BTEditorSerialization.exportConfigPath, mGraphDesigner.mRootNode.NodeName, "xml"); if (text.Length != 0 && Application.dataPath.Length < text.Length) { Debugger.Log("exportBtree"); TreeConfig _treeConfig = BTEditorNodeFactory.CreateTreeConfigFromBTreeGraphDesigner(mGraphDesigner); BTEditorSerialization.ExportXML(_treeConfig, System.IO.Path.GetFileNameWithoutExtension(text)); EditorUtility.DisplayDialog("Export", "导出行为树配置成功:" + text, "ok"); } }