Пример #1
0
        private void ShowSaveFileDialog()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.FileName = Path.GetFileNameWithoutExtension(_script.FileName) + ".btree";
            saveFileDialog.Filter   = "BT Scripts (*.btree)|*.btree|All files (*.*)|*.*";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                _script.Save(saveFileDialog.FileName);
                ScriptNameChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #2
0
        public void LoadData(BTScript script)
        {
            if (_engine.IsDesignMode)
            {
                return;
            }

            UnloadData();

            _script = script;

            _controller = new TreeListController <Node>(
                behaviorTreeTL, _script.BehaviorTree, new BTNodeMapper());
            _controller.AutoSortCompare = null;

            if (behaviorTreeTL.Nodes.Count > 0)
            {
                behaviorTreeTL.Nodes[0].ExpandAll();
            }
            behaviorTreeTL.FocusedNode = null;
            behaviorTreeTL.FocusedNode = behaviorTreeTL.Nodes.FirstNode;

            ScriptNameChanged?.Invoke(this, EventArgs.Empty);
        }