Exemplo n.º 1
0
    public NodeWindow AddWindow(Node node, bool isOpen = true, NodeWindow parentWindow = null)
    {
        var obj = NodeWindow.Instantiate(NodeWindowPrefab, windowViewObject, node);

        nodeWindowList.Add(obj);
        if (isOpen == false)
        {
            //obj.Close();
        }
        //親ウインドウがある時は位置を調整する。
        if (parentWindow != null)
        {
            obj.parentWindow = parentWindow;
            RectTransform objTrans   = obj.GetComponent <RectTransform>();
            RectTransform prentTrans = parentWindow.GetComponent <RectTransform>();
            int           a          = obj.parentWindow.childWindows.Count;
            int           b          = (a % 2 == 0) ? -1:1;
            int           x          = a / 2 * b;
            objTrans.anchoredPosition = new Vector2(prentTrans.anchoredPosition.x + x * 600, prentTrans.anchoredPosition.y - prentTrans.sizeDelta.y - 150);
            LineViewModel.instance.AddLine(prentTrans, objTrans);
        }

        return(obj);
    }