Пример #1
0
 private void LoadAiFromFile(string behaviourPath)
 {
     if (behaviourPath != string.Empty)
     {
         nodes = TreeEditorIO.LoadFileToTree(behaviourPath);
         this.behaviourPath = behaviourPath;
         RecalcWindowNodes();
     }
 }
Пример #2
0
                private void ContextInsert(object obj)
                {
                    var pos = (Vector2)obj;

                    var nodes = TreeEditorIO.GetNodes(bufferCopy);

                    ShiftWindowPositionNodes(nodes, scrollPos + pos - nodes[0].GetPosition());

                    this.nodes.AddRange(nodes);
                }
Пример #3
0
                private void SaveFilePanel()
                {
                    var path = EditorUtility.SaveFilePanel(
                        "Save Ai",
                        Application.dataPath + CATALOG,
                        "",
                        "AiBT");

                    behaviourPath = path;
                    TreeEditorIO.SaveTreeToFile(path, nodes);
                }
Пример #4
0
                private void ContextCopy(object obj)
                {
                    var node = obj as NodeEditor;
                    List <NodeEditor> nodes = new List <NodeEditor> ();

                    nodes.Add(node);
                    GetChildren(node, nodes);
                    Debug.Log("nodes copied " + nodes.Count);

                    bufferCopy = TreeEditorIO.GetJsonData(nodes);
                    Debug.Log(bufferCopy);
                }
Пример #5
0
                private void HandlePanel()
                {
                    switch (selectedToolbar)
                    {
                    case -1:
                        return;

                    case 0:
                    {
                        if (EditorUtility.DisplayDialog("New Ai", "Are u sure about this?", "Plus", "Minus"))
                        {
                            NewBehaviour();
                            Repaint();
                        }
                    }
                    break;

                    case 1:
                    {
                        var path = EditorUtility.OpenFilePanel(
                            "Open Ai file",
                            Application.dataPath + CATALOG,
                            "AiBT");

                        LoadAiFromFile(path);
                    }
                    break;

                    case 2:
                    {
                        SaveFilePanel();
                    }
                    break;

                    case 3:
                    {
                        ;
                        if (behaviourPath != string.Empty)
                        {
                            TreeEditorIO.SaveTreeToFile(behaviourPath, nodes);
                        }
                        else
                        {
                            SaveFilePanel();
                        }
                    }
                    break;
                    }
                    selectedToolbar = -1;
                }