Esempio n. 1
0
        public static void ShowGo()
        {
            TextNewECtrl window = ScriptableObject.CreateInstance <TextNewECtrl>();

            if (Instance == null)
            {
                Instance = new RunTimeNodesManager();
            }
            InitCtrl(window);

            foreach (GameObject go in Selection.gameObjects)
            {
                string path = AssetDatabase.GetAssetPath(go);
                try
                {
                    BehaviorTreeConfig config = go.GetComponent <BehaviorTreeConfig>();
                    if (config == null)
                    {
                        Log.Debug($"{go.name}不是行为树");
                        continue;
                    }
                    Instance.InitBeTree(config.RootNodeProto, path, go.GetInstanceID());
                    window.SetName(Path.GetFileNameWithoutExtension(path));
                }
                catch (Exception err)
                {
                    BehaviourTreeDebugPanel.Error(Instance._curOpenningCtrl, $"打开行为树失败:{path}-> {err}");
                }
            }
        }
Esempio n. 2
0
 public static void Log(TextNewECtrl root, object data)
 {
     root.BTreeDebugPanel.DebugInfoText.Color   = Color.white;
     root.BTreeDebugPanel.DebugInfoText.Content = data;
     root.BTreeDebugPanel._curShowTime          = DateTime.Now;
     root.BTreeDebugPanel.Active = true;
 }
Esempio n. 3
0
 private void LostFocus(EditorControlDialog obj)
 {
     if (_curOpenningCtrl == obj)
     {
         _curOpenningCtrl = null;
     }
 }
Esempio n. 4
0
        private static void InitCtrl(TextNewECtrl window)
        {
            Instance._curOpenningCtrl  = window;
            window.OnNodeClick         = Instance.OnNodeClick;
            window.OnNodeRightClick    = Instance.CanvasRightClick;
            window.OnChildTypeSelected = Instance.AddChild;
            window.OnNodeRemove        = Instance.RemoveNode;
            window.NodeSetToChild      = Instance.CutAndCopy;
            window.NodeInsert          = Instance.Insert;
            window.OnSave        = Instance.Save;
            window.SaveToJson    = Instance.SaveToJson;
            window.OpenTree      = Instance.OpenTree;
            window.Replace       = Instance.Replace;
            window.CreateNewTree = Instance.CreateNewTree;
            window.Copy          = Instance.Copy;
            window.RecaluOutput  = Instance.RecaluOutput;
            window.ResetID       = Instance.ResetID;

            window.ShowDebugData  = Instance.ShowDebugData;
            window.ClearDebugData = Instance.ClearDebugData;

            window.OnWindowFocus.Add(Instance.SetFocus);
            window.OnDispose.Add(Instance.OnWindowClose);
            Instance._ctrls.Add(window);
            window.SetEvent();
            window.Show();
        }
Esempio n. 5
0
        public static void Error(TextNewECtrl root, object data)
        {
            Model.Log.Error(data.ToString());
            root.BTreeDebugPanel.DebugInfoText.Color   = Color.red;
            root.BTreeDebugPanel.DebugInfoText.Content = data;
            root.BTreeDebugPanel._curShowTime          = DateTime.Now;
            root.BTreeDebugPanel.Active = true;

            EditorUtility.DisplayDialog("错误", data.ToString(), "确认");
        }
Esempio n. 6
0
        private void OnWindowClose(IEditorControl obj)
        {
            TextNewECtrl ctrl = obj as TextNewECtrl;

            foreach (int id in ctrl.IncludeIds)
            {
                _paramsPath.Remove(_datas[id]);
                _datas.Remove(id);
                _id2Windows.Remove(id);
            }
            _ctrls.Remove(ctrl);
        }
Esempio n. 7
0
        public static void ShowGo(string path)
        {
            TextNewECtrl window = ScriptableObject.CreateInstance <TextNewECtrl>();

            if (Instance == null)
            {
                Instance = new RunTimeNodesManager();
            }

            InitCtrl(window);
            try
            {
                Instance.CreateNewTree(path);
            }
            catch (Exception err)
            {
                BehaviourTreeDebugPanel.Error(Instance._curOpenningCtrl, $"打开行为树失败:{path}-> {err}");
            }
        }
Esempio n. 8
0
 private void SetFocus(EditorControlDialog obj)
 {
     _curOpenningCtrl = obj as TextNewECtrl;
 }