Пример #1
0
    public void CloseView(Action <GameObject, Vector2> buttonsMoveAnimationFunc)
    {
        ChildButtons.ForEach(b => buttonsMoveAnimationFunc(b, Vector2.zero));
        RootButton.SetActive(false);
        ParentButton.SetActive(false);
        NodeToButton.Clear();

        GameObject rootObj = CreateRootButton(Tree.Root);

        rootObj.GetComponent <Button>().onClick.AddListener(OpenView);
        CurrentMiddleNode = Tree.Root;
    }
Пример #2
0
    public void ShowRoot(Action <GameObject, Vector2> buttonsMoveAnimationFunc)
    {
        ChildButtons.ForEach(b => b.SetActive(false));
        RootButton.SetActive(false);
        ParentButton.SetActive(false);
        NodeToButton.Clear();
        if (useSpringJoints)
        {
            ChildButtons.ForEach(b => b.GetComponent <TargetJoint2D>().enabled = false);
        }

        ArrangeNodes(Tree.Root.Children, radius, 0, 330, buttonsMoveAnimationFunc);

        GameObject centerNodeGO = CreateRootButton(Tree.Root);

        centerNodeGO.GetComponent <Button>().onClick.AddListener(() => OnRootNodeClick(Tree.Root));
        CurrentMiddleNode = Tree.Root;
    }
Пример #3
0
    public void ShowNode(TreeNode <E> centralNode, Action <GameObject, Vector2> buttonsMoveAnimationFunc)
    {
        ChildButtons.ForEach(b => b.SetActive(false));
        RootButton.SetActive(false);
        ParentButton.SetActive(false);
        NodeToButton.Clear();
        if (useSpringJoints)
        {
            ChildButtons.ForEach(b => b.GetComponent <TargetJoint2D>().enabled = false);
        }

        ArrangeNodes(centralNode.Children, radius, 0, 270);

        GameObject centerNodeGO = CreateRootButton(centralNode);

        centerNodeGO.GetComponent <Button>().onClick.AddListener(() => OnCenterNodeClick(centralNode));

        GameObject    parentNodeGO     = CreateParentButton(centralNode.Parent);
        RectTransform parentRectTransf = parentNodeGO.GetComponent <RectTransform>();

        parentRectTransf.anchoredPosition = ComputeAnchoredPosition(315, radius + parentRectTransf.sizeDelta.x / 2);
        parentNodeGO.GetComponent <Button>().onClick.AddListener(() => OnParentNodeClick(centralNode.Parent));
        CurrentMiddleNode = centralNode;
    }