public void saveBTree(string type) { if (mGraphDesigner == null || mGraphDesigner.m_RootNode == null) { EditorUtility.DisplayDialog("Save Error", "未创建根节点", "ok"); return; } string suffix = ""; if (type == "xml") { suffix = "xml"; } else if (type == "binary") { suffix = "btreeEditor"; } string text = EditorUtility.SaveFilePanel("Save Behavior Tree", BTreeEditorSerialization.m_ConfigPath, mGraphDesigner.m_RootNode.m_NodeName, suffix); if (text.Length != 0 && Application.dataPath.Length < text.Length) { Debugger.Log("saveBTree"); BTreeEditorConfig _config = BTreeEditorNodeFactory.CreateBtreeEditorConfigFromGraphDesigner(mGraphDesigner); BTreeEditorSerialization.WirteXMLAtPath(_config, text); EditorUtility.DisplayDialog("Save", "保存行为树编辑器成功:" + text, "ok"); } }
public void loadBTree() { string text = EditorUtility.OpenFilePanel("Load Behavior Tree", "Assets/Editor/BtreeEditor/Config", "xml"); if (!string.IsNullOrEmpty(text)) { Debugger.Log("loadBTree"); BTreeEditorConfig _config = BTreeEditorSerialization.ReadXMLAtPath(text); mGraphDesigner = (new BTreeGraphDesigner()); mGraphDesigner.load(_config); } }
public void loadBTree(string type) { string text = EditorUtility.OpenFilePanel("Load Behavior Tree", BTreeEditorSerialization.m_ConfigPath, type); if (!string.IsNullOrEmpty(text)) { Debugger.Log("loadBTree:" + type); BTreeEditorConfig _config = null; if (type == "xml") { _config = BTreeEditorSerialization.ReadXMLAtPath(text); } else if (type == "binary") { _config = BTreeEditorSerialization.ReadBinary(text); } mGraphDesigner = (new BTreeGraphDesigner()); mGraphDesigner.load(_config); } }