Esempio n. 1
0
    private ActionTree drawAction(ActionTree action, int depth, int offset, object param)
    {
        Vector2 pos = _mgr.CurrStartPos;
        var rect = new Rect(pos.x + depth * H, pos.y + offset * H, W - 20 * depth, H);
        GUI.Box(rect, action.Data.ToString());

        return null;
    }
Esempio n. 2
0
    private void resetNodePos(ActionTree node)
    {
        Vector2 vct = new Vector2(node.Data.x, node.Data.y);

        _mgr.Traverse((curr, depth, offset, param) =>
        {
            if (node == curr)
            {
                Vector2 pos = _mgr.CurrStartPos;
                vct.x = pos.x + depth * H;
                vct.y = pos.y + offset * H;
                return curr;
            }
            return null;
        }, null);
        node.Data.x = vct.x;
        node.Data.y = vct.y;
    }
Esempio n. 3
0
    private void OnMouseDown(Event evt)
    {
        bool isLeft = true;
        _selectedNode = GetByPos(evt.mousePosition, out isLeft);
        if (null == _selectedNode)
            return;

        Selection.activeObject = _selectedNode.Data;
        //Editor.CreateEditor(_selectedNode.Data);
        //logNode(_selectedNode, "sel:");
        _isMoving = false;
    }
Esempio n. 4
0
 private void OnMouseUp(Event evt)
 {
     if (null == _selectedNode)
         return;
     bool isLeft = true;
     var toNode = GetByPos(new Vector2(_selectedNode.Data.x, _selectedNode.Data.y - 1), out isLeft);
     //logNode(toNode, "to:");
     if (toNode != null && toNode != _selectedNode)
     {
         _mgr.RemoveNode(_selectedNode);
         if (isLeft)
             toNode.AddNext(_selectedNode);
         else
             toNode.AddChild(_selectedNode);
     }
     _selectedNode = null;
     Repaint();
 }
Esempio n. 5
0
 private void logNode(ActionTree node, string msg)
 {
     if (node != null)
         Debug.Log(msg + node.Data.ToString());
 }